Re: Some questions about arm_lpae_install_table

2020-11-03 Thread Kunkun Jiang
Hi Will and Robin, Sorry for the late reply. On 2020/11/3 18:21, Robin Murphy wrote: On 2020-11-03 09:11, Will Deacon wrote: On Tue, Nov 03, 2020 at 11:00:27AM +0800, Kunkun Jiang wrote: Recently, I have read and learned the code related to io-pgtable-arm.c. There are two question on

Re: [PATCH 1/1] iommu: Fix deferred domain attachment in iommu_probe_device()

2020-11-03 Thread Lu Baolu
Hi Joerg, On 11/3/20 9:23 PM, Joerg Roedel wrote: Hi Baolu, On Mon, Oct 26, 2020 at 02:30:08PM +0800, Lu Baolu wrote: @@ -264,7 +266,8 @@ int iommu_probe_device(struct device *dev) */ iommu_alloc_default_domain(group, dev); - if (group->default_domain) + if

Re: [PATCH v2 3/4] iommu/iova: Flush CPU rcache for when a depot fills

2020-11-03 Thread Robin Murphy
On 2020-11-03 17:56, John Garry wrote: To summarize, the issue is that as time goes by, the CPU rcache and depot rcache continue to grow. As such, IOVA RB tree access time also continues to grow. Hi Robin, I'm struggling to see how this is not simply indicative of a leak originating

Re: [PATCH v3 0/6] Add virtio-iommu built-in topology

2020-11-03 Thread Al Stone
On 06 Oct 2020 17:23, Auger Eric wrote: > Hello Al, > > On 10/2/20 8:23 PM, Al Stone wrote: > > On 24 Sep 2020 11:54, Auger Eric wrote: > >> Hi, > >> > >> Adding Al in the loop > >> > >> On 9/24/20 11:38 AM, Michael S. Tsirkin wrote: > >>> On Thu, Sep 24, 2020 at 11:21:29AM +0200, Joerg Roedel

Re: (proposal) RE: [PATCH v7 00/16] vfio: expose virtual Shared Virtual Addressing to VMs

2020-11-03 Thread j...@8bytes.org
On Tue, Nov 03, 2020 at 01:48:51PM -0400, Jason Gunthorpe wrote: > I think the same PCI driver with a small flag to support the PF or > VF is not the same as two completely different drivers in different > subsystems There are counter-examples: ixgbe vs. ixgbevf. Note that also a single driver

Re: [PATCH v5 0/7] arm64: Default to 32-bit wide ZONE_DMA

2020-11-03 Thread Catalin Marinas
On Tue, Nov 03, 2020 at 06:00:33PM +0100, Nicolas Saenz Julienne wrote: > On Fri, 2020-10-30 at 18:11 +, Catalin Marinas wrote: > > On Thu, Oct 29, 2020 at 06:25:43PM +0100, Nicolas Saenz Julienne wrote: > > > Ard Biesheuvel (1): > > > arm64: mm: Set ZONE_DMA size based on early IORT scan >

Re: can we switch bmips to the generic dma ranges code

2020-11-03 Thread Jim Quinlan via iommu
I'll get on it. Jim On Tue, Nov 3, 2020 at 12:42 PM Florian Fainelli wrote: > > > > On 11/3/2020 2:15 AM, Christoph Hellwig wrote: > > Hi Florian and others, > > > > now that the generic DMA ranges code landed, can we switch bmips over > > to it instead of duplicating the logic? > > This should

Re: [PATCH v18 2/4] iommu/arm-smmu: Add a way for implementations to influence SCTLR

2020-11-03 Thread Bjorn Andersson
On Mon 02 Nov 12:18 CST 2020, Robin Murphy wrote: > On 2020-11-02 17:14, Jordan Crouse wrote: > > From: Rob Clark > > > > For the Adreno GPU's SMMU, we want SCTLR.HUPCF set to ensure that > > pending translations are not terminated on iova fault. Otherwise > > a terminated CP read could hang

