[PATCH v2 2/3] drm/rockchip: Use iommu_paging_domain_alloc()

2024-09-01 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 Re

[PATCH v2 3/3] drm/tegra: Use iommu_paging_domain_alloc()

2024-09-01 Thread Lu Baolu
kes the physical device from which the host1x_device virtual device was instantiated. This physical device is a common parent to all physical devices that are part of the virtual device. Suggested-by: Thierry Reding Signed-off-by: Lu Baolu --- drivers/gpu/drm/tegra/drm.c | 5 +++-- 1 file chang

[PATCH v2 1/3] drm/nouveau/tegra: Use iommu_paging_domain_alloc()

2024-09-01 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 v2 0/3] drm: Use iommu_paging_domain_alloc()

2024-09-01 Thread Lu Baolu
e.kernel.org/linux-iommu/qyvyd2ftebjlgmzyayfvxsqa64c4wgx7keix3a6eexdspbvawy@a5ffnm5h5tgp/ v1: - https://lore.kernel.org/linux-iommu/20240812071034.9443-1-baolu...@linux.intel.com/ Lu Baolu (3): drm/nouveau/tegra: Use iommu_paging_domain_alloc() drm/rockchip: Use iommu_paging_domain_alloc() drm/tegra: Use iommu_paging_domain_alloc()

[PATCH 1/1] gpu: host1x: Use iommu_paging_domain_alloc()

2024-08-12 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 Reviewed-by: Jason Gunthorpe Link: https://lore.kernel.org/r/2024061008.88197-8-baolu...@linux.intel.com --- drivers/gpu/hos

[PATCH 3/3] drm/tegra: Remove call to iommu_domain_alloc()

2024-08-12 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 Link: https://lore.kernel.org/r/2024061008.88197-20-baolu...@linux.intel.com --- drivers/gpu/drm/tegra/drm.c | 34 +-

[PATCH 2/3] drm/rockchip: Use iommu_paging_domain_alloc()

2024-08-12 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 Re

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

2024-08-12 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 Link: https://lore.kernel.org/r/2024061008.88197-7-baolu...@linux.intel.com --- drivers/gpu/drm/nouveau/nvkm

[PATCH 2/2] ARM: dma-mapping: Use iommu_paging_domain_alloc()

2024-08-12 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 Reviewed-by: Jason Gunthorpe Link: https://lore.kernel.org/r/2024061008.88197-18-baolu...@linux.intel.com --- arc

[PATCH 1/2] ARM: dma-mapping: Pass device to arm_iommu_create_mapping()

2024-08-12 Thread Lu Baolu
Signed-off-by: Lu Baolu Link: https://lore.kernel.org/r/2024061008.88197-17-baolu...@linux.intel.com --- 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

[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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 v2 22/22] iommu: Remove iommu_domain_alloc()

2024-06-03 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 v2 21/22] iommu: Remove iommu_present()

2024-06-03 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 v2 20/22] drm/tegra: Remove call to iommu_domain_alloc()

2024-06-03 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 v2 19/22] drm/rockchip: Use iommu_paging_domain_alloc()

2024-06-03 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 v2 17/22] ARM: dma-mapping: Pass device to arm_iommu_create_mapping()

2024-06-03 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 v2 18/22] ARM: dma-mapping: Use iommu_paging_domain_alloc()

2024-06-03 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 v2 15/22] RDMA/usnic: Use iommu_paging_domain_alloc()

2024-06-03 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 --- drivers/infiniband/hw/usnic/usnic_uiom.c

[PATCH v2 16/22] iommu/vt-d: Add helper to allocate paging domain

2024-06-03 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 v2 14/22] soc/fsl/qbman: Use iommu_paging_domain_alloc()

2024-06-03 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 v2 13/22] remoteproc: Use iommu_paging_domain_alloc()

2024-06-03 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 v2 12/22] wifi: ath11k: Use iommu_paging_domain_alloc()

2024-06-03 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 --- drivers/net/wireless/ath/ath11k/ahb.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deleti

[PATCH v2 11/22] ath10k: Use iommu_paging_domain_alloc()

2024-06-03 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 --- drivers/net/wireless/ath/ath10k/snoc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) d

[PATCH v2 10/22] media: venus: firmware: Use iommu_paging_domain_alloc()

2024-06-03 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 v2 09/22] media: nvidia: tegra: Use iommu_paging_domain_alloc()

2024-06-03 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 v2 07/22] drm/nouveau/tegra: Use iommu_paging_domain_alloc()

