From: Joerg Roedel <redacted>
Hi,
here is a patch-set to remove the usage of dev->archdata.iommu from
the IOMMU code in the kernel and replace its uses by the iommu per-device
private data field. The changes also remove the field entirely from
the architectures which no longer need it.
On PowerPC the field is called dev->archdata.iommu_domain and was only
used by the PAMU IOMMU driver. It gets removed as well.
The patches have been runtime tested on Intel VT-d and compile tested
with allyesconfig for:
* x86 (32 and 64 bit)
* arm and arm64
* ia64 (only drivers/ because build failed for me in
arch/ia64)
* PPC64
Besides that the changes also survived my IOMMU tree compile tests.
Please review.
Regards,
Joerg
Joerg Roedel (13):
iommu/exynos: Use dev_iommu_priv_get/set()
iommu/vt-d: Use dev_iommu_priv_get/set()
iommu/msm: Use dev_iommu_priv_get/set()
iommu/omap: Use dev_iommu_priv_get/set()
iommu/rockchip: Use dev_iommu_priv_get/set()
iommu/tegra: Use dev_iommu_priv_get/set()
iommu/pamu: Use dev_iommu_priv_get/set()
iommu/mediatek: Do no use dev->archdata.iommu
x86: Remove dev->archdata.iommu pointer
ia64: Remove dev->archdata.iommu pointer
arm: Remove dev->archdata.iommu pointer
arm64: Remove dev->archdata.iommu pointer
powerpc/dma: Remove dev->archdata.iommu_domain
arch/arm/include/asm/device.h | 3 ---
arch/arm64/include/asm/device.h | 3 ---
arch/ia64/include/asm/device.h | 3 ---
arch/powerpc/include/asm/device.h | 3 ---
arch/x86/include/asm/device.h | 3 ---
.../gpu/drm/i915/selftests/mock_gem_device.c | 10 ++++++++--
drivers/iommu/exynos-iommu.c | 20 +++++++++----------
drivers/iommu/fsl_pamu_domain.c | 8 ++++----
drivers/iommu/intel/iommu.c | 18 ++++++++---------
drivers/iommu/msm_iommu.c | 4 ++--
drivers/iommu/mtk_iommu.h | 2 ++
drivers/iommu/mtk_iommu_v1.c | 10 ++++------
drivers/iommu/omap-iommu.c | 20 +++++++++----------
drivers/iommu/rockchip-iommu.c | 8 ++++----
drivers/iommu/tegra-gart.c | 8 ++++----
drivers/iommu/tegra-smmu.c | 8 ++++----
.../media/platform/s5p-mfc/s5p_mfc_iommu.h | 4 +++-
17 files changed, 64 insertions(+), 71 deletions(-)
--
2.27.0
From: Joerg Roedel <redacted>
There are no users left, all drivers have been converted to use the
per-device private pointer offered by IOMMU core.
Signed-off-by: Joerg Roedel <redacted>
---
arch/arm/include/asm/device.h | 3 ---
1 file changed, 3 deletions(-)
From: Joerg Roedel <redacted>
There are no users left, so remove the pointer and save some memory.
Signed-off-by: Joerg Roedel <redacted>
---
arch/powerpc/include/asm/device.h | 3 ---
1 file changed, 3 deletions(-)
From: Joerg Roedel <redacted>
There are no users left, all drivers have been converted to use the
per-device private pointer offered by IOMMU core.
Signed-off-by: Joerg Roedel <redacted>
---
arch/arm64/include/asm/device.h | 3 ---
1 file changed, 3 deletions(-)
From: Joerg Roedel <redacted>
There are no users left, all drivers have been converted to use the
per-device private pointer offered by IOMMU core.
Signed-off-by: Joerg Roedel <redacted>
---
arch/x86/include/asm/device.h | 3 ---
1 file changed, 3 deletions(-)
From: Joerg Roedel <redacted>
There are no users left, all drivers have been converted to use the
per-device private pointer offered by IOMMU core.
Signed-off-by: Joerg Roedel <redacted>
---
arch/ia64/include/asm/device.h | 3 ---
1 file changed, 3 deletions(-)
From: Joerg Roedel <redacted>
The iommu private pointer is already used in the Mediatek IOMMU v1
driver, so move the dma_iommu_mapping pointer into 'struct
mtk_iommu_data' and do not use dev->archdata.iommu anymore.
Signed-off-by: Joerg Roedel <redacted>
---
drivers/iommu/mtk_iommu.h | 2 ++
drivers/iommu/mtk_iommu_v1.c | 10 ++++------
2 files changed, 6 insertions(+), 6 deletions(-)
@@ -269,7 +269,7 @@ static int mtk_iommu_attach_device(struct iommu_domain *domain,intret;/* Only allow the domain created internally. */-mtk_mapping=data->dev->archdata.iommu;+mtk_mapping=data->mapping;if(mtk_mapping->domain!=domain)return0;
@@ -369,7 +369,6 @@ static int mtk_iommu_create_mapping(struct device *dev,structmtk_iommu_data*data;structplatform_device*m4updev;structdma_iommu_mapping*mtk_mapping;-structdevice*m4udev;intret;if(args->args_count!=1){
@@ -401,8 +400,7 @@ static int mtk_iommu_create_mapping(struct device *dev,returnret;data=dev_iommu_priv_get(dev);-m4udev=data->dev;-mtk_mapping=m4udev->archdata.iommu;+mtk_mapping=data->mapping;if(!mtk_mapping){/* MTK iommu support 4GB iova address space. */mtk_mapping=arm_iommu_create_mapping(&platform_bus_type,
@@ -410,7 +408,7 @@ static int mtk_iommu_create_mapping(struct device *dev,if(IS_ERR(mtk_mapping))returnPTR_ERR(mtk_mapping);-m4udev->archdata.iommu=mtk_mapping;+data->mapping=mtk_mapping;}return0;
@@ -136,8 +140,10 @@ struct drm_i915_private *mock_gem_device(void)dma_coerce_mask_and_coherent(&pdev->dev,DMA_BIT_MASK(64));#if IS_ENABLED(CONFIG_IOMMU_API) && defined(CONFIG_INTEL_IOMMU)-/* hack to disable iommu for the fake device; force identity mapping */-pdev->dev.archdata.iommu=(void*)-1;+/* HACK HACK HACK to disable iommu for the fake device; force identity mapping */+memset(&iommu,0,sizeof(iommu));+iommu.priv=(void*)-1;+pdev->dev.iommu=&iommu;#endifpci_set_drvdata(pdev,i915);
From: Will Deacon <will@kernel.org> Date: 2020-06-25 13:16:31
On Thu, Jun 25, 2020 at 03:08:35PM +0200, Joerg Roedel wrote:
quoted hunk
From: Joerg Roedel <redacted>
There are no users left, all drivers have been converted to use the
per-device private pointer offered by IOMMU core.
Signed-off-by: Joerg Roedel <redacted>
---
arch/arm64/include/asm/device.h | 3 ---
1 file changed, 3 deletions(-)
From: Lu Baolu <baolu.lu@linux.intel.com> Date: 2020-06-25 13:24:13
Hi Joerg,
On 2020/6/25 21:08, Joerg Roedel wrote:
From: Joerg Roedel <redacted>
Remove the use of dev->archdata.iommu and use the private per-device
pointer provided by IOMMU core code instead.
Signed-off-by: Joerg Roedel <redacted>
---
.../gpu/drm/i915/selftests/mock_gem_device.c | 10 ++++++++--
drivers/iommu/intel/iommu.c | 18 +++++++++---------
For changes in VT-d driver,
Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com>
Best regards,
baolu
@@ -136,8 +140,10 @@ struct drm_i915_private *mock_gem_device(void)dma_coerce_mask_and_coherent(&pdev->dev,DMA_BIT_MASK(64));#if IS_ENABLED(CONFIG_IOMMU_API) && defined(CONFIG_INTEL_IOMMU)-/* hack to disable iommu for the fake device; force identity mapping */-pdev->dev.archdata.iommu=(void*)-1;+/* HACK HACK HACK to disable iommu for the fake device; force identity mapping */+memset(&iommu,0,sizeof(iommu));+iommu.priv=(void*)-1;+pdev->dev.iommu=&iommu;#endifpci_set_drvdata(pdev,i915);
From: Jerry Snitselaar <hidden> Date: 2020-06-26 01:41:37
On Thu Jun 25 20, Joerg Roedel wrote:
From: Joerg Roedel <redacted>
Hi,
here is a patch-set to remove the usage of dev->archdata.iommu from
the IOMMU code in the kernel and replace its uses by the iommu per-device
private data field. The changes also remove the field entirely from
the architectures which no longer need it.
On PowerPC the field is called dev->archdata.iommu_domain and was only
used by the PAMU IOMMU driver. It gets removed as well.
The patches have been runtime tested on Intel VT-d and compile tested
with allyesconfig for:
* x86 (32 and 64 bit)
* arm and arm64
* ia64 (only drivers/ because build failed for me in
arch/ia64)
* PPC64
Besides that the changes also survived my IOMMU tree compile tests.
Please review.
Regards,
Joerg
Joerg Roedel (13):
iommu/exynos: Use dev_iommu_priv_get/set()
iommu/vt-d: Use dev_iommu_priv_get/set()
iommu/msm: Use dev_iommu_priv_get/set()
iommu/omap: Use dev_iommu_priv_get/set()
iommu/rockchip: Use dev_iommu_priv_get/set()
iommu/tegra: Use dev_iommu_priv_get/set()
iommu/pamu: Use dev_iommu_priv_get/set()
iommu/mediatek: Do no use dev->archdata.iommu
x86: Remove dev->archdata.iommu pointer
ia64: Remove dev->archdata.iommu pointer
arm: Remove dev->archdata.iommu pointer
arm64: Remove dev->archdata.iommu pointer
powerpc/dma: Remove dev->archdata.iommu_domain
arch/arm/include/asm/device.h | 3 ---
arch/arm64/include/asm/device.h | 3 ---
arch/ia64/include/asm/device.h | 3 ---
arch/powerpc/include/asm/device.h | 3 ---
arch/x86/include/asm/device.h | 3 ---
.../gpu/drm/i915/selftests/mock_gem_device.c | 10 ++++++++--
drivers/iommu/exynos-iommu.c | 20 +++++++++----------
drivers/iommu/fsl_pamu_domain.c | 8 ++++----
drivers/iommu/intel/iommu.c | 18 ++++++++---------
drivers/iommu/msm_iommu.c | 4 ++--
drivers/iommu/mtk_iommu.h | 2 ++
drivers/iommu/mtk_iommu_v1.c | 10 ++++------
drivers/iommu/omap-iommu.c | 20 +++++++++----------
drivers/iommu/rockchip-iommu.c | 8 ++++----
drivers/iommu/tegra-gart.c | 8 ++++----
drivers/iommu/tegra-smmu.c | 8 ++++----
.../media/platform/s5p-mfc/s5p_mfc_iommu.h | 4 +++-
17 files changed, 64 insertions(+), 71 deletions(-)
--
2.27.0
On Thu, Jun 25, 2020 at 03:08:32PM +0200, Joerg Roedel wrote:
quoted hunk
From: Joerg Roedel <redacted>
There are no users left, all drivers have been converted to use the
per-device private pointer offered by IOMMU core.
Signed-off-by: Joerg Roedel <redacted>
---
arch/x86/include/asm/device.h | 3 ---
1 file changed, 3 deletions(-)
From: Marek Szyprowski <m.szyprowski@samsung.com> Date: 2020-06-29 19:38:22
On 25.06.2020 15:08, Joerg Roedel wrote:
From: Joerg Roedel <redacted>
Remove the use of dev->archdata.iommu and use the private per-device
pointer provided by IOMMU core code instead.
Signed-off-by: Joerg Roedel <redacted>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
From: Michael Ellerman <mpe@ellerman.id.au> Date: 2020-06-29 20:49:39
Joerg Roedel [off-list ref] writes:
From: Joerg Roedel <redacted>
There are no users left, so remove the pointer and save some memory.
Signed-off-by: Joerg Roedel <redacted>
---
arch/powerpc/include/asm/device.h | 3 ---
1 file changed, 3 deletions(-)
It's a little hard to confirm there are no users left just with grep,
but I think you've got them all, and the compiler should tell us if
you've missed any.
Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)
cheers
On Thu, Jun 25, 2020 at 03:08:23PM +0200, Joerg Roedel wrote:
Joerg Roedel (13):
iommu/exynos: Use dev_iommu_priv_get/set()
iommu/vt-d: Use dev_iommu_priv_get/set()
iommu/msm: Use dev_iommu_priv_get/set()
iommu/omap: Use dev_iommu_priv_get/set()
iommu/rockchip: Use dev_iommu_priv_get/set()
iommu/tegra: Use dev_iommu_priv_get/set()
iommu/pamu: Use dev_iommu_priv_get/set()
iommu/mediatek: Do no use dev->archdata.iommu
x86: Remove dev->archdata.iommu pointer
ia64: Remove dev->archdata.iommu pointer
arm: Remove dev->archdata.iommu pointer
arm64: Remove dev->archdata.iommu pointer
powerpc/dma: Remove dev->archdata.iommu_domain