Re: [PATCH v2 3/4] iommu/iova: Flush CPU rcache for when a depot fills

2020-11-03 Thread John Garry
To summarize, the issue is that as time goes by, the CPU rcache and depot rcache continue to grow. As such, IOVA RB tree access time also continues to grow. Hi Robin, I'm struggling to see how this is not simply indicative of a leak originating elsewhere. It sounds like one, but I don't

Re: (proposal) RE: [PATCH v7 00/16] vfio: expose virtual Shared Virtual Addressing to VMs

2020-11-03 Thread Jason Gunthorpe
On Tue, Nov 03, 2020 at 05:55:40PM +0100, j...@8bytes.org wrote: > On Tue, Nov 03, 2020 at 11:22:23AM -0400, Jason Gunthorpe wrote: > > This whole thread was brought up by IDXD which has a SVA driver and > > now wants to add a vfio-mdev driver too. SVA devices that want to be > > plugged into VMs

Re: can we switch bmips to the generic dma ranges code

2020-11-03 Thread Florian Fainelli
On 11/3/2020 2:15 AM, Christoph Hellwig wrote: > Hi Florian and others, > > now that the generic DMA ranges code landed, can we switch bmips over > to it instead of duplicating the logic? This should be fine, I cannot easily test the 338x chips, however as far as PCIe goes, I believe Jim may

[PATCH v6 7/7] mm: Remove examples from enum zone_type comment

2020-11-03 Thread Nicolas Saenz Julienne
We can't really list every setup in common code. On top of that they are unlikely to stay true for long as things change in the arch trees independently of this comment. Suggested-by: Christoph Hellwig Signed-off-by: Nicolas Saenz Julienne Reviewed-by: Christoph Hellwig ---

[PATCH v6 6/7] arm64: mm: Set ZONE_DMA size based on early IORT scan

