[PATCH v3 01/21] iommu: Add iommu_paging_domain_alloc() interface

2024-06-10 Thread Lu Baolu
ly indicates the allocation of a paging domain for DMA managed by a kernel driver. The new interface takes a device pointer as its parameter, that better aligns with the current iommu subsystem. Signed-off-by: Lu Baolu --- include/linux/iommu.h | 6 ++ drivers/iommu/iommu.c | 20 +

[PATCH v3 03/21] vfio/type1: Use iommu_paging_domain_alloc()

2024-06-10 Thread Lu Baolu
Replace iommu_domain_alloc() with iommu_paging_domain_alloc(). Signed-off-by: Lu Baolu --- drivers/vfio/vfio_iommu_type1.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c index 3a0218171cfa

[PATCH v3 00/21] iommu: Refactoring domain allocation interface

2024-06-10 Thread Lu Baolu
driver, make the code compatible with the no-IOMMU case. - Various cleanups and refinements. v1: https://lore.kernel.org/linux-iommu/20240529053250.91284-1-baolu...@linux.intel.com/ Lu Baolu (20): iommu: Add iommu_paging_domain_alloc() interface iommufd: Use iommu_paging_domain_alloc

[PATCH v3 04/21] vhost-vdpa: Use iommu_paging_domain_alloc()

2024-06-10 Thread Lu Baolu
Replace iommu_domain_alloc() with iommu_paging_domain_alloc(). Signed-off-by: Lu Baolu --- drivers/vhost/vdpa.c | 14 ++ 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c index 63a53680a85c..e31ec9ebc4ce 100644 --- a/drivers

[PATCH v3 05/21] drm/msm: Use iommu_paging_domain_alloc()

2024-06-10 Thread Lu Baolu
The domain allocated in msm_iommu_new() is for the @dev. Replace iommu_domain_alloc() with iommu_paging_domain_alloc() to make it explicit. Signed-off-by: Lu Baolu Acked-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/msm_iommu.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff

[PATCH v3 07/21] gpu: host1x: Use iommu_paging_domain_alloc()

2024-06-10 Thread Lu Baolu
An iommu domain is allocated in host1x_iommu_attach() and is attached to host->dev. Use iommu_paging_domain_alloc() to make it explicit. Signed-off-by: Lu Baolu --- drivers/gpu/host1x/dev.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/host1x/dev.

[PATCH v3 08/21] media: nvidia: tegra: Use iommu_paging_domain_alloc()

2024-06-10 Thread Lu Baolu
An iommu domain is allocated in tegra_vde_iommu_init() and is attached to vde->dev. Use iommu_paging_domain_alloc() to make it explicit. Signed-off-by: Lu Baolu --- drivers/media/platform/nvidia/tegra-vde/iommu.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/driv

[PATCH v3 09/21] media: venus: firmware: Use iommu_paging_domain_alloc()

2024-06-10 Thread Lu Baolu
An iommu domain is allocated in venus_firmware_init() and is attached to core->fw.dev in the same function. Use iommu_paging_domain_alloc() to make it explicit. Signed-off-by: Lu Baolu --- drivers/media/platform/qcom/venus/firmware.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deleti

[PATCH v3 11/21] wifi: ath11k: Use iommu_paging_domain_alloc()

2024-06-10 Thread Lu Baolu
An iommu domain is allocated in ath11k_ahb_fw_resources_init() and is attached to ab_ahb->fw.dev in the same function. Use iommu_paging_domain_alloc() to make it explicit. Signed-off-by: Lu Baolu Acked-by: Jeff Johnson --- drivers/net/wireless/ath/ath11k/ahb.c | 6 +++--- 1 file changed

[PATCH v3 13/21] soc/fsl/qbman: Use iommu_paging_domain_alloc()

2024-06-10 Thread Lu Baolu
An iommu domain is allocated in portal_set_cpu() and is attached to pcfg->dev in the same function. Use iommu_paging_domain_alloc() to make it explicit. Signed-off-by: Lu Baolu --- drivers/soc/fsl/qbman/qman_portal.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --gi

[PATCH v3 15/21] iommu/vt-d: Add helper to allocate paging domain

2024-06-10 Thread Lu Baolu
The domain_alloc_user operation is currently implemented by allocating a paging domain using iommu_domain_alloc(). This is because it needs to fully initialize the domain before return. Add a helper to do this to avoid using iommu_domain_alloc(). Signed-off-by: Lu Baolu --- drivers/iommu/intel

[PATCH v3 16/21] ARM: dma-mapping: Pass device to arm_iommu_create_mapping()

2024-06-10 Thread Lu Baolu
Signed-off-by: Lu Baolu --- arch/arm/include/asm/dma-iommu.h | 2 +- arch/arm/mm/dma-mapping.c| 8 drivers/gpu/drm/exynos/exynos_drm_dma.c | 2 +- drivers/iommu/ipmmu-vmsa.c | 3 +-- drivers/iommu/mtk_iommu_v1.c | 3 +-- drivers/media

[PATCH v3 17/21] ARM: dma-mapping: Use iommu_paging_domain_alloc()

2024-06-10 Thread Lu Baolu
Since arm_iommu_create_mapping() now accepts the device, let's replace iommu_domain_alloc() with iommu_paging_domain_alloc() to retire the former. Signed-off-by: Lu Baolu --- arch/arm/mm/dma-mapping.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/arm/m

[PATCH v3 18/21] drm/rockchip: Use iommu_paging_domain_alloc()

2024-06-10 Thread Lu Baolu
Commit <421be3ee36a4> ("drm/rockchip: Refactor IOMMU initialisation") has refactored rockchip_drm_init_iommu() to pass a device that the domain is allocated for. Replace iommu_domain_alloc() with iommu_paging_domain_alloc() to retire the former. Signed-off-by: Lu Baolu ---

