Re: [PATCH v5 0/5] iommu: Allow IOVA rcache range be configured

2022-02-28 Thread John Garry via iommu
On 14/02/2022 17:29, John Garry wrote: Hi guys, And a friendly reminder on this series also. Cheers, john For streaming DMA mappings involving an IOMMU and whose IOVA len regularly exceeds the IOVA rcache upper limit (meaning that they are not cached), performance can be reduced. This may

Re: [PATCH v5 00/34] MT8195 IOMMU SUPPORT

2022-02-28 Thread Joerg Roedel
Hi Yong Wu, On Thu, Feb 17, 2022 at 07:34:19PM +0800, Yong Wu wrote: > Yong Wu (34): > dt-bindings: mediatek: mt8195: Add binding for MM IOMMU > dt-bindings: mediatek: mt8195: Add binding for infra IOMMU > iommu/mediatek: Fix 2 HW sharing pgtable issue > iommu/mediatek: Add list_del in

RE: [PATCH 08/11] swiotlb: make the swiotlb_init interface more useful

2022-02-28 Thread Michael Kelley (LINUX) via iommu
From: Christoph Hellwig Sent: Monday, February 28, 2022 3:31 AM > > On Mon, Feb 28, 2022 at 02:53:39AM +, Michael Kelley (LINUX) wrote: > > From: Christoph Hellwig Sent: Sunday, February 27, 2022 6:31 > > AM > > > > > > Pass a bool to pass if swiotlb needs to be enabled based on the > > >

Re: [PATCH v5 00/34] MT8195 IOMMU SUPPORT

2022-02-28 Thread AngeloGioacchino Del Regno
Il 28/02/22 13:34, Joerg Roedel ha scritto: Hi Yong Wu, On Thu, Feb 17, 2022 at 07:34:19PM +0800, Yong Wu wrote: Yong Wu (34): dt-bindings: mediatek: mt8195: Add binding for MM IOMMU dt-bindings: mediatek: mt8195: Add binding for infra IOMMU iommu/mediatek: Fix 2 HW sharing pgtable

Re: [PATCH] dma-mapping: remove CONFIG_DMA_REMAP

2022-02-28 Thread Robin Murphy
On 2022-02-27 14:35, Christoph Hellwig wrote: CONFIG_DMA_REMAP is used to build a few helpers around the core vmalloc code, and to use them in case there is a highmem page in dma-direct, and to make dma coherent allocations be able to use non-contiguous pages allocations for DMA allocations in

Re: [PATCH] dma-mapping: remove CONFIG_DMA_REMAP

2022-02-28 Thread Christoph Hellwig
On Mon, Feb 28, 2022 at 10:32:54AM +, Robin Murphy wrote: > Is it even possible to hit this case now? From a quick look, all the > architectures defining HIGHMEM either have an explicit dependency on MMU or > don't allow deselecting it anyway (plus I don't see how HIGHMEM && !MMU > could

Re: [PATCH 1/1] iommu/vt-d: Fix double list_add when enabling VMD in scalable mode

2022-02-28 Thread Joerg Roedel
On Mon, Feb 21, 2022 at 01:33:48PM +0800, Lu Baolu wrote: > Fixes: 474dd1c65064 ("iommu/vt-d: Fix clearing real DMA device's > scalable-mode context entries") > Cc: sta...@vger.kernel.org # v5.14+ > Signed-off-by: Adrian Huang > Link:

Re: [PATCH 1/5] iommu/amd: Improve error handling for amd_iommu_init_pci

2022-02-28 Thread Joerg Roedel
On Mon, Feb 21, 2022 at 10:29:12AM +0530, Vasant Hegde wrote: > From: Suravee Suthikulpanit > > Add error messages to prevent silent failure. > > Signed-off-by: Suravee Suthikulpanit > Signed-off-by: Vasant Hegde > --- > drivers/iommu/amd/init.c | 12 +--- > 1 file changed, 9

Re: [PATCH] iova: Remove forward declarations

