Re: [RFC] /dev/ioasid uAPI proposal

2021-06-10 Thread Jason Wang
在 2021/6/10 下午7:47, Jason Gunthorpe 写道: On Thu, Jun 10, 2021 at 10:00:01AM +0800, Jason Wang wrote: 在 2021/6/8 下午9:20, Jason Gunthorpe 写道: On Tue, Jun 08, 2021 at 09:10:42AM +0800, Jason Wang wrote: Well, this sounds like a re-invention of io_uring which has already worked for multifds.

Re: [RFC PATCH v5 00/15] Optimizing iommu_[map/unmap] performance

2021-06-10 Thread Lu Baolu
Hi Isaac, Any update for this series? The iommu core part looks good to me and I also have some patches for Intel IOMMU implementation of [un]map_pages. Just wonder when could iommu core have this optimization. Best regards, baolu On 4/9/21 1:13 AM, Isaac J. Manjarres wrote: When unmapping a

RE: Plan for /dev/ioasid RFC v2

2021-06-10 Thread Tian, Kevin
Hi, Alex, > From: Alex Williamson > Sent: Thursday, June 10, 2021 11:39 PM > > On Wed, 9 Jun 2021 15:49:40 -0300 > Jason Gunthorpe wrote: > > > On Wed, Jun 09, 2021 at 10:27:22AM -0600, Alex Williamson wrote: > > > > > > > It is a kernel decision, because a fundamental task of the kernel is

Re: [PATCH] iommu/io-pgtable-arm: Optimize partial walk flush for large scatter-gather list

2021-06-10 Thread Sai Prakash Ranjan
Hi Krishna, On 2021-06-11 06:07, Krishna Reddy wrote: > No, the unmap latency is not just in some test case written, the issue > is very real and we have workloads where camera is reporting frame > drops because of this unmap latency in the order of 100s of milliseconds. > And hardware team

RE: [PATCH] iommu/io-pgtable-arm: Optimize partial walk flush for large scatter-gather list

2021-06-10 Thread Krishna Reddy
> > No, the unmap latency is not just in some test case written, the issue > > is very real and we have workloads where camera is reporting frame > > drops because of this unmap latency in the order of 100s of milliseconds. > > And hardware team recommends using ASID based invalidations for > >

Re: swiotlb/caamjr regression (Was: [GIT PULL] (swiotlb) stable/for-linus-5.12)

2021-06-10 Thread Horia Geantă
On 6/10/2021 10:41 PM, Linus Torvalds wrote: > > How about a patch like the attached? Does that fix things for you. > Yes, it fixes the caam driver regression. Tested-by: Horia Geantă on top of next-20210610. Thank you, Horia ___ iommu mai

Re: [PATCH v2] iommu/arm-smmu: Fix arm_smmu_device refcount leak in address translation

2021-06-10 Thread Rob Clark
On Wed, Jun 9, 2021 at 7:50 PM Xiyu Yang wrote: > > The reference counting issue happens in several exception handling paths > of arm_smmu_iova_to_phys_hard(). When those error scenarios occur, the > function forgets to decrease the refcount of "smmu" increased by > arm_smmu_rpm_get(), causing a

[PATCH v5 5/5] drm/msm: devcoredump iommu fault support

2021-06-10 Thread Rob Clark
From: Rob Clark Wire up support to stall the SMMU on iova fault, and collect a devcore- dump snapshot for easier debugging of faults. Currently this is a6xx-only, but mostly only because so far it is the only one using adreno-smmu-priv. Signed-off-by: Rob Clark ---

[PATCH v5 4/5] iommu/arm-smmu-qcom: Add stall support

2021-06-10 Thread Rob Clark
From: Rob Clark Add, via the adreno-smmu-priv interface, a way for the GPU to request the SMMU to stall translation on faults, and then later resume the translation, either retrying or terminating the current translation. This will be used on the GPU side to "freeze" the GPU while we snapshot

[PATCH v5 3/5] drm/msm: Improve the a6xx page fault handler