[PATCH v3 19/21] drm/tegra: Remove call to iommu_domain_alloc()

2024-06-10 Thread Lu Baolu
bsystem prevents domains allocated by one iommu driver from being attached to devices managed by any different iommu driver. Signed-off-by: Lu Baolu --- drivers/gpu/drm/tegra/drm.c | 34 +- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/d

[PATCH v3 20/21] iommu: Remove iommu_present()

2024-06-10 Thread Lu Baolu
The iommu_present() interface is no longer used in the tree anymore. Remove it to avoid dead code. Signed-off-by: Lu Baolu --- include/linux/iommu.h | 6 -- drivers/iommu/iommu.c | 25 - 2 files changed, 31 deletions(-) diff --git a/include/linux/iommu.h b/include

[PATCH v3 21/21] iommu: Remove iommu_domain_alloc()

2024-06-10 Thread Lu Baolu
The iommu_domain_alloc() interface is no longer used in the tree anymore. Remove it to avoid dead code. There is increasing demand for supporting multiple IOMMU drivers, and this is the last bus-based thing standing in the way of that. Signed-off-by: Lu Baolu --- include/linux/iommu.h | 6

[PATCH v3 12/21] remoteproc: Use iommu_paging_domain_alloc()

2024-06-10 Thread Lu Baolu
An iommu domain is allocated in rproc_enable_iommu() and is attached to rproc->dev.parent in the same function. Use iommu_paging_domain_alloc() to make it explicit. Signed-off-by: Lu Baolu --- drivers/remoteproc/remoteproc_core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deleti

[PATCH v3 06/21] drm/nouveau/tegra: Use iommu_paging_domain_alloc()

2024-06-10 Thread Lu Baolu
In nvkm_device_tegra_probe_iommu(), a paging domain is allocated for @dev and attached to it on success. Use iommu_paging_domain_alloc() to make it explicit. Signed-off-by: Lu Baolu --- drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions

[PATCH v3 02/21] iommufd: Use iommu_paging_domain_alloc()

2024-06-10 Thread Lu Baolu
If the iommu driver doesn't implement its domain_alloc_user callback, iommufd_hwpt_paging_alloc() rolls back to allocate an iommu paging domain. Replace iommu_domain_alloc() with iommu_user_domain_alloc() to pass the device pointer along the path. Signed-off-by: Lu Baolu --- drivers/

[PATCH v3 14/21] RDMA/usnic: Use iommu_paging_domain_alloc()

2024-06-10 Thread Lu Baolu
usnic_uiom_alloc_pd() allocates a paging domain for a given device. In this case, iommu_domain_alloc(dev->bus) is equivalent to  iommu_paging_domain_alloc(dev). Replace it as iommu_domain_alloc() has been deprecated. Signed-off-by: Lu Baolu Acked-by: Jason Gunthorpe --- drivers/infiniband

[PATCH v3 10/21] wifi: ath10k: Use iommu_paging_domain_alloc()

2024-06-10 Thread Lu Baolu
An iommu domain is allocated in ath10k_fw_init() and is attached to ar_snoc->fw.dev in the same function. Use iommu_paging_domain_alloc() to make it explicit. Signed-off-by: Lu Baolu Acked-by: Jeff Johnson --- drivers/net/wireless/ath/ath10k/snoc.c | 6 +++--- 1 file changed, 3 inserti

[PATCH v4 0/4] iommu: Refactoring domain allocation interface

2024-10-08 Thread Lu Baolu
rious cleanups and refinements. v1: https://lore.kernel.org/linux-iommu/20240529053250.91284-1-baolu...@linux.intel.com/ Lu Baolu (4): remoteproc: Use iommu_paging_domain_alloc() media: nvidia: tegra: Use iommu_paging_domain_alloc() drm/nouveau/tegra: Use iommu_paging_domain_alloc() iommu: R

[PATCH v4 4/4] iommu: Remove iommu_domain_alloc()

2024-10-08 Thread Lu Baolu
The iommu_domain_alloc() interface is no longer used in the tree anymore. Remove it to avoid dead code. There is increasing demand for supporting multiple IOMMU drivers, and this is the last bus-based thing standing in the way of that. Signed-off-by: Lu Baolu Reviewed-by: Jason Gunthorpe

[PATCH v4 3/4] drm/nouveau/tegra: Use iommu_paging_domain_alloc()

2024-10-08 Thread Lu Baolu
In nvkm_device_tegra_probe_iommu(), a paging domain is allocated for @dev and attached to it on success. Use iommu_paging_domain_alloc() to make it explicit. Signed-off-by: Lu Baolu Acked-by: Thierry Reding Reviewed-by: Lyude Paul --- drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c | 4

[PATCH v4 2/4] media: nvidia: tegra: Use iommu_paging_domain_alloc()

2024-10-08 Thread Lu Baolu
An iommu domain is allocated in tegra_vde_iommu_init() and is attached to vde->dev. Use iommu_paging_domain_alloc() to make it explicit. Signed-off-by: Lu Baolu Reviewed-by: Jason Gunthorpe Acked-by: Thierry Reding --- drivers/media/platform/nvidia/tegra-vde/iommu.c | 7 --- 1 f

[PATCH v4 1/4] remoteproc: Use iommu_paging_domain_alloc()

2024-10-08 Thread Lu Baolu
An iommu domain is allocated in rproc_enable_iommu() and is attached to rproc->dev.parent in the same function. Use iommu_paging_domain_alloc() to make it explicit. Signed-off-by: Lu Baolu Reviewed-by: Jason Gunthorpe Reviewed-by: Mathieu Poirier Acked-by: Beleswar Padhi --- driv