2022-02-28 Thread John Garry via iommu
On 18/02/2022 16:28, John Garry wrote: Hi guys, A friendly reminder on this one. Cheers, john Now that the FQ code has been moved to dma-iommu.c and also the rcache- related structures have been brought into iova.c, let's rearrange the code to remove all the forward declarations. The

RE: [PATCH V2] iommu/vt-d: Add RPLS to quirk list to skip TE disabling

2022-02-28 Thread Surendrakumar Upadhyay, TejaskumarX
Hi Rodrigo, Looks like "Lu Baolu" has acked patch here https://lore.kernel.org/linux-iommu/20220223062957.31797-1-tejaskumarx.surendrakumar.upadh...@intel.com/T/#u . Can you please push it in drm-intel? Thanks, Tejas > -Original Message- > From: Surendrakumar Upadhyay, TejaskumarX >

Re: [PATCH 08/11] swiotlb: make the swiotlb_init interface more useful

2022-02-28 Thread Christoph Hellwig
On Mon, Feb 28, 2022 at 02:53:39AM +, Michael Kelley (LINUX) wrote: > From: Christoph Hellwig Sent: Sunday, February 27, 2022 6:31 AM > > > > Pass a bool to pass if swiotlb needs to be enabled based on the > > addressing needs and replace the verbose argument with a set of > > flags,

Re: [PATCH] iommu/tegra-smmu: Fix missing put_device() call in tegra_smmu_find