2021-06-10 Thread Rob Clark
From: Jordan Crouse Use the new adreno-smmu-priv fault info function to get more SMMU debug registers and print the current TTBR0 to debug per-instance pagetables and figure out which GPU block generated the request. Signed-off-by: Jordan Crouse Signed-off-by: Rob Clark ---

[PATCH v5 2/5] iommu/arm-smmu-qcom: Add an adreno-smmu-priv callback to get pagefault info

2021-06-10 Thread Rob Clark
From: Jordan Crouse Add a callback in adreno-smmu-priv to read interesting SMMU registers to provide an opportunity for a richer debug experience in the GPU driver. Signed-off-by: Jordan Crouse Signed-off-by: Rob Clark --- drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 17

[PATCH v5 1/5] iommu/arm-smmu: Add support for driver IOMMU fault handlers

2021-06-10 Thread Rob Clark
From: Jordan Crouse Call report_iommu_fault() to allow upper-level drivers to register their own fault handlers. Signed-off-by: Jordan Crouse Signed-off-by: Rob Clark Acked-by: Will Deacon --- drivers/iommu/arm/arm-smmu/arm-smmu.c | 9 +++-- 1 file changed, 7 insertions(+), 2

[PATCH v5 0/5] iommu/arm-smmu: adreno-smmu page fault handling

2021-06-10 Thread Rob Clark
From: Rob Clark This picks up an earlier series[1] from Jordan, and adds additional support needed to generate GPU devcore dumps on iova faults. Original description: This is a stack to add an Adreno GPU specific handler for pagefaults. The first patch starts by wiring up report_iommu_fault

Re: swiotlb/caamjr regression (Was: [GIT PULL] (swiotlb) stable/for-linus-5.12)

2021-06-10 Thread Linus Torvalds
On Thu, Jun 10, 2021 at 7:52 AM Horia Geantă wrote: > > Documentation/core-api/dma-api.rst explicitly allows for partial syncs: > Synchronise a single contiguous or scatter/gather mapping for the CPU > and device. With the sync_sg API, all the parameters must be the same > as those passed into

Re: [GIT PULL] memory: Tegra memory controller for v5.14

2021-06-10 Thread Will Deacon
On Thu, Jun 10, 2021 at 05:05:27PM +0200, Thierry Reding wrote: > On Thu, Jun 10, 2021 at 04:23:56PM +0200, Krzysztof Kozlowski wrote: > > On 10/06/2021 11:19, Thierry Reding wrote: > > > On Tue, Jun 08, 2021 at 05:48:51PM +0100, Will Deacon wrote: > > >> I can queue as much or as little of 2-6 as

Re: [PATCH v3 2/3] dt-bindings: iommu: add DART iommu bindings

2021-06-10 Thread Rob Herring
On Thu, Jun 03, 2021 at 10:50:02AM +0200, Sven Peter wrote: > DART (Device Address Resolution Table) is the iommu found on Apple > ARM SoCs such as the M1. > > Signed-off-by: Sven Peter > --- > .../devicetree/bindings/iommu/apple,dart.yaml | 81 +++ > MAINTAINERS

Re: [RFC] /dev/ioasid uAPI proposal

2021-06-10 Thread Jean-Philippe Brucker
On Tue, Jun 08, 2021 at 04:31:50PM +1000, David Gibson wrote: > For the qemu case, I would imagine a two stage fallback: > > 1) Ask for the exact IOMMU capabilities (including pagetable >format) that the vIOMMU has. If the host can supply, you're >good > > 2) If not, ask

Re: [PATCH v11 0/3] Enhance IOMMU default DMA mode build options

2021-06-10 Thread John Garry
On 09/06/2021 09:15, Joerg Roedel wrote: On Tue, Jun 08, 2021 at 09:18:25PM +0800, John Garry wrote: Zhen Lei (3): iommu: Enhance IOMMU default DMA mode build options iommu/vt-d: Add support for IOMMU default DMA mode build options iommu/amd: Add support for IOMMU default DMA mode

Re: [PATCH] iommu/io-pgtable-arm: Optimize partial walk flush for large scatter-gather list