2024-06-03 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 v2 08/22] gpu: host1x: Use iommu_paging_domain_alloc()

2024-06-03 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 v2 06/22] drm/msm: Use iommu_paging_domain_alloc()

2024-06-03 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 --- drivers/gpu/drm/msm/msm_iommu.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/msm

[PATCH v2 05/22] iommu: Add iommu_paging_domain_alloc() interface

2024-06-03 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 v2 04/22] vhost-vdpa: Use iommu_user_domain_alloc()

2024-06-03 Thread Lu Baolu
Replace iommu_domain_alloc() with iommu_user_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..d15673cb05f2 100644 --- a/drivers

[PATCH v2 03/22] vfio/type1: Use iommu_user_domain_alloc()

2024-06-03 Thread Lu Baolu
Replace iommu_domain_alloc() with iommu_user_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..1d553f7f7c26

[PATCH v2 02/22] iommufd: Use iommu_user_domain_alloc()

2024-06-03 Thread Lu Baolu
Replace iommu_domain_alloc() with iommu_user_domain_alloc(). Signed-off-by: Lu Baolu --- drivers/iommu/iommufd/hw_pagetable.c | 20 +--- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/drivers/iommu/iommufd/hw_pagetable.c b/drivers/iommu/iommufd/hw_pagetable.c

[PATCH v2 01/22] iommu: Add iommu_user_domain_alloc() interface

2024-06-03 Thread Lu Baolu
lement their own domain_alloc_user ops, most drivers haven't implemented it yet. Rollback to the paging domain allocation interface if the iommu driver hasn't implemented this op yet. Signed-off-by: Lu Baolu --- include/linux/iommu.h | 6 ++ drivers/iommu/iommu.c | 42 +++

[PATCH v2 00/22] iommu: Refactoring domain allocation interface

2024-06-03 Thread Lu Baolu
ver, 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 (21): iommu: Add iommu_user_domain_alloc() interface iommufd: Use iommu_user_domain_alloc() vfio/ty

[PATCH 19/20] iommu/vt-d: Remove domain_update_iommu_cap()

2024-05-28 Thread Lu Baolu
The attributes of a paging domain are initialized during the allocation process, and any attempt to attach a domain that is not compatible will result in a failure. Therefore, there is no need to update the domain attributes at the time of domain attachment. Signed-off-by: Lu Baolu --- drivers

[PATCH 10/20] media: venus: firmware: Use iommu_paging_domain_alloc()

2024-05-28 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 20/20] iommu/vt-d: Remove domain_update_iommu_superpage()

2024-05-28 Thread Lu Baolu
permissible for the super page capability to vary among different IOMMU hardware units. Signed-off-by: Lu Baolu --- drivers/iommu/intel/iommu.c | 39 + 1 file changed, 1 insertion(+), 38 deletions(-) diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel

[PATCH 16/20] iommu/vt-d: Add domain_alloc_paging support

2024-05-28 Thread Lu Baolu
Move paging domain allocation code out from intel_iommu_domain_alloc(). The intel_iommu_domain_alloc() is still remaining to allocate an identity domain. However, it will soon disappear as we are about to convert the identity domain to a global static one. Signed-off-by: Lu Baolu --- drivers

[PATCH 13/20] remoteproc: Use iommu_paging_domain_alloc()

2024-05-28 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 18/20] iommu/vt-d: Enhance compatibility check for paging domain attach

2024-05-28 Thread Lu Baolu
to a device and found to be incompatible with the IOMMU hardware capabilities, the operation will return an -EINVAL error. This implicitly advises the caller to allocate a new domain for the device and attempt the domain attachment again. Signed-off-by: Lu Baolu --- drivers/iommu/intel/iommu.c

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

2024-05-28 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 17/20] iommu/vt-d: Simplify compatibility check for identity domain

2024-05-28 Thread Lu Baolu
-off-by: Lu Baolu --- drivers/iommu/intel/iommu.c | 18 ++ 1 file changed, 18 insertions(+) diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c index eb8e08699b80..693a6d7c79ed 100644 --- a/drivers/iommu/intel/iommu.c +++ b/drivers/iommu/intel/iommu.c @@ -2190,6

[PATCH 06/20] drm/msm: Use iommu_paging_domain_alloc()

2024-05-28 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. Update msm_iommu_new() to always return ERR_PTR in failure cases instead of NULL. Signed-off-by: Lu Baolu --- drivers/gpu/drm/msm/msm_iommu.c | 8