2022-02-28 Thread Joerg Roedel
On Fri, Jan 07, 2022 at 08:09:11AM +, Miaoqian Lin wrote: > The reference taken by 'of_find_device_by_node()' must be released when > not needed anymore. > Add the corresponding 'put_device()' in the error handling path. > > Fixes: 765a9d1d02b2 ("iommu/tegra-smmu: Fix mc errors on

Re: [PATCH v4 0/9] iommu cleanup and refactoring

2022-02-28 Thread Joerg Roedel
On Wed, Feb 16, 2022 at 10:52:40AM +0800, Lu Baolu wrote: > Lu Baolu (9): > iommu/vt-d: Remove guest pasid related callbacks > iommu: Remove guest pasid related interfaces and definitions > iommu/vt-d: Remove aux-domain related callbacks > iommu: Remove aux-domain related interfaces and

Re: [PATCH v2 2/2] iommu/mediatek: Add mt8186 iommu support

2022-02-28 Thread Matthias Brugger
On 23/02/2022 08:24, Yong Wu wrote: Add mt8186 iommu supports. Signed-off-by: Anan Sun Signed-off-by: Yong Wu Reviewed-by: Matthias Brugger --- drivers/iommu/mtk_iommu.c | 17 + 1 file changed, 17 insertions(+) diff --git a/drivers/iommu/mtk_iommu.c

Re: [PATCH v2 1/2] dt-bindings: mediatek: mt8186: Add binding for MM iommu

2022-02-28 Thread Matthias Brugger
On 23/02/2022 08:24, Yong Wu wrote: Add mt8186 iommu binding. "-mm" means the iommu is for Multimedia. Signed-off-by: Yong Wu Acked-by: Krzysztof Kozlowski Reviewed-by: Rob Herring Reviewed-by: Matthias Brugger --- .../bindings/iommu/mediatek,iommu.yaml| 4 +

[PATCH v2] dma-mapping: remove CONFIG_DMA_REMAP

2022-02-28 Thread Christoph Hellwig
CONFIG_DMA_REMAP is used to build a few helpers around the core vmalloc code, and to use them in case there is a highmem page in dma-direct, and to make dma coherent allocations be able to use non-contiguous pages allocations for DMA allocations in the dma-iommu layer. Right now it needs to be

Re: [PATCH 0/5] iommu/amd: Cleanup and fixes

2022-02-28 Thread Joerg Roedel
On Mon, Feb 21, 2022 at 10:29:11AM +0530, Vasant Hegde wrote: > This series contains various cleanup and trivial fixes. > > Suravee Suthikulpanit (2): > iommu/amd: Improve error handling for amd_iommu_init_pci > iommu/amd: Improve amd_iommu_v2_exit() > > Vasant Hegde (3): > iommu/amd: Call

Re: [PATCH v7 07/11] vfio: Set DMA ownership for VFIO devices

2022-02-28 Thread Alex Williamson
On Mon, 28 Feb 2022 08:50:52 +0800 Lu Baolu wrote: > Claim group dma ownership when an IOMMU group is set to a container, > and release the dma ownership once the iommu group is unset from the > container. > > This change disallows some unsafe bridge drivers to bind to non-ACS > bridges while

Re: [PATCH v7 08/11] vfio: Remove use of vfio_group_viable()

2022-02-28 Thread Alex Williamson
On Mon, 28 Feb 2022 08:50:53 +0800 Lu Baolu wrote: > As DMA ownership is claimed for the iommu group when a VFIO group is > added to a VFIO container, the VFIO group viability is guaranteed as long > as group->container_users > 0. Remove those unnecessary group viability > checks which are only

Re: [PATCH v7 09/11] vfio: Delete the unbound_list

2022-02-28 Thread Alex Williamson
On Mon, 28 Feb 2022 08:50:54 +0800 Lu Baolu wrote: > From: Jason Gunthorpe > > commit 60720a0fc646 ("vfio: Add device tracking during unbind") added the > unbound list to plug a problem with KVM where KVM_DEV_VFIO_GROUP_DEL > relied on vfio_group_get_external_user() succeeding to return the >

Re: [PATCH v7 10/11] vfio: Remove iommu group notifier

2022-02-28 Thread Alex Williamson
On Mon, 28 Feb 2022 08:50:55 +0800 Lu Baolu wrote: > The iommu core and driver core have been enhanced to avoid unsafe driver > binding to a live group after iommu_group_set_dma_owner(PRIVATE_USER) > has been called. There's no need to register iommu group notifier. This > removes the iommu

Re: [PATCH v7 05/11] PCI: pci_stub: Set driver_managed_dma

2022-02-28 Thread Bjorn Helgaas
On Mon, Feb 28, 2022 at 08:50:50AM +0800, Lu Baolu wrote: > The current VFIO implementation allows pci-stub driver to be bound to > a PCI device with other devices in the same IOMMU group being assigned > to userspace. The pci-stub driver has no dependencies on DMA or the > IOVA mapping of the

[PATCH] kernel: dma-debug: fix return value of __setup handlers

2022-02-28 Thread Randy Dunlap
Cc: Marek Szyprowski Cc: iommu@lists.linux-foundation.org Cc: Robin Murphy --- kernel/dma/debug.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- linux-next-20220228.orig/kernel/dma/debug.c +++ linux-next-20220228/kernel/dma/debug.c @@ -927,7 +927,7 @@ static __init int dm

[PATCH v2] iommu/iova: Reset max32_alloc_size after cleaning rcache in the fail path

2022-02-28 Thread yf.wang--- via iommu
From: Yunfei Wang In alloc_iova_fast function, if __alloc_and_insert_iova_range fail, alloc_iova_fast will try flushing rcache and retry alloc iova, but this has an issue: Since __alloc_and_insert_iova_range fail will set the current alloc iova size to max32_alloc_size (iovad->max32_alloc_size

[PATCH] iommu/iova: Reset max32_alloc_size after cleaning rcache in the fail path

2022-02-28 Thread yf.wang--- via iommu
From: Yunfei Wang In alloc_iova_fast function, if __alloc_and_insert_iova_range fail, alloc_iova_fast will try flushing rcache and retry alloc iova, but this has an issue: Since __alloc_and_insert_iova_range fail will set the current alloc iova size to max32_alloc_size (iovad->max32_alloc_size

[PATCH 03/12] iommu/vt-d: Remove iova_cache_get/put()

2022-02-28 Thread Lu Baolu
These have been done in drivers/iommu/dma-iommu.c. Remove this duplicate code. Signed-off-by: Lu Baolu Reviewed-by: Christoph Hellwig Reviewed-by: Jason Gunthorpe Link: https://lore.kernel.org/r/20220214025704.3184654-1-baolu...@linux.intel.com --- drivers/iommu/intel/iommu.c | 5 - 1

[PATCH 04/12] iommu/vt-d: Remove domain and devinfo mempool

2022-02-28 Thread Lu Baolu
The domain and devinfo memory blocks are only allocated during device probe and released during remove. There's no hot-path context, hence no need for memory pools. Signed-off-by: Lu Baolu Reviewed-by: Christoph Hellwig Reviewed-by: Jason Gunthorpe Link:

[PATCH 05/12] iommu/vt-d: Remove DEFER_DEVICE_DOMAIN_INFO

2022-02-28 Thread Lu Baolu
Allocate and set the per-device iommu private data during iommu device probe. This makes the per-device iommu private data always available during iommu_probe_device() and iommu_release_device(). With this changed, the dummy DEFER_DEVICE_DOMAIN_INFO pointer could be removed. The wrappers for

[PATCH 06/12] iommu/vt-d: Remove unnecessary includes

2022-02-28 Thread Lu Baolu
Remove unnecessary include files and sort the remaining alphabetically. Signed-off-by: Lu Baolu Reviewed-by: Christoph Hellwig Reviewed-by: Jason Gunthorpe Link: https://lore.kernel.org/r/20220214025704.3184654-1-baolu...@linux.intel.com --- drivers/iommu/intel/iommu.c | 34

[PATCH 01/12] iommu/vt-d: Remove intel_iommu::domains

2022-02-28 Thread Lu Baolu
The "domains" field of the intel_iommu structure keeps the mapping of domain_id to dmar_domain. This information is not used anywhere. Remove and cleanup it to avoid unnecessary memory consumption. Signed-off-by: Lu Baolu Reviewed-by: Christoph Hellwig Reviewed-by: Jason Gunthorpe Link:

[PATCH 00/12] [PULL REQUEST] Intel IOMMU updates for Linux v5.18

2022-02-28 Thread Lu Baolu
Hi Joerg, This includes patches queued for v5.18. It includes: - [PATCH 1 ~ 11] Various cleanups, no intentional functional changes. - [PATCH 12] Enable ATS in SoC-integrated devices listed in ACPI/SATC table. Please consider them for v5.18. Best regards, Baolu Andy Shevchenko

[PATCH 02/12] iommu/vt-d: Remove finding domain in dmar_insert_one_dev_info()

2022-02-28 Thread Lu Baolu
The Intel IOMMU driver has already converted to use default domain framework in iommu core. There's no need to find a domain for the device in the domain attaching path. Cleanup that code. Signed-off-by: Lu Baolu Reviewed-by: Christoph Hellwig Reviewed-by: Jason Gunthorpe Link:

[PATCH 10/12] iommu/vt-d: Add missing "__init" for rmrr_sanity_check()

2022-02-28 Thread Lu Baolu
From: Marco Bonelli rmrr_sanity_check() calls arch_rmrr_sanity_check(), which is marked as "__init". Add the annotation for rmrr_sanity_check() too. This function is currently only called from dmar_parse_one_rmrr() which is also "__init". Signed-off-by: Marco Bonelli Link:

[PATCH 11/12] iommu/vt-d: Remove unused function intel_svm_capable()

2022-02-28 Thread Lu Baolu
From: YueHaibing This is unused since commit 4048377414162 ("iommu/vt-d: Use iommu_sva_alloc(free)_pasid() helpers"). Signed-off-by: YueHaibing Link: https://lore.kernel.org/r/20220216113851.25004-1-yuehaib...@huawei.com Signed-off-by: Lu Baolu --- drivers/iommu/intel/svm.c | 5 - 1 file

[PATCH 12/12] iommu/vt-d: Enable ATS for the devices in SATC table

2022-02-28 Thread Lu Baolu
From: Yian Chen Starting from Intel VT-d v3.2, Intel platform BIOS can provide additional SATC table structure. SATC table includes a list of SoC integrated devices that support ATC (Address translation cache). Enabling ATC (via ATS capability) can be a functional requirement for SATC device

[PATCH 07/12] iommu/vt-d: Remove unnecessary prototypes

2022-02-28 Thread Lu Baolu
Some prototypes in iommu.c are unnecessary. Delete them. Signed-off-by: Lu Baolu Reviewed-by: Christoph Hellwig Reviewed-by: Jason Gunthorpe Link: https://lore.kernel.org/r/20220214025704.3184654-1-baolu...@linux.intel.com --- drivers/iommu/intel/iommu.c | 5 - 1 file changed, 5

[PATCH 08/12] iommu/vt-d: Fix indentation of goto labels

2022-02-28 Thread Lu Baolu
Remove blanks before goto labels. Signed-off-by: Lu Baolu Reviewed-by: Christoph Hellwig Reviewed-by: Jason Gunthorpe Link: https://lore.kernel.org/r/20220214025704.3184654-1-baolu...@linux.intel.com --- drivers/iommu/intel/iommu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)

[PATCH 09/12] iommu/vt-d: Move intel_iommu_ops to header file

2022-02-28 Thread Lu Baolu
From: Andy Shevchenko Compiler is not happy about hidden declaration of intel_iommu_ops. .../iommu.c:414:24: warning: symbol 'intel_iommu_ops' was not declared. Should it be static? Move declaration to header file to make compiler happy. Signed-off-by: Andy Shevchenko Link:

Re: [PATCH v7 06/11] PCI: portdrv: Set driver_managed_dma

2022-02-28 Thread Lu Baolu
Hi Bjorn, On 3/1/22 3:56 AM, Bjorn Helgaas wrote: On Mon, Feb 28, 2022 at 08:50:51AM +0800, Lu Baolu wrote: If a switch lacks ACS P2P Request Redirect, a device below the switch can bypass the IOMMU and DMA directly to other devices below the switch, so all the downstream devices must be in

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

2022-02-28 Thread Matt Flax
Hi All, It seems that the ZONE_DMA changes have broken the operation of Rochip rk3399 chipsets from v5.10.22 onwards. It isn't clear what needs to be changed to get any of these boards up and running again. Any pointers on how/what to change ? An easy test for debugging is to run stress :

Re: [PATCH v7 06/11] PCI: portdrv: Set driver_managed_dma

2022-02-28 Thread Bjorn Helgaas
On Mon, Feb 28, 2022 at 08:50:51AM +0800, Lu Baolu wrote: > If a switch lacks ACS P2P Request Redirect, a device below the switch can > bypass the IOMMU and DMA directly to other devices below the switch, so > all the downstream devices must be in the same IOMMU group as the switch > itself. > >

Re: [PATCH] iommu/vt-d: Add RPLS to quirk list to skip TE disabling

2022-02-28 Thread Vivi, Rodrigo
On Sat, 2022-02-26 at 14:40 +0800, Lu Baolu wrote: > On 2/25/22 10:12 PM, Vivi, Rodrigo wrote: > > On Fri, 2022-02-25 at 10:20 +0800, Lu Baolu wrote: > > > On 2/24/22 9:39 PM, Vivi, Rodrigo wrote: > > > > On Thu, 2022-02-24 at 13:42 +0800, Lu Baolu wrote: > > > > > On 2/23/22 2:29 PM, Tejas

[PATCH v2] iommu/omap: Fix missing put_device() call in omap_iommu_probe_device

2022-02-28 Thread Miaoqian Lin
The reference taken by 'of_find_device_by_node()' must be released when not needed anymore. Add the corresponding 'put_device()' in the error handling path and the regular path. Fixes: ede1c2e7d4dc ("iommu/omap: Store iommu_dev pointer in arch_data") Signed-off-by: Miaoqian Lin --- changes in

Re: [PATCH v5 00/34] MT8195 IOMMU SUPPORT

2022-02-28 Thread Yong Wu via iommu
nitialise/Remove for multi bank dev > > >iommu/mediatek: Backup/restore regsiters for multi banks > > >iommu/mediatek: mt8195: Enable multi banks for infra iommu > > > > This doesn't apply cleanly, can you please send a version rebased > > to > >