2020-11-03 Thread Nicolas Saenz Julienne
From: Ard Biesheuvel We recently introduced a 1 GB sized ZONE_DMA to cater for platforms incorporating masters that can address less than 32 bits of DMA, in particular the Raspberry Pi 4, which has 4 or 8 GB of DRAM, but has peripherals that can only address up to 1 GB (and its PCIe host bridge

[PATCH v6 4/7] of: unittest: Add test for of_dma_get_max_cpu_address()

2020-11-03 Thread Nicolas Saenz Julienne
Introduce a test for of_dma_get_max_cup_address(), it uses the same DT data as the rest of dma-ranges unit tests. Signed-off-by: Nicolas Saenz Julienne Reviewed-by: Rob Herring --- Changes since v5: - Update address expected by test Changes since v3: - Remove HAS_DMA guards

[PATCH v6 3/7] of/address: Introduce of_dma_get_max_cpu_address()

2020-11-03 Thread Nicolas Saenz Julienne
Introduce of_dma_get_max_cpu_address(), which provides the highest CPU physical address addressable by all DMA masters in the system. It's specially useful for setting memory zones sizes at early boot time. Signed-off-by: Nicolas Saenz Julienne Reviewed-by: Rob Herring --- Changes since v4:

[PATCH v6 2/7] arm64: mm: Move zone_dma_bits initialization into zone_sizes_init()

2020-11-03 Thread Nicolas Saenz Julienne
zone_dma_bits's initialization happens earlier that it's actually needed, in arm64_memblock_init(). So move it into the more suitable zone_sizes_init(). Signed-off-by: Nicolas Saenz Julienne Tested-by: Jeremy Linton --- arch/arm64/mm/init.c | 7 ++- 1 file changed, 2 insertions(+), 5

[PATCH v6 1/7] arm64: mm: Move reserve_crashkernel() into mem_init()

2020-11-03 Thread Nicolas Saenz Julienne
crashkernel might reserve memory located in ZONE_DMA. We plan to delay ZONE_DMA's initialization after unflattening the devicetree and ACPI's boot table initialization, so move it later in the boot process. Specifically into mem_init(), this is the last place crashkernel will be able to reserve

[PATCH v6 5/7] arm64: mm: Set ZONE_DMA size based on devicetree's dma-ranges

2020-11-03 Thread Nicolas Saenz Julienne
We recently introduced a 1 GB sized ZONE_DMA to cater for platforms incorporating masters that can address less than 32 bits of DMA, in particular the Raspberry Pi 4, which has 4 or 8 GB of DRAM, but has peripherals that can only address up to 1 GB (and its PCIe host bridge can only access the

[PATCH v6 0/7] arm64: Default to 32-bit wide ZONE_DMA

2020-11-03 Thread Nicolas Saenz Julienne
Using two distinct DMA zones turned out to be problematic. Here's an attempt go back to a saner default. I tested this on both a RPi4 and QEMU. --- Changes since v5: - Unify ACPI/DT functions Changes since v4: - Fix of_dma_get_max_cpu_address() so it returns the last addressable addres,

Re: [PATCH v18 2/4] iommu/arm-smmu: Add a way for implementations to influence SCTLR

2020-11-03 Thread Jordan Crouse
On Mon, Nov 02, 2020 at 06:18:45PM +, Robin Murphy wrote: > On 2020-11-02 17:14, Jordan Crouse wrote: > >From: Rob Clark > > > >For the Adreno GPU's SMMU, we want SCTLR.HUPCF set to ensure that > >pending translations are not terminated on iova fault. Otherwise > >a terminated CP read could

Re: [PATCH v5 0/7] arm64: Default to 32-bit wide ZONE_DMA

2020-11-03 Thread Nicolas Saenz Julienne
On Fri, 2020-10-30 at 18:11 +, Catalin Marinas wrote: > On Thu, Oct 29, 2020 at 06:25:43PM +0100, Nicolas Saenz Julienne wrote: > > Ard Biesheuvel (1): > > arm64: mm: Set ZONE_DMA size based on early IORT scan > > > > Nicolas Saenz Julienne (6): > > arm64: mm: Move reserve_crashkernel()

Re: (proposal) RE: [PATCH v7 00/16] vfio: expose virtual Shared Virtual Addressing to VMs

2020-11-03 Thread j...@8bytes.org
On Tue, Nov 03, 2020 at 11:22:23AM -0400, Jason Gunthorpe wrote: > This whole thread was brought up by IDXD which has a SVA driver and > now wants to add a vfio-mdev driver too. SVA devices that want to be > plugged into VMs are going to be common - this architecture that a SVA > driver cannot

Re: [PATCH v2 3/4] iommu/iova: Flush CPU rcache for when a depot fills

2020-11-03 Thread Robin Murphy
On 2020-10-26 17:31, John Garry wrote: Leizhen reported some time ago that IOVA performance may degrade over time [0], but unfortunately his solution to fix this problem was not given attention. To summarize, the issue is that as time goes by, the CPU rcache and depot rcache continue to grow.

Re: [PATCH v5 2/2] iommu/iova: Free global iova rcache on iova alloc failure

2020-11-03 Thread Robin Murphy
On 2020-11-03 14:31, John Garry wrote: On 03/11/2020 12:35, Robin Murphy wrote: On 2020-09-30 08:44, vji...@codeaurora.org wrote: From: Vijayanand Jitta When ever an iova alloc request fails we free the iova ranges present in the percpu iova rcaches and then retry but the global iova rcache

Re: (proposal) RE: [PATCH v7 00/16] vfio: expose virtual Shared Virtual Addressing to VMs

2020-11-03 Thread Jason Gunthorpe
On Tue, Nov 03, 2020 at 03:35:32PM +0100, j...@8bytes.org wrote: > On Tue, Nov 03, 2020 at 10:06:42AM -0400, Jason Gunthorpe wrote: > > The point is that other places beyond VFIO need this > > Which and why? > > > Sure, but sometimes it is necessary, and in those cases the answer > > can't be

Re: (proposal) RE: [PATCH v7 00/16] vfio: expose virtual Shared Virtual Addressing to VMs

2020-11-03 Thread j...@8bytes.org
On Tue, Nov 03, 2020 at 10:06:42AM -0400, Jason Gunthorpe wrote: > The point is that other places beyond VFIO need this Which and why? > Sure, but sometimes it is necessary, and in those cases the answer > can't be "rewrite a SVA driver to use vfio" This is getting to abstract. Can you come up

Re: [PATCH v5 2/2] iommu/iova: Free global iova rcache on iova alloc failure

2020-11-03 Thread John Garry
On 03/11/2020 12:35, Robin Murphy wrote: On 2020-09-30 08:44, vji...@codeaurora.org wrote: From: Vijayanand Jitta When ever an iova alloc request fails we free the iova ranges present in the percpu iova rcaches and then retry but the global iova rcache is not freed as a result we could still

Re: (proposal) RE: [PATCH v7 00/16] vfio: expose virtual Shared Virtual Addressing to VMs

2020-11-03 Thread Jason Gunthorpe
On Tue, Nov 03, 2020 at 03:03:18PM +0100, j...@8bytes.org wrote: > On Tue, Nov 03, 2020 at 09:23:35AM -0400, Jason Gunthorpe wrote: > > Userspace needs fine grained control over the composition of the page > > table behind the PASID, 1:1 with the mm_struct is only one use case. > > VFIO already

Re: [PATCH] iommu: fix a check in iommu_check_bind_data()

2020-11-03 Thread Joerg Roedel
On Tue, Nov 03, 2020 at 01:16:23PM +0300, Dan Carpenter wrote: > The "data->flags" variable is a u64 so if one of the high 32 bits is > set the original code will allow it, but it should be rejected. The > fix is to declare "mask" as a u64 instead of a u32. > > Fixes: d90573812eea ("iommu/uapi:

Re: [PATCH v2 0/2] iommu: Fix a few issues related to PRQ

2020-11-03 Thread Joerg Roedel
On Fri, Oct 30, 2020 at 10:37:22AM +0800, Yi Sun wrote: > We found a few issues about PRQ. So, two patches are cooked to > fix them. Please have a review. Thanks! > > Changes from v1: > > - Modify subject of patch 1 to make it more accurate. > - Move get_domain_info() up to the

Re: [PATCH] iommu/amd: Enforce 4k mapping for certain IOMMU data structures

2020-11-03 Thread Joerg Roedel
Hi Suravee, On Wed, Oct 28, 2020 at 11:18:24PM +, Suravee Suthikulpanit wrote: > AMD IOMMU requires 4k-aligned pages for the event log, the PPR log, > and the completion wait write-back regions. However, when allocating > the pages, they could be part of large mapping (e.g. 2M) page. > This

Re: [PATCH 1/1] iommu/vt-d: Fix kernel NULL pointer dereference in find_domain()

2020-11-03 Thread Joerg Roedel
On Wed, Oct 28, 2020 at 03:07:25PM +0800, Lu Baolu wrote: > Fixes: e2726daea583d ("iommu/vt-d: debugfs: Add support to show page table > internals") > Cc: sta...@vger.kernel.org#v5.6+ > Reported-and-tested-by: Xu Pengfei > Signed-off-by: Lu Baolu Applied for v5.10, thanks.

Re: (proposal) RE: [PATCH v7 00/16] vfio: expose virtual Shared Virtual Addressing to VMs

2020-11-03 Thread Jason Gunthorpe
On Tue, Nov 03, 2020 at 02:18:52PM +0100, j...@8bytes.org wrote: > On Tue, Nov 03, 2020 at 08:56:43AM -0400, Jason Gunthorpe wrote: > > On Tue, Nov 03, 2020 at 10:52:09AM +0100, j...@8bytes.org wrote: > > > So having said this, what is the benefit of exposing those SVA internals > > > to

Re: [PATCH 1/1] iommu: Fix deferred domain attachment in iommu_probe_device()

2020-11-03 Thread Joerg Roedel
Hi Baolu, On Mon, Oct 26, 2020 at 02:30:08PM +0800, Lu Baolu wrote: > @@ -264,7 +266,8 @@ int iommu_probe_device(struct device *dev) >*/ > iommu_alloc_default_domain(group, dev); > > - if (group->default_domain) > + if (group->default_domain && > +

Re: [PATCH] iommu/amd: Increase interrupt remapping table limit to 512 entries

2020-11-03 Thread Joerg Roedel
On Thu, Oct 15, 2020 at 02:50:02AM +, Suravee Suthikulpanit wrote: > Certain device drivers allocate IO queues on a per-cpu basis. > On AMD EPYC platform, which can support up-to 256 cpu threads, > this can exceed the current MAX_IRQ_PER_TABLE limit of 256, > and result in the error message: >

Re: (proposal) RE: [PATCH v7 00/16] vfio: expose virtual Shared Virtual Addressing to VMs

2020-11-03 Thread j...@8bytes.org
On Tue, Nov 03, 2020 at 08:56:43AM -0400, Jason Gunthorpe wrote: > On Tue, Nov 03, 2020 at 10:52:09AM +0100, j...@8bytes.org wrote: > > So having said this, what is the benefit of exposing those SVA internals > > to user-space? > > Only the device use of the PASID is device specific, the actual

Re: (proposal) RE: [PATCH v7 00/16] vfio: expose virtual Shared Virtual Addressing to VMs

2020-11-03 Thread Jason Gunthorpe
On Tue, Nov 03, 2020 at 10:52:09AM +0100, j...@8bytes.org wrote: > So having said this, what is the benefit of exposing those SVA internals > to user-space? Only the device use of the PASID is device specific, the actual PASID and everything on the IOMMU side is generic. There is enough API

Re: [PATCH v5 2/2] iommu/iova: Free global iova rcache on iova alloc failure

2020-11-03 Thread Robin Murphy
On 2020-09-30 08:44, vji...@codeaurora.org wrote: From: Vijayanand Jitta When ever an iova alloc request fails we free the iova ranges present in the percpu iova rcaches and then retry but the global iova rcache is not freed as a result we could still see iova alloc failure even after retry as

Re: [PATCH v4 4/7] iommu: Add quirk for Intel graphic devices in map_sg

2020-11-03 Thread Robin Murphy
On 2020-09-27 07:34, Lu Baolu wrote: Combining the sg segments exposes a bug in the Intel i915 driver which causes visual artifacts and the screen to freeze. This is most likely because of how the i915 handles the returned list. It probably doesn't respect the returned value specifying the

Re: [PATCH v4 0/7] Convert the intel iommu driver to the dma-iommu api

2020-11-03 Thread Joerg Roedel
Hi, On Tue, Nov 03, 2020 at 11:58:26AM +0200, Joonas Lahtinen wrote: > Would that work for you? We intend to send the feature pull requests > to DRM for 5.11 in the upcoming weeks. For the IOMMU side it is best to include the workaround for now. When the DRM fixes are merged into v5.11-rc1

Re: Some questions about arm_lpae_install_table

2020-11-03 Thread Robin Murphy
On 2020-11-03 09:11, Will Deacon wrote: On Tue, Nov 03, 2020 at 11:00:27AM +0800, Kunkun Jiang wrote: Recently, I have read and learned the code related to io-pgtable-arm.c. There are two question on arm_lpae_install_table. 1、the first static arm_lpae_iopte

[PATCH] iommu: fix a check in iommu_check_bind_data()

2020-11-03 Thread Dan Carpenter
The "data->flags" variable is a u64 so if one of the high 32 bits is set the original code will allow it, but it should be rejected. The fix is to declare "mask" as a u64 instead of a u32. Fixes: d90573812eea ("iommu/uapi: Handle data and argsz filled by users") Signed-off-by: Dan Carpenter ---

can we switch bmips to the generic dma ranges code

2020-11-03 Thread Christoph Hellwig
Hi Florian and others, now that the generic DMA ranges code landed, can we switch bmips over to it instead of duplicating the logic? ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu

Re: [PATCH v4 0/7] Convert the intel iommu driver to the dma-iommu api

2020-11-03 Thread Joonas Lahtinen
Quoting Tvrtko Ursulin (2020-11-03 11:14:32) > > > On 03/11/2020 02:53, Lu Baolu wrote: > > On 11/2/20 7:52 PM, Tvrtko Ursulin wrote: > >> > >> On 02/11/2020 02:00, Lu Baolu wrote: > >>> Hi Tvrtko, > >>> On 10/12/20 4:44 PM, Tvrtko Ursulin wrote: > > On 29/09/2020 01:11, Lu Baolu

RE: amdgpu error whenever IOMMU is enabled

2020-11-03 Thread Merger, Edgar [AUTOSOL/MAS/AUGS]
Hi Jörg, I am seeing that amdgpu uses amd_iommu_v2 kernel-module. To me this is the last puzzle piece that was missing to explain the dependency of that bug in amdgpu to the iommu. [cid:image001.png@01D6B1CB.26F9C970] Best regards Edgar From: Merger, Edgar [AUTOSOL/MAS/AUGS] Sent: Freitag,

use of dma_direct_set_offset in (allwinner) drivers

2020-11-03 Thread Christoph Hellwig
Hi all, Linux 5.10-rc1 switched from having a single dma offset in struct device to a set of DMA ranges, and introduced a new helper to set them, dma_direct_set_offset. This in fact surfaced that a bunch of drivers that violate our layering and set the offset from drivers, which meant we had to

Re: (proposal) RE: [PATCH v7 00/16] vfio: expose virtual Shared Virtual Addressing to VMs

2020-11-03 Thread j...@8bytes.org
On Mon, Oct 12, 2020 at 08:38:54AM +, Tian, Kevin wrote: > > From: Jason Wang > > Jason suggest something like /dev/sva. There will be a lot of other > > subsystems that could benefit from this (e.g vDPA). Honestly, I fail to see the benefit of offloading these IOMMU specific setup tasks to

Re: [PATCH for-5.10] swiotlb: remove the tbl_dma_addr argument to swiotlb_tbl_map_single

2020-11-03 Thread Christoph Hellwig
ping? On Fri, Oct 23, 2020 at 08:33:09AM +0200, Christoph Hellwig wrote: > The tbl_dma_addr argument is used to check the DMA boundary for the > allocations, and thus needs to be a dma_addr_t. swiotlb-xen instead > passed a physical address, which could lead to incorrect results for > strange

Re: [PATCH v4 0/7] Convert the intel iommu driver to the dma-iommu api

2020-11-03 Thread Tvrtko Ursulin
On 03/11/2020 02:53, Lu Baolu wrote: On 11/2/20 7:52 PM, Tvrtko Ursulin wrote: On 02/11/2020 02:00, Lu Baolu wrote: Hi Tvrtko, On 10/12/20 4:44 PM, Tvrtko Ursulin wrote: On 29/09/2020 01:11, Lu Baolu wrote: Hi Tvrtko, On 9/28/20 5:44 PM, Tvrtko Ursulin wrote: On 27/09/2020 07:34, Lu

Re: Some questions about arm_lpae_install_table

2020-11-03 Thread Will Deacon
On Tue, Nov 03, 2020 at 11:00:27AM +0800, Kunkun Jiang wrote: > Recently, I have read and learned the code related to io-pgtable-arm.c. > There > are two question on arm_lpae_install_table. > > 1、the first > > > static arm_lpae_iopte arm_lpae_install_table(arm_lpae_iopte *table, > >