[PATCH 04/20] vhost-vdpa: Use iommu_user_domain_alloc()

2024-05-28 Thread Lu Baolu
Replace iommu_domain_alloc() with iommu_user_domain_alloc(). Signed-off-by: Lu Baolu --- drivers/vhost/vdpa.c | 11 +++ 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c index 63a53680a85c..7784218fd9d2 100644 --- a/drivers/vhost

[PATCH 11/20] ath10k: Use iommu_paging_domain_alloc()

2024-05-28 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 --- drivers/net/wireless/ath/ath10k/snoc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) d

[PATCH 14/20] soc/fsl/qbman: Use iommu_paging_domain_alloc()

2024-05-28 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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --gi

[PATCH 09/20] media: nvidia: tegra: Use iommu_paging_domain_alloc()

2024-05-28 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 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/driv

[PATCH 00/20] iommu: Refactoring domain allocation interface

2024-05-28 Thread Lu Baolu
ts/iommu-domain-allocation-refactor-v1 Lu Baolu (20): iommu: Add iommu_user_domain_alloc() interface iommufd: Use iommu_user_domain_alloc() vfio/type1: Use iommu_paging_domain_alloc() vhost-vdpa: Use iommu_user_domain_alloc() iommu: Add iommu_paging_domain_alloc() interface drm/msm:

[PATCH 08/20] gpu: host1x: Use iommu_paging_domain_alloc()

2024-05-28 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 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/host1x/dev.

[PATCH 12/20] wifi: ath11k: Use iommu_paging_domain_alloc()

2024-05-28 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 --- drivers/net/wireless/ath/ath11k/ahb.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deleti

[PATCH 07/20] drm/nouveau/tegra: Use iommu_paging_domain_alloc()

2024-05-28 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 05/20] iommu: Add iommu_paging_domain_alloc() interface

2024-05-28 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 03/20] vfio/type1: Use iommu_paging_domain_alloc()

2024-05-28 Thread Lu Baolu
Replace iommu_domain_alloc() with iommu_user_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..1d553f7f7c26

[PATCH 01/20] iommu: Add iommu_user_domain_alloc() interface

2024-05-28 Thread Lu Baolu
lement their own domain_alloc_user ops, most drivers haven't implemented it yet. Rollback to the paging domain allocation interface if the iommu driver hasn't implemented this op yet. Signed-off-by: Lu Baolu --- include/linux/iommu.h | 6 ++ drivers/iommu/iommu.c | 42 +++

[PATCH 02/20] iommufd: Use iommu_user_domain_alloc()

2024-05-28 Thread Lu Baolu
Replace iommu_domain_alloc() with iommu_user_domain_alloc(). Signed-off-by: Lu Baolu --- drivers/iommu/iommufd/hw_pagetable.c | 20 +--- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/drivers/iommu/iommufd/hw_pagetable.c b/drivers/iommu/iommufd/hw_pagetable.c

Re: [PATCH] iommu/vt-d: Remove comment reference to iommu_dev_has_feature

2022-02-04 Thread Lu Baolu
On 2/2/22 10:37 AM, Akeem G Abodunrin wrote: iommu_dev_has_feature() api has been removed by the commit 262948f8ba573 ("iommu: Delete iommu_dev_has_feature()") - So this patch removes comment about the api to avoid any confusion. Signed-off-by: Akeem G Abodunrin Cc: Lu Baolu

[PATCH 1/1] drm/nouveau/device: Get right pgsize_bitmap of iommu_domain

2021-12-17 Thread Lu Baolu
The suported page sizes of an iommu_domain are saved in the pgsize_bitmap field. Retrieve the value from the right place. Fixes: 58fd9375c2c534 ("drm/nouveau/platform: probe IOMMU if present") Signed-off-by: Lu Baolu --- drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c | 2 +- 1 fi

Re: [PATCH] drm/i915: Use per device iommu check

2021-11-26 Thread Lu Baolu
ange in the future. With device_iommu_mapped() replaced, Reviewed-by: Lu Baolu Best regards, baolu

Re: [PATCH] drm/i915: Use per device iommu check

2021-11-11 Thread Lu Baolu
On 11/11/21 11:18 PM, Tvrtko Ursulin wrote: On 10/11/2021 14:37, Robin Murphy wrote: On 2021-11-10 14:11, Tvrtko Ursulin wrote: On 10/11/2021 12:35, Lu Baolu wrote: On 2021/11/10 20:08, Tvrtko Ursulin wrote: On 10/11/2021 12:04, Lu Baolu wrote: On 2021/11/10 17:30, Tvrtko Ursulin wrote