2021-06-10 Thread Sai Prakash Ranjan
Hi Robin, On 2021-06-10 20:59, Robin Murphy wrote: On 2021-06-10 12:54, Sai Prakash Ranjan wrote: Hi Robin, On 2021-06-10 17:03, Robin Murphy wrote: On 2021-06-10 10:36, Sai Prakash Ranjan wrote: Hi Robin, On 2021-06-10 14:38, Robin Murphy wrote: On 2021-06-10 06:24, Sai Prakash Ranjan

Re: Plan for /dev/ioasid RFC v2

2021-06-10 Thread Alex Williamson
On Wed, 9 Jun 2021 15:49:40 -0300 Jason Gunthorpe wrote: > On Wed, Jun 09, 2021 at 10:27:22AM -0600, Alex Williamson wrote: > > > > > It is a kernel decision, because a fundamental task of the kernel is to > > > > ensure isolation between user-space tasks as good as it can. And if a > > > >

Re: [PATCH] iommu/io-pgtable-arm: Optimize partial walk flush for large scatter-gather list

2021-06-10 Thread Robin Murphy
On 2021-06-10 12:54, Sai Prakash Ranjan wrote: Hi Robin, On 2021-06-10 17:03, Robin Murphy wrote: On 2021-06-10 10:36, Sai Prakash Ranjan wrote: Hi Robin, On 2021-06-10 14:38, Robin Murphy wrote: On 2021-06-10 06:24, Sai Prakash Ranjan wrote: Hi Robin, On 2021-06-10 00:14, Robin Murphy

Re: [GIT PULL] memory: Tegra memory controller for v5.14

2021-06-10 Thread Thierry Reding
On Thu, Jun 10, 2021 at 04:23:56PM +0200, Krzysztof Kozlowski wrote: > On 10/06/2021 11:19, Thierry Reding wrote: > > On Tue, Jun 08, 2021 at 05:48:51PM +0100, Will Deacon wrote: > >> On Tue, Jun 08, 2021 at 04:38:48PM +0200, Thierry Reding wrote: > >>> On Tue, Jun 08, 2021 at 01:01:29PM +0100,

Re: swiotlb/caamjr regression (Was: [GIT PULL] (swiotlb) stable/for-linus-5.12)

2021-06-10 Thread Horia Geantă
On 6/8/2021 5:35 AM, Dominique MARTINET wrote: > I'm not able to find any individual mails for Christoph's patches so > replying to the PR. > The patch set is here: https://lore.kernel.org/linux-iommu/20210207160327.2955490-1-...@lst.de > In particular, this commit: > Konrad Rzeszutek Wilk wrote

Re: [RFC PATCH V3 08/11] swiotlb: Add bounce buffer remap address setting function

2021-06-10 Thread Tianyu Lan
On 6/7/2021 10:56 PM, Tianyu Lan wrote: On 6/7/2021 2:43 PM, Christoph Hellwig wrote: On Sun, May 30, 2021 at 11:06:25AM -0400, Tianyu Lan wrote: From: Tianyu Lan For Hyper-V isolation VM with AMD SEV SNP, the bounce buffer(shared memory) needs to be accessed via extra address

Re: [GIT PULL] memory: Tegra memory controller for v5.14

2021-06-10 Thread Krzysztof Kozlowski
On 10/06/2021 11:19, Thierry Reding wrote: > On Tue, Jun 08, 2021 at 05:48:51PM +0100, Will Deacon wrote: >> On Tue, Jun 08, 2021 at 04:38:48PM +0200, Thierry Reding wrote: >>> On Tue, Jun 08, 2021 at 01:01:29PM +0100, Will Deacon wrote: On Mon, Jun 07, 2021 at 10:49:10AM +0200, Krzysztof

Re: [RFC PATCH V3 03/11] x86/Hyper-V: Add new hvcall guest address host visibility support

2021-06-10 Thread Tianyu Lan
Hi Vitaly: Thanks for your review. On 6/10/2021 5:47 PM, Vitaly Kuznetsov wrote: diff --git a/arch/x86/include/asm/hyperv-tlfs.h b/arch/x86/include/asm/hyperv-tlfs.h index 606f5cc579b2..632281b91b44 100644 --- a/arch/x86/include/asm/hyperv-tlfs.h +++