Re: [PATCH] drm/i915: Use per device iommu check

2021-11-11 Thread Lu Baolu
On 11/11/21 11:06 PM, Tvrtko Ursulin wrote: On 10/11/2021 12:35, Lu Baolu wrote: On 2021/11/10 20:08, Tvrtko Ursulin wrote: On 10/11/2021 12:04, Lu Baolu wrote: On 2021/11/10 17:30, Tvrtko Ursulin wrote: On 10/11/2021 07:12, Lu Baolu wrote: Hi Tvrtko, On 2021/11/9 20:17, Tvrtko Ursulin

Re: [PATCH] drm/i915: Use per device iommu check

2021-11-10 Thread Lu Baolu
On 2021/11/10 20:08, Tvrtko Ursulin wrote: On 10/11/2021 12:04, Lu Baolu wrote: On 2021/11/10 17:30, Tvrtko Ursulin wrote: On 10/11/2021 07:12, Lu Baolu wrote: Hi Tvrtko, On 2021/11/9 20:17, Tvrtko Ursulin wrote: From: Tvrtko Ursulin On igfx + dgfx setups, it appears that intel_iommu

Re: [Intel-gfx] [PATCH] drm/i915: Use per device iommu check

2021-11-10 Thread Lu Baolu
On 2021/11/10 17:35, Tvrtko Ursulin wrote: On 10/11/2021 07:25, Lu Baolu wrote: On 2021/11/10 1:35, Tvrtko Ursulin wrote: On 09/11/2021 17:19, Lucas De Marchi wrote: On Tue, Nov 09, 2021 at 12:17:59PM +, Tvrtko Ursulin wrote: From: Tvrtko Ursulin On igfx + dgfx setups, it appears

Re: [PATCH] drm/i915: Use per device iommu check

2021-11-10 Thread Lu Baolu
On 2021/11/10 17:30, Tvrtko Ursulin wrote: On 10/11/2021 07:12, Lu Baolu wrote: Hi Tvrtko, On 2021/11/9 20:17, Tvrtko Ursulin wrote: From: Tvrtko Ursulin On igfx + dgfx setups, it appears that intel_iommu=igfx_off option only disables the igfx iommu. Stop relying on global

Re: [PATCH] drm/i915: Use per device iommu check

2021-11-10 Thread Lu Baolu
status. Signed-off-by: Tvrtko Ursulin Cc: Lu Baolu --- Baolu, is my understanding here correct? Maybe I am confused by both intel_iommu_gfx_mapped and dmar_map_gfx being globals in the intel_iommu driver. But it certainly appears the setup can assign some iommu ops (and assign the discrete i915 to iommu

Re: [Intel-gfx] [PATCH] drm/i915: Use per device iommu check

2021-11-10 Thread Lu Baolu
On 2021/11/10 1:35, Tvrtko Ursulin wrote: On 09/11/2021 17:19, Lucas De Marchi wrote: On Tue, Nov 09, 2021 at 12:17:59PM +, Tvrtko Ursulin wrote: From: Tvrtko Ursulin On igfx + dgfx setups, it appears that intel_iommu=igfx_off option only disables the igfx iommu. Stop relying on global i

Re: [PATCH v1] iommu/vt-d: Move intel_iommu_gfx_mapped to Intel IOMMU header

2020-09-01 Thread Lu Baolu
tel_iommu *iommu) { Looks good to me. Reviewed-by: Lu Baolu Best regards, baolu ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH 3/8] iommu/vt-d: Remove IOVA handling code from non-dma_ops path

2020-03-20 Thread Lu Baolu
On 2020/3/20 14:30, Tom Murphy wrote: Could we merge patch 1-3 from this series? it just cleans up weird code and merging these patches will cover some of the work needed to move the intel iommu driver to the dma-iommu api in the future. Can you please take a look at this patch series? https:/

Re: [PATCH 1/8] iommu/vt-d: clean up 32bit si_domain assignment

2019-12-23 Thread Lu Baolu
Hi, On 12/21/19 11:03 PM, Tom Murphy wrote: @@ -5618,9 +5583,13 @@ static int intel_iommu_add_device(struct device *dev) struct iommu_domain *domain; struct intel_iommu *iommu; struct iommu_group *group; + u64 dma_mask = *dev->dma_mask; u8 bus, devfn;