Re: [RFC PATCH V3 04/11] HV: Add Write/Read MSR registers via ghcb

2021-06-10 Thread Tianyu Lan
On 6/9/2021 8:46 PM, Joerg Roedel wrote: On Sun, May 30, 2021 at 11:06:21AM -0400, Tianyu Lan wrote: +void hv_ghcb_msr_write(u64 msr, u64 value) +{ + union hv_ghcb *hv_ghcb; + void **ghcb_base; + unsigned long flags; + + if (!ms_hyperv.ghcb_base) +

Re: [RFC PATCH V3 01/11] x86/HV: Initialize GHCB page in Isolation VM

2021-06-10 Thread Tianyu Lan
Hi Joerg: Thanks for your review. On 6/9/2021 8:38 PM, Joerg Roedel wrote: On Sun, May 30, 2021 at 11:06:18AM -0400, Tianyu Lan wrote: From: Tianyu Lan Hyper-V exposes GHCB page via SEV ES GHCB MSR for SNP guest to communicate with hypervisor. Map GHCB page for all cpus to

Re: [PATCH v5 13/16] media: mtk-vcodec: Get rid of mtk_smi_larb_get/put

2021-06-10 Thread Yong Wu
On Thu, 2021-06-10 at 09:53 +0200, Matthias Brugger wrote: > Hi Yong, > > On 12/05/2021 14:29, Yong Wu wrote: > > On Wed, 2021-05-12 at 17:20 +0800, Hsin-Yi Wang wrote: > >> On Sat, Apr 10, 2021 at 5:14 PM Yong Wu wrote: > >>> > >>> MediaTek IOMMU has already added the device_link between the

Re: [PATCH] iommu/io-pgtable-arm: Optimize partial walk flush for large scatter-gather list

2021-06-10 Thread Thierry Reding
On Thu, Jun 10, 2021 at 12:33:56PM +0100, Robin Murphy wrote: > On 2021-06-10 10:36, Sai Prakash Ranjan wrote: > > Hi Robin, > > > > On 2021-06-10 14:38, Robin Murphy wrote: > > > On 2021-06-10 06:24, Sai Prakash Ranjan wrote: > > > > Hi Robin, > > > > > > > > On 2021-06-10 00:14, Robin Murphy

Re: [PATCH v5 11/16] drm/mediatek: Get rid of mtk_smi_larb_get/put

2021-06-10 Thread Yong Wu
On Wed, 2021-05-26 at 08:41 +0300, Dafna Hirschfeld wrote: > Hi > > On 10.04.21 12:11, Yong Wu wrote: > > MediaTek IOMMU has already added the device_link between the consumer > > and smi-larb device. If the drm device call the pm_runtime_get_sync, > > the smi-larb's pm_runtime_get_sync also be

Re: [PATCH] iommu/io-pgtable-arm: Optimize partial walk flush for large scatter-gather list

2021-06-10 Thread Sai Prakash Ranjan
Hi Robin, On 2021-06-10 17:03, Robin Murphy wrote: On 2021-06-10 10:36, Sai Prakash Ranjan wrote: Hi Robin, On 2021-06-10 14:38, Robin Murphy wrote: On 2021-06-10 06:24, Sai Prakash Ranjan wrote: Hi Robin, On 2021-06-10 00:14, Robin Murphy wrote: On 2021-06-09 15:53, Sai Prakash Ranjan

Re: [RFC] /dev/ioasid uAPI proposal

2021-06-10 Thread Jason Gunthorpe
On Thu, Jun 10, 2021 at 10:00:01AM +0800, Jason Wang wrote: > > 在 2021/6/8 下午9:20, Jason Gunthorpe 写道: > > On Tue, Jun 08, 2021 at 09:10:42AM +0800, Jason Wang wrote: > > > > > Well, this sounds like a re-invention of io_uring which has already worked > > > for multifds. > > How so? io_uring is

Re: [PATCH] iommu/io-pgtable-arm: Optimize partial walk flush for large scatter-gather list

2021-06-10 Thread Robin Murphy
On 2021-06-10 10:36, Sai Prakash Ranjan wrote: Hi Robin, On 2021-06-10 14:38, Robin Murphy wrote: On 2021-06-10 06:24, Sai Prakash Ranjan wrote: Hi Robin, On 2021-06-10 00:14, Robin Murphy wrote: On 2021-06-09 15:53, Sai Prakash Ranjan wrote: Currently for iommu_unmap() of large

Re: [RFC PATCH V3 10/11] HV/Netvsc: Add Isolation VM support for netvsc driver

2021-06-10 Thread Vitaly Kuznetsov
Tianyu Lan writes: > From: Tianyu Lan > > In Isolation VM, all shared memory with host needs to mark visible > to host via hvcall. vmbus_establish_gpadl() has already done it for > netvsc rx/tx ring buffer. The page buffer used by vmbus_sendpacket_ > pagebuffer() still need to handle. Use DMA

Re: [RFC PATCH V3 03/11] x86/Hyper-V: Add new hvcall guest address host visibility support

2021-06-10 Thread Vitaly Kuznetsov
Tianyu Lan writes: > From: Tianyu Lan > > Add new hvcall guest address host visibility support. Mark vmbus > ring buffer visible to host when create gpadl buffer and mark back > to not visible when tear down gpadl buffer. > > Co-developed-by: Sunil Muthuswamy > Signed-off-by: Tianyu Lan > ---

Re: [PATCH] iommu/io-pgtable-arm: Optimize partial walk flush for large scatter-gather list

2021-06-10 Thread Sai Prakash Ranjan
Hi Robin, On 2021-06-10 14:38, Robin Murphy wrote: On 2021-06-10 06:24, Sai Prakash Ranjan wrote: Hi Robin, On 2021-06-10 00:14, Robin Murphy wrote: On 2021-06-09 15:53, Sai Prakash Ranjan wrote: Currently for iommu_unmap() of large scatter-gather list with page size elements, the majority

Re: [GIT PULL] memory: Tegra memory controller for v5.14

2021-06-10 Thread Thierry Reding
On Tue, Jun 08, 2021 at 05:48:51PM +0100, Will Deacon wrote: > On Tue, Jun 08, 2021 at 04:38:48PM +0200, Thierry Reding wrote: > > On Tue, Jun 08, 2021 at 01:01:29PM +0100, Will Deacon wrote: > > > On Mon, Jun 07, 2021 at 10:49:10AM +0200, Krzysztof Kozlowski wrote: > > > > This is the pull for

Re: [PATCH] iommu/io-pgtable-arm: Optimize partial walk flush for large scatter-gather list

2021-06-10 Thread Robin Murphy
On 2021-06-10 06:24, Sai Prakash Ranjan wrote: Hi Robin, On 2021-06-10 00:14, Robin Murphy wrote: On 2021-06-09 15:53, Sai Prakash Ranjan wrote: Currently for iommu_unmap() of large scatter-gather list with page size elements, the majority of time is spent in flushing of partial walks in

[PATCH] iommu/vt-d: Fix linker error on 32-bit

2021-06-10 Thread Joerg Roedel
From: Joerg Roedel A recent commit broke the build on 32-bit x86. The linker throws these messages: ld: drivers/iommu/intel/perf.o: in function `dmar_latency_snapshot': perf.c:(.text+0x40c): undefined reference to `__udivdi3' ld: perf.c:(.text+0x458): undefined reference

[PATCH v4 5/6] iommu/dma: Simplify calls to iommu_setup_dma_ops()

2021-06-10 Thread Jean-Philippe Brucker
dma-iommu uses the address bounds described in domain->geometry during IOVA allocation. The address size parameters of iommu_setup_dma_ops() are useful for describing additional limits set by the platform firmware, but aren't needed for drivers that call this function from probe_finalize(). The

[PATCH v4 4/6] iommu/dma: Pass address limit rather than size to iommu_setup_dma_ops()

2021-06-10 Thread Jean-Philippe Brucker
Passing a 64-bit address width to iommu_setup_dma_ops() is valid on virtual platforms, but isn't currently possible. The overflow check in iommu_dma_init_domain() prevents this even when @dma_base isn't 0. Pass a limit address instead of a size, so callers don't have to fake a size to work around

[PATCH v4 3/6] ACPI: Add driver for the VIOT table

2021-06-10 Thread Jean-Philippe Brucker
The ACPI Virtual I/O Translation Table describes topology of para-virtual platforms, similarly to vendor tables DMAR, IVRS and IORT. For now it describes the relation between virtio-iommu and the endpoints it manages. Three steps are needed to configure DMA of endpoints: (1) acpi_viot_init():

[PATCH v4 6/6] iommu/virtio: Enable x86 support

2021-06-10 Thread Jean-Philippe Brucker
With the VIOT support in place, x86 platforms can now use the virtio-iommu. Because the other x86 IOMMU drivers aren't yet ready to use the acpi_dma_setup() path, x86 doesn't implement arch_setup_dma_ops() at the moment. Similarly to Vt-d and AMD IOMMU, call iommu_setup_dma_ops() from

[PATCH v4 0/6] Add support for ACPI VIOT

2021-06-10 Thread Jean-Philippe Brucker
Add a driver for the ACPI VIOT table, which provides topology information for para-virtual IOMMUs. Enable virtio-iommu on non-devicetree platforms, including x86. Since v3 [1] I fixed a build bug for !CONFIG_IOMMU_API. Joerg offered to take this series through the IOMMU tree, which requires Acks

[PATCH v4 2/6] ACPI: Move IOMMU setup code out of IORT

2021-06-10 Thread Jean-Philippe Brucker
Extract the code that sets up the IOMMU infrastructure from IORT, since it can be reused by VIOT. Move it one level up into a new acpi_iommu_configure_id() function, which calls the IORT parsing function which in turn calls the acpi_iommu_fwspec_init() helper. Signed-off-by: Jean-Philippe Brucker

[PATCH v4 1/6] ACPI: arm64: Move DMA setup operations out of IORT

2021-06-10 Thread Jean-Philippe Brucker
Extract generic DMA setup code out of IORT, so it can be reused by VIOT. Keep it in drivers/acpi/arm64 for now, since it could break x86 platforms that haven't run this code so far, if they have invalid tables. Signed-off-by: Jean-Philippe Brucker --- drivers/acpi/arm64/Makefile | 1 +

Re: [PATCH v5 13/16] media: mtk-vcodec: Get rid of mtk_smi_larb_get/put

2021-06-10 Thread Matthias Brugger
Hi Yong, On 12/05/2021 14:29, Yong Wu wrote: > On Wed, 2021-05-12 at 17:20 +0800, Hsin-Yi Wang wrote: >> On Sat, Apr 10, 2021 at 5:14 PM Yong Wu wrote: >>> >>> MediaTek IOMMU has already added the device_link between the consumer >>> and smi-larb device. If the vcodec device call the

Re: [PATCH v3 2/6] ACPI: Move IOMMU setup code out of IORT

2021-06-10 Thread Jean-Philippe Brucker
On Fri, Jun 04, 2021 at 05:22:07PM +0200, Joerg Roedel wrote: > On Thu, Jun 03, 2021 at 09:26:39AM +0200, Jean-Philippe Brucker wrote: > > These are only defined when CONFIG_IOMMU_API is set. IORT uses them inside > > an #ifdef, I can do the same. Maybe moving these two functions to a new > >

Re: [PATCH 00/23] [PULL REQUEST] Intel IOMMU Updates for Linux v5.14

2021-06-10 Thread Joerg Roedel
On Thu, Jun 10, 2021 at 10:00:52AM +0800, Lu Baolu wrote: > include/linux/intel-iommu.h| 44 +- > drivers/iommu/intel/perf.h | 73 > include/trace/events/intel_iommu.h | 37 ++ > drivers/iommu/intel/debugfs.c | 111 + > drivers/iommu/intel/dmar.c | 54 ++-