patches.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/7] Remove ops.pgsize_bitmap
@ 2025-04-29 14:34 Jason Gunthorpe
  2025-04-29 14:34 ` [PATCH 1/7] iommu/arm-smmu-v3: Remove iommu_ops pgsize_bitmap Jason Gunthorpe
                   ` (8 more replies)
  0 siblings, 9 replies; 16+ messages in thread
From: Jason Gunthorpe @ 2025-04-29 14:34 UTC (permalink / raw)
  To: Alexandre Ghiti, Alim Akhtar, Alyssa Rosenzweig,
	AngeloGioacchino Del Regno, Albert Ou, asahi, Baolin Wang,
	Lu Baolu, David Woodhouse, Gerald Schaefer, Heiko Stuebner, iommu,
	Janne Grunau, Jean-Philippe Brucker, Jernej Skrabec,
	Jonathan Hunter, Joerg Roedel, Kevin Tian, Krzysztof Kozlowski,
	linux-arm-kernel, linux-arm-msm, linux-mediatek, linux-riscv,
	linux-rockchip, linux-s390, linux-samsung-soc, linux-sunxi,
	linux-tegra, Marek Szyprowski, Matthias Brugger, Matthew Rosato,
	Neal Gompa, Orson Zhai, Palmer Dabbelt, Paul Walmsley, Rob Clark,
	Robin Murphy, Samuel Holland, Niklas Schnelle, Sven Peter,
	Thierry Reding, Tomasz Jeznach, Krishna Reddy, virtualization,
	Chen-Yu Tsai, Will Deacon, Yong Wu, Chunyan Zhang
  Cc: patches

Now that all drivers are using domain_alloc_paging() and dev is never
NULL, we can have all drivers correctly set domain.pgsize_bitmap during
their allocation function.

There are a few oddities that have accumulated here over past changes:

 - Some drivers always set domain.pgsize_bitmap during their
   domain_alloc_paging() call but still provide a value in ops. This is dead
   code, delete it.

 - Some drivers calculate a system global pgsize_bitmap in the ops, but
   it is now trivial to use the per-instance value instead. In several
   cases this is dead code, delete it. This also allows
   constifying the ops in these drivers as a hardening measure

 - Some drivers have a fixed pgsize_bitmap, put it next to setting up the
   geometry in their domain_alloc_paging() functions.

 - Finally a few drivers still use ops because they have a delayed
   finalize operation. Set the constant pgsize_bitmap in the
   domain_alloc_paging().

Then remove ops.pgsize_bitmap.

This is based on iommu next, and must go after the virtio
domain_alloc_paging() conversion.

Jason Gunthorpe (7):
  iommu/arm-smmu-v3: Remove iommu_ops pgsize_bitmap
  iommu/arm-smmu: Remove iommu_ops pgsize_bitmap
  iommu: Remove ops.pgsize_bitmap from drivers that don't use it
  iommu: Remove iommu_ops pgsize_bitmap from simple drivers
  iommu/mtk: Remove iommu_ops pgsize_bitmap
  iommu/qcom: Remove iommu_ops pgsize_bitmap
  iommu: Remove ops->pgsize_bitmap

 drivers/iommu/apple-dart.c                  |  1 -
 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 10 ++--------
 drivers/iommu/arm/arm-smmu/arm-smmu.c       | 12 +++++-------
 drivers/iommu/arm/arm-smmu/qcom_iommu.c     |  6 ++----
 drivers/iommu/exynos-iommu.c                |  3 ++-
 drivers/iommu/intel/iommu.c                 |  1 -
 drivers/iommu/iommu.c                       |  7 -------
 drivers/iommu/iommufd/selftest.c            |  1 -
 drivers/iommu/ipmmu-vmsa.c                  |  4 ++--
 drivers/iommu/mtk_iommu.c                   |  9 +++------
 drivers/iommu/mtk_iommu_v1.c                |  3 ++-
 drivers/iommu/omap-iommu.c                  |  3 ++-
 drivers/iommu/riscv/iommu.c                 |  1 -
 drivers/iommu/rockchip-iommu.c              |  3 ++-
 drivers/iommu/s390-iommu.c                  |  2 +-
 drivers/iommu/sprd-iommu.c                  |  3 ++-
 drivers/iommu/sun50i-iommu.c                |  3 ++-
 drivers/iommu/tegra-smmu.c                  |  3 ++-
 drivers/iommu/virtio-iommu.c                |  6 ++----
 include/linux/iommu.h                       |  2 --
 20 files changed, 31 insertions(+), 52 deletions(-)


base-commit: 44e9f08cac9f7cc49e14f141b556409c805912ec
-- 
2.43.0


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 1/7] iommu/arm-smmu-v3: Remove iommu_ops pgsize_bitmap
  2025-04-29 14:34 [PATCH 0/7] Remove ops.pgsize_bitmap Jason Gunthorpe
@ 2025-04-29 14:34 ` Jason Gunthorpe
  2025-04-29 14:34 ` [PATCH 2/7] iommu/arm-smmu: " Jason Gunthorpe
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 16+ messages in thread
From: Jason Gunthorpe @ 2025-04-29 14:34 UTC (permalink / raw)
  To: Alexandre Ghiti, Alim Akhtar, Alyssa Rosenzweig,
	AngeloGioacchino Del Regno, Albert Ou, asahi, Baolin Wang,
	Lu Baolu, David Woodhouse, Gerald Schaefer, Heiko Stuebner, iommu,
	Janne Grunau, Jean-Philippe Brucker, Jernej Skrabec,
	Jonathan Hunter, Joerg Roedel, Kevin Tian, Krzysztof Kozlowski,
	linux-arm-kernel, linux-arm-msm, linux-mediatek, linux-riscv,
	linux-rockchip, linux-s390, linux-samsung-soc, linux-sunxi,
	linux-tegra, Marek Szyprowski, Matthias Brugger, Matthew Rosato,
	Neal Gompa, Orson Zhai, Palmer Dabbelt, Paul Walmsley, Rob Clark,
	Robin Murphy, Samuel Holland, Niklas Schnelle, Sven Peter,
	Thierry Reding, Tomasz Jeznach, Krishna Reddy, virtualization,
	Chen-Yu Tsai, Will Deacon, Yong Wu, Chunyan Zhang
  Cc: patches

The driver never reads this value, arm_smmu_domain_finalise() always sets
domain.pgsize_bitmap to pgtbl_cfg, which comes from the per-smmu
calculated value.

Remove the ops version entirely, the related dead code and make
arm_smmu_ops const.

Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
---
 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
index e91d20e5785e06..a3e79a0896063b 100644
--- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
+++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
@@ -38,7 +38,7 @@ module_param(disable_msipolling, bool, 0444);
 MODULE_PARM_DESC(disable_msipolling,
 	"Disable MSI-based polling for CMD_SYNC completion.");
 
-static struct iommu_ops arm_smmu_ops;
+static const struct iommu_ops arm_smmu_ops;
 static struct iommu_dirty_ops arm_smmu_dirty_ops;
 
 enum arm_smmu_msi_index {
@@ -3674,7 +3674,7 @@ static int arm_smmu_def_domain_type(struct device *dev)
 	return 0;
 }
 
-static struct iommu_ops arm_smmu_ops = {
+static const struct iommu_ops arm_smmu_ops = {
 	.identity_domain	= &arm_smmu_identity_domain,
 	.blocked_domain		= &arm_smmu_blocked_domain,
 	.capable		= arm_smmu_capable,
@@ -3690,7 +3690,6 @@ static struct iommu_ops arm_smmu_ops = {
 	.def_domain_type	= arm_smmu_def_domain_type,
 	.viommu_alloc		= arm_vsmmu_alloc,
 	.user_pasid_table	= 1,
-	.pgsize_bitmap		= -1UL, /* Restricted during device attach */
 	.owner			= THIS_MODULE,
 	.default_domain_ops = &(const struct iommu_domain_ops) {
 		.attach_dev		= arm_smmu_attach_dev,
@@ -4504,11 +4503,6 @@ static int arm_smmu_device_hw_probe(struct arm_smmu_device *smmu)
 		smmu->oas = 48;
 	}
 
-	if (arm_smmu_ops.pgsize_bitmap == -1UL)
-		arm_smmu_ops.pgsize_bitmap = smmu->pgsize_bitmap;
-	else
-		arm_smmu_ops.pgsize_bitmap |= smmu->pgsize_bitmap;
-
 	/* Set the DMA mask for our table walker */
 	if (dma_set_mask_and_coherent(smmu->dev, DMA_BIT_MASK(smmu->oas)))
 		dev_warn(smmu->dev,
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 2/7] iommu/arm-smmu: Remove iommu_ops pgsize_bitmap
  2025-04-29 14:34 [PATCH 0/7] Remove ops.pgsize_bitmap Jason Gunthorpe
  2025-04-29 14:34 ` [PATCH 1/7] iommu/arm-smmu-v3: Remove iommu_ops pgsize_bitmap Jason Gunthorpe
@ 2025-04-29 14:34 ` Jason Gunthorpe
  2025-04-29 14:34 ` [PATCH 3/7] iommu: Remove ops.pgsize_bitmap from drivers that don't use it Jason Gunthorpe
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 16+ messages in thread
From: Jason Gunthorpe @ 2025-04-29 14:34 UTC (permalink / raw)
  To: Alexandre Ghiti, Alim Akhtar, Alyssa Rosenzweig,
	AngeloGioacchino Del Regno, Albert Ou, asahi, Baolin Wang,
	Lu Baolu, David Woodhouse, Gerald Schaefer, Heiko Stuebner, iommu,
	Janne Grunau, Jean-Philippe Brucker, Jernej Skrabec,
	Jonathan Hunter, Joerg Roedel, Kevin Tian, Krzysztof Kozlowski,
	linux-arm-kernel, linux-arm-msm, linux-mediatek, linux-riscv,
	linux-rockchip, linux-s390, linux-samsung-soc, linux-sunxi,
	linux-tegra, Marek Szyprowski, Matthias Brugger, Matthew Rosato,
	Neal Gompa, Orson Zhai, Palmer Dabbelt, Paul Walmsley, Rob Clark,
	Robin Murphy, Samuel Holland, Niklas Schnelle, Sven Peter,
	Thierry Reding, Tomasz Jeznach, Krishna Reddy, virtualization,
	Chen-Yu Tsai, Will Deacon, Yong Wu, Chunyan Zhang
  Cc: patches

The driver never reads this value, arm_smmu_init_domain_context() always
sets domain.pgsize_bitmap to smmu->pgsize_bitmap, the per-instance value.

Remove the ops version entirely, the related dead code and make
arm_smmu_ops const.

Since this driver does not yet finalize the domain under
arm_smmu_domain_alloc_paging() add a page size initialization to alloc so
the page size is still setup prior to attach.

Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
---
 drivers/iommu/arm/arm-smmu/arm-smmu.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.c b/drivers/iommu/arm/arm-smmu/arm-smmu.c
index 8f439c265a23f1..1a3bccb55b17fc 100644
--- a/drivers/iommu/arm/arm-smmu/arm-smmu.c
+++ b/drivers/iommu/arm/arm-smmu/arm-smmu.c
@@ -109,7 +109,7 @@ static struct arm_smmu_domain *to_smmu_domain(struct iommu_domain *dom)
 }
 
 static struct platform_driver arm_smmu_driver;
-static struct iommu_ops arm_smmu_ops;
+static const struct iommu_ops arm_smmu_ops;
 
 #ifdef CONFIG_ARM_SMMU_LEGACY_DT_BINDINGS
 static struct device_node *dev_get_dev_node(struct device *dev)
@@ -913,6 +913,8 @@ static void arm_smmu_destroy_domain_context(struct arm_smmu_domain *smmu_domain)
 static struct iommu_domain *arm_smmu_domain_alloc_paging(struct device *dev)
 {
 	struct arm_smmu_domain *smmu_domain;
+	struct arm_smmu_master_cfg *cfg = dev_iommu_priv_get(dev);
+	struct arm_smmu_device *smmu = cfg->smmu;
 
 	/*
 	 * Allocate the domain and initialise some of its data structures.
@@ -925,6 +927,7 @@ static struct iommu_domain *arm_smmu_domain_alloc_paging(struct device *dev)
 
 	mutex_init(&smmu_domain->init_mutex);
 	spin_lock_init(&smmu_domain->cb_lock);
+	smmu_domain->domain.pgsize_bitmap = smmu->pgsize_bitmap;
 
 	return &smmu_domain->domain;
 }
@@ -1621,7 +1624,7 @@ static int arm_smmu_def_domain_type(struct device *dev)
 	return 0;
 }
 
-static struct iommu_ops arm_smmu_ops = {
+static const struct iommu_ops arm_smmu_ops = {
 	.identity_domain	= &arm_smmu_identity_domain,
 	.blocked_domain		= &arm_smmu_blocked_domain,
 	.capable		= arm_smmu_capable,
@@ -1633,7 +1636,6 @@ static struct iommu_ops arm_smmu_ops = {
 	.of_xlate		= arm_smmu_of_xlate,
 	.get_resv_regions	= arm_smmu_get_resv_regions,
 	.def_domain_type	= arm_smmu_def_domain_type,
-	.pgsize_bitmap		= -1UL, /* Restricted during device attach */
 	.owner			= THIS_MODULE,
 	.default_domain_ops = &(const struct iommu_domain_ops) {
 		.attach_dev		= arm_smmu_attach_dev,
@@ -1913,10 +1915,6 @@ static int arm_smmu_device_cfg_probe(struct arm_smmu_device *smmu)
 	if (smmu->features & ARM_SMMU_FEAT_FMT_AARCH64_64K)
 		smmu->pgsize_bitmap |= SZ_64K | SZ_512M;
 
-	if (arm_smmu_ops.pgsize_bitmap == -1UL)
-		arm_smmu_ops.pgsize_bitmap = smmu->pgsize_bitmap;
-	else
-		arm_smmu_ops.pgsize_bitmap |= smmu->pgsize_bitmap;
 	dev_notice(smmu->dev, "\tSupported page sizes: 0x%08lx\n",
 		   smmu->pgsize_bitmap);
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 3/7] iommu: Remove ops.pgsize_bitmap from drivers that don't use it
  2025-04-29 14:34 [PATCH 0/7] Remove ops.pgsize_bitmap Jason Gunthorpe
  2025-04-29 14:34 ` [PATCH 1/7] iommu/arm-smmu-v3: Remove iommu_ops pgsize_bitmap Jason Gunthorpe
  2025-04-29 14:34 ` [PATCH 2/7] iommu/arm-smmu: " Jason Gunthorpe
@ 2025-04-29 14:34 ` Jason Gunthorpe
  2025-04-30  2:32   ` Baolu Lu
                     ` (2 more replies)
  2025-04-29 14:34 ` [PATCH 4/7] iommu: Remove iommu_ops pgsize_bitmap from simple drivers Jason Gunthorpe
                   ` (5 subsequent siblings)
  8 siblings, 3 replies; 16+ messages in thread
From: Jason Gunthorpe @ 2025-04-29 14:34 UTC (permalink / raw)
  To: Alexandre Ghiti, Alim Akhtar, Alyssa Rosenzweig,
	AngeloGioacchino Del Regno, Albert Ou, asahi, Baolin Wang,
	Lu Baolu, David Woodhouse, Gerald Schaefer, Heiko Stuebner, iommu,
	Janne Grunau, Jean-Philippe Brucker, Jernej Skrabec,
	Jonathan Hunter, Joerg Roedel, Kevin Tian, Krzysztof Kozlowski,
	linux-arm-kernel, linux-arm-msm, linux-mediatek, linux-riscv,
	linux-rockchip, linux-s390, linux-samsung-soc, linux-sunxi,
	linux-tegra, Marek Szyprowski, Matthias Brugger, Matthew Rosato,
	Neal Gompa, Orson Zhai, Palmer Dabbelt, Paul Walmsley, Rob Clark,
	Robin Murphy, Samuel Holland, Niklas Schnelle, Sven Peter,
	Thierry Reding, Tomasz Jeznach, Krishna Reddy, virtualization,
	Chen-Yu Tsai, Will Deacon, Yong Wu, Chunyan Zhang
  Cc: patches

These drivers all set the domain->pgsize_bitmap in their
domain_alloc_paging() functions, so the ops value is never used. Delete
it.

Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
---
 drivers/iommu/apple-dart.c       | 1 -
 drivers/iommu/intel/iommu.c      | 1 -
 drivers/iommu/iommufd/selftest.c | 1 -
 drivers/iommu/riscv/iommu.c      | 1 -
 drivers/iommu/virtio-iommu.c     | 6 ++----
 5 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/iommu/apple-dart.c b/drivers/iommu/apple-dart.c
index 757d24f67ad45a..190f28d7661515 100644
--- a/drivers/iommu/apple-dart.c
+++ b/drivers/iommu/apple-dart.c
@@ -991,7 +991,6 @@ static const struct iommu_ops apple_dart_iommu_ops = {
 	.of_xlate = apple_dart_of_xlate,
 	.def_domain_type = apple_dart_def_domain_type,
 	.get_resv_regions = apple_dart_get_resv_regions,
-	.pgsize_bitmap = -1UL, /* Restricted during dart probe */
 	.owner = THIS_MODULE,
 	.default_domain_ops = &(const struct iommu_domain_ops) {
 		.attach_dev	= apple_dart_attach_dev_paging,
diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
index 82613f90dd01a2..e996f0259208f8 100644
--- a/drivers/iommu/intel/iommu.c
+++ b/drivers/iommu/intel/iommu.c
@@ -4407,7 +4407,6 @@ const struct iommu_ops intel_iommu_ops = {
 	.device_group		= intel_iommu_device_group,
 	.is_attach_deferred	= intel_iommu_is_attach_deferred,
 	.def_domain_type	= device_def_domain_type,
-	.pgsize_bitmap		= SZ_4K,
 	.page_response		= intel_iommu_page_response,
 	.default_domain_ops = &(const struct iommu_domain_ops) {
 		.attach_dev		= intel_iommu_attach_device,
diff --git a/drivers/iommu/iommufd/selftest.c b/drivers/iommu/iommufd/selftest.c
index 6bd0abf9a641e2..c52bf037a2f01e 100644
--- a/drivers/iommu/iommufd/selftest.c
+++ b/drivers/iommu/iommufd/selftest.c
@@ -801,7 +801,6 @@ static const struct iommu_ops mock_ops = {
 	.default_domain = &mock_blocking_domain,
 	.blocked_domain = &mock_blocking_domain,
 	.owner = THIS_MODULE,
-	.pgsize_bitmap = MOCK_IO_PAGE_SIZE,
 	.hw_info = mock_domain_hw_info,
 	.domain_alloc_paging_flags = mock_domain_alloc_paging_flags,
 	.domain_alloc_nested = mock_domain_alloc_nested,
diff --git a/drivers/iommu/riscv/iommu.c b/drivers/iommu/riscv/iommu.c
index bb57092ca90110..2d0d31ba28860a 100644
--- a/drivers/iommu/riscv/iommu.c
+++ b/drivers/iommu/riscv/iommu.c
@@ -1533,7 +1533,6 @@ static void riscv_iommu_release_device(struct device *dev)
 }
 
 static const struct iommu_ops riscv_iommu_ops = {
-	.pgsize_bitmap = SZ_4K,
 	.of_xlate = riscv_iommu_of_xlate,
 	.identity_domain = &riscv_iommu_identity_domain,
 	.blocked_domain = &riscv_iommu_blocking_domain,
diff --git a/drivers/iommu/virtio-iommu.c b/drivers/iommu/virtio-iommu.c
index ecd41fb03e5a51..532db1de201bae 100644
--- a/drivers/iommu/virtio-iommu.c
+++ b/drivers/iommu/virtio-iommu.c
@@ -998,7 +998,7 @@ static void viommu_get_resv_regions(struct device *dev, struct list_head *head)
 	iommu_dma_get_resv_regions(dev, head);
 }
 
-static struct iommu_ops viommu_ops;
+static const struct iommu_ops viommu_ops;
 static struct virtio_driver virtio_iommu_drv;
 
 static int viommu_match_node(struct device *dev, const void *data)
@@ -1086,7 +1086,7 @@ static bool viommu_capable(struct device *dev, enum iommu_cap cap)
 	}
 }
 
-static struct iommu_ops viommu_ops = {
+static const struct iommu_ops viommu_ops = {
 	.capable		= viommu_capable,
 	.domain_alloc_identity	= viommu_domain_alloc_identity,
 	.domain_alloc_paging	= viommu_domain_alloc_paging,
@@ -1217,8 +1217,6 @@ static int viommu_probe(struct virtio_device *vdev)
 		viommu->first_domain++;
 	}
 
-	viommu_ops.pgsize_bitmap = viommu->pgsize_bitmap;
-
 	virtio_device_ready(vdev);
 
 	/* Populate the event queue with buffers */
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 4/7] iommu: Remove iommu_ops pgsize_bitmap from simple drivers
  2025-04-29 14:34 [PATCH 0/7] Remove ops.pgsize_bitmap Jason Gunthorpe
                   ` (2 preceding siblings ...)
  2025-04-29 14:34 ` [PATCH 3/7] iommu: Remove ops.pgsize_bitmap from drivers that don't use it Jason Gunthorpe
@ 2025-04-29 14:34 ` Jason Gunthorpe
  2025-04-30 13:15   ` Niklas Schnelle
  2025-04-29 14:34 ` [PATCH 5/7] iommu/mtk: Remove iommu_ops pgsize_bitmap Jason Gunthorpe
                   ` (4 subsequent siblings)
  8 siblings, 1 reply; 16+ messages in thread
From: Jason Gunthorpe @ 2025-04-29 14:34 UTC (permalink / raw)
  To: Alexandre Ghiti, Alim Akhtar, Alyssa Rosenzweig,
	AngeloGioacchino Del Regno, Albert Ou, asahi, Baolin Wang,
	Lu Baolu, David Woodhouse, Gerald Schaefer, Heiko Stuebner, iommu,
	Janne Grunau, Jean-Philippe Brucker, Jernej Skrabec,
	Jonathan Hunter, Joerg Roedel, Kevin Tian, Krzysztof Kozlowski,
	linux-arm-kernel, linux-arm-msm, linux-mediatek, linux-riscv,
	linux-rockchip, linux-s390, linux-samsung-soc, linux-sunxi,
	linux-tegra, Marek Szyprowski, Matthias Brugger, Matthew Rosato,
	Neal Gompa, Orson Zhai, Palmer Dabbelt, Paul Walmsley, Rob Clark,
	Robin Murphy, Samuel Holland, Niklas Schnelle, Sven Peter,
	Thierry Reding, Tomasz Jeznach, Krishna Reddy, virtualization,
	Chen-Yu Tsai, Will Deacon, Yong Wu, Chunyan Zhang
  Cc: patches

These drivers just have a constant value for their page size, move it
into their domain_alloc_paging function before setting up the geometry.

Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
---
 drivers/iommu/exynos-iommu.c   | 3 ++-
 drivers/iommu/ipmmu-vmsa.c     | 4 ++--
 drivers/iommu/mtk_iommu_v1.c   | 3 ++-
 drivers/iommu/omap-iommu.c     | 3 ++-
 drivers/iommu/rockchip-iommu.c | 3 ++-
 drivers/iommu/s390-iommu.c     | 2 +-
 drivers/iommu/sprd-iommu.c     | 3 ++-
 drivers/iommu/sun50i-iommu.c   | 3 ++-
 drivers/iommu/tegra-smmu.c     | 3 ++-
 9 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c
index fcb6a0f7c08275..b62a8f35c3e851 100644
--- a/drivers/iommu/exynos-iommu.c
+++ b/drivers/iommu/exynos-iommu.c
@@ -925,6 +925,8 @@ static struct iommu_domain *exynos_iommu_domain_alloc_paging(struct device *dev)
 	spin_lock_init(&domain->pgtablelock);
 	INIT_LIST_HEAD(&domain->clients);
 
+	domain->domain.pgsize_bitmap = SECT_SIZE | LPAGE_SIZE | SPAGE_SIZE;
+
 	domain->domain.geometry.aperture_start = 0;
 	domain->domain.geometry.aperture_end   = ~0UL;
 	domain->domain.geometry.force_aperture = true;
@@ -1477,7 +1479,6 @@ static const struct iommu_ops exynos_iommu_ops = {
 	.device_group = generic_device_group,
 	.probe_device = exynos_iommu_probe_device,
 	.release_device = exynos_iommu_release_device,
-	.pgsize_bitmap = SECT_SIZE | LPAGE_SIZE | SPAGE_SIZE,
 	.of_xlate = exynos_iommu_of_xlate,
 	.default_domain_ops = &(const struct iommu_domain_ops) {
 		.attach_dev	= exynos_iommu_attach_device,
diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c
index 90341b24a81155..ffa892f6571406 100644
--- a/drivers/iommu/ipmmu-vmsa.c
+++ b/drivers/iommu/ipmmu-vmsa.c
@@ -430,7 +430,7 @@ static int ipmmu_domain_init_context(struct ipmmu_vmsa_domain *domain)
 	 * non-secure mode.
 	 */
 	domain->cfg.quirks = IO_PGTABLE_QUIRK_ARM_NS;
-	domain->cfg.pgsize_bitmap = SZ_1G | SZ_2M | SZ_4K;
+	domain->cfg.pgsize_bitmap = domain->io_domain.pgsize_bitmap;
 	domain->cfg.ias = 32;
 	domain->cfg.oas = 40;
 	domain->cfg.tlb = &ipmmu_flush_ops;
@@ -571,6 +571,7 @@ static struct iommu_domain *ipmmu_domain_alloc_paging(struct device *dev)
 		return NULL;
 
 	mutex_init(&domain->mutex);
+	domain->io_domain.pgsize_bitmap = SZ_1G | SZ_2M | SZ_4K;
 
 	return &domain->io_domain;
 }
@@ -882,7 +883,6 @@ static const struct iommu_ops ipmmu_ops = {
 	 */
 	.device_group = IS_ENABLED(CONFIG_ARM) && !IS_ENABLED(CONFIG_IOMMU_DMA)
 			? generic_device_group : generic_single_device_group,
-	.pgsize_bitmap = SZ_1G | SZ_2M | SZ_4K,
 	.of_xlate = ipmmu_of_xlate,
 	.default_domain_ops = &(const struct iommu_domain_ops) {
 		.attach_dev	= ipmmu_attach_device,
diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c
index 66824982e05fbf..496cfe37243ac2 100644
--- a/drivers/iommu/mtk_iommu_v1.c
+++ b/drivers/iommu/mtk_iommu_v1.c
@@ -288,6 +288,8 @@ static struct iommu_domain *mtk_iommu_v1_domain_alloc_paging(struct device *dev)
 	if (!dom)
 		return NULL;
 
+	dom->domain.pgsize_bitmap = MT2701_IOMMU_PAGE_SIZE;
+
 	return &dom->domain;
 }
 
@@ -582,7 +584,6 @@ static const struct iommu_ops mtk_iommu_v1_ops = {
 	.probe_finalize = mtk_iommu_v1_probe_finalize,
 	.release_device	= mtk_iommu_v1_release_device,
 	.device_group	= generic_device_group,
-	.pgsize_bitmap	= MT2701_IOMMU_PAGE_SIZE,
 	.owner          = THIS_MODULE,
 	.default_domain_ops = &(const struct iommu_domain_ops) {
 		.attach_dev	= mtk_iommu_v1_attach_device,
diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c
index 3c62337f43c677..21c218976143ef 100644
--- a/drivers/iommu/omap-iommu.c
+++ b/drivers/iommu/omap-iommu.c
@@ -1584,6 +1584,8 @@ static struct iommu_domain *omap_iommu_domain_alloc_paging(struct device *dev)
 
 	spin_lock_init(&omap_domain->lock);
 
+	omap_domain->domain.pgsize_bitmap = OMAP_IOMMU_PGSIZES;
+
 	omap_domain->domain.geometry.aperture_start = 0;
 	omap_domain->domain.geometry.aperture_end   = (1ULL << 32) - 1;
 	omap_domain->domain.geometry.force_aperture = true;
@@ -1735,7 +1737,6 @@ static const struct iommu_ops omap_iommu_ops = {
 	.release_device	= omap_iommu_release_device,
 	.device_group	= generic_single_device_group,
 	.of_xlate	= omap_iommu_of_xlate,
-	.pgsize_bitmap	= OMAP_IOMMU_PGSIZES,
 	.default_domain_ops = &(const struct iommu_domain_ops) {
 		.attach_dev	= omap_iommu_attach_dev,
 		.map_pages	= omap_iommu_map,
diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c
index 22f74ba33a0e38..f4a5ad096343ab 100644
--- a/drivers/iommu/rockchip-iommu.c
+++ b/drivers/iommu/rockchip-iommu.c
@@ -1081,6 +1081,8 @@ static struct iommu_domain *rk_iommu_domain_alloc_paging(struct device *dev)
 	spin_lock_init(&rk_domain->dt_lock);
 	INIT_LIST_HEAD(&rk_domain->iommus);
 
+	rk_domain->domain.pgsize_bitmap = RK_IOMMU_PGSIZE_BITMAP;
+
 	rk_domain->domain.geometry.aperture_start = 0;
 	rk_domain->domain.geometry.aperture_end   = DMA_BIT_MASK(32);
 	rk_domain->domain.geometry.force_aperture = true;
@@ -1171,7 +1173,6 @@ static const struct iommu_ops rk_iommu_ops = {
 	.probe_device = rk_iommu_probe_device,
 	.release_device = rk_iommu_release_device,
 	.device_group = generic_single_device_group,
-	.pgsize_bitmap = RK_IOMMU_PGSIZE_BITMAP,
 	.of_xlate = rk_iommu_of_xlate,
 	.default_domain_ops = &(const struct iommu_domain_ops) {
 		.attach_dev	= rk_iommu_attach_device,
diff --git a/drivers/iommu/s390-iommu.c b/drivers/iommu/s390-iommu.c
index 433b59f435302b..9c80d61deb2c0b 100644
--- a/drivers/iommu/s390-iommu.c
+++ b/drivers/iommu/s390-iommu.c
@@ -557,6 +557,7 @@ static struct iommu_domain *s390_domain_alloc_paging(struct device *dev)
 	}
 	zdev->end_dma = zdev->start_dma + aperture_size - 1;
 
+	s390_domain->domain.pgsize_bitmap = SZ_4K;
 	s390_domain->domain.geometry.force_aperture = true;
 	s390_domain->domain.geometry.aperture_start = 0;
 	s390_domain->domain.geometry.aperture_end = max_tbl_size(s390_domain);
@@ -1158,7 +1159,6 @@ static struct iommu_domain blocking_domain = {
 	.domain_alloc_paging = s390_domain_alloc_paging, \
 	.probe_device = s390_iommu_probe_device, \
 	.device_group = generic_device_group, \
-	.pgsize_bitmap = SZ_4K, \
 	.get_resv_regions = s390_iommu_get_resv_regions, \
 	.default_domain_ops = &(const struct iommu_domain_ops) { \
 		.attach_dev	= s390_iommu_attach_device, \
diff --git a/drivers/iommu/sprd-iommu.c b/drivers/iommu/sprd-iommu.c
index 941d1f361c8cda..c7ca1d8a0b1530 100644
--- a/drivers/iommu/sprd-iommu.c
+++ b/drivers/iommu/sprd-iommu.c
@@ -143,6 +143,8 @@ static struct iommu_domain *sprd_iommu_domain_alloc_paging(struct device *dev)
 
 	spin_lock_init(&dom->pgtlock);
 
+	dom->domain.pgsize_bitmap = SPRD_IOMMU_PAGE_SIZE;
+
 	dom->domain.geometry.aperture_start = 0;
 	dom->domain.geometry.aperture_end = SZ_256M - 1;
 	dom->domain.geometry.force_aperture = true;
@@ -410,7 +412,6 @@ static const struct iommu_ops sprd_iommu_ops = {
 	.probe_device	= sprd_iommu_probe_device,
 	.device_group	= generic_single_device_group,
 	.of_xlate	= sprd_iommu_of_xlate,
-	.pgsize_bitmap	= SPRD_IOMMU_PAGE_SIZE,
 	.owner		= THIS_MODULE,
 	.default_domain_ops = &(const struct iommu_domain_ops) {
 		.attach_dev	= sprd_iommu_attach_device,
diff --git a/drivers/iommu/sun50i-iommu.c b/drivers/iommu/sun50i-iommu.c
index 76c9620af4bba8..de10b569d9a940 100644
--- a/drivers/iommu/sun50i-iommu.c
+++ b/drivers/iommu/sun50i-iommu.c
@@ -697,6 +697,8 @@ sun50i_iommu_domain_alloc_paging(struct device *dev)
 
 	refcount_set(&sun50i_domain->refcnt, 1);
 
+	sun50i_domain->domain.pgsize_bitmap = SZ_4K;
+
 	sun50i_domain->domain.geometry.aperture_start = 0;
 	sun50i_domain->domain.geometry.aperture_end = DMA_BIT_MASK(32);
 	sun50i_domain->domain.geometry.force_aperture = true;
@@ -842,7 +844,6 @@ static int sun50i_iommu_of_xlate(struct device *dev,
 
 static const struct iommu_ops sun50i_iommu_ops = {
 	.identity_domain = &sun50i_iommu_identity_domain,
-	.pgsize_bitmap	= SZ_4K,
 	.device_group	= generic_single_device_group,
 	.domain_alloc_paging = sun50i_iommu_domain_alloc_paging,
 	.of_xlate	= sun50i_iommu_of_xlate,
diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c
index 61897d50162dd7..fa0913e9346c71 100644
--- a/drivers/iommu/tegra-smmu.c
+++ b/drivers/iommu/tegra-smmu.c
@@ -318,6 +318,8 @@ static struct iommu_domain *tegra_smmu_domain_alloc_paging(struct device *dev)
 
 	spin_lock_init(&as->lock);
 
+	as->domain.pgsize_bitmap = SZ_4K;
+
 	/* setup aperture */
 	as->domain.geometry.aperture_start = 0;
 	as->domain.geometry.aperture_end = 0xffffffff;
@@ -1002,7 +1004,6 @@ static const struct iommu_ops tegra_smmu_ops = {
 	.probe_device = tegra_smmu_probe_device,
 	.device_group = tegra_smmu_device_group,
 	.of_xlate = tegra_smmu_of_xlate,
-	.pgsize_bitmap = SZ_4K,
 	.default_domain_ops = &(const struct iommu_domain_ops) {
 		.attach_dev	= tegra_smmu_attach_dev,
 		.map_pages	= tegra_smmu_map,
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 5/7] iommu/mtk: Remove iommu_ops pgsize_bitmap
  2025-04-29 14:34 [PATCH 0/7] Remove ops.pgsize_bitmap Jason Gunthorpe
                   ` (3 preceding siblings ...)
  2025-04-29 14:34 ` [PATCH 4/7] iommu: Remove iommu_ops pgsize_bitmap from simple drivers Jason Gunthorpe
@ 2025-04-29 14:34 ` Jason Gunthorpe
  2025-04-29 14:34 ` [PATCH 6/7] iommu/qcom: " Jason Gunthorpe
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 16+ messages in thread
From: Jason Gunthorpe @ 2025-04-29 14:34 UTC (permalink / raw)
  To: Alexandre Ghiti, Alim Akhtar, Alyssa Rosenzweig,
	AngeloGioacchino Del Regno, Albert Ou, asahi, Baolin Wang,
	Lu Baolu, David Woodhouse, Gerald Schaefer, Heiko Stuebner, iommu,
	Janne Grunau, Jean-Philippe Brucker, Jernej Skrabec,
	Jonathan Hunter, Joerg Roedel, Kevin Tian, Krzysztof Kozlowski,
	linux-arm-kernel, linux-arm-msm, linux-mediatek, linux-riscv,
	linux-rockchip, linux-s390, linux-samsung-soc, linux-sunxi,
	linux-tegra, Marek Szyprowski, Matthias Brugger, Matthew Rosato,
	Neal Gompa, Orson Zhai, Palmer Dabbelt, Paul Walmsley, Rob Clark,
	Robin Murphy, Samuel Holland, Niklas Schnelle, Sven Peter,
	Thierry Reding, Tomasz Jeznach, Krishna Reddy, virtualization,
	Chen-Yu Tsai, Will Deacon, Yong Wu, Chunyan Zhang
  Cc: patches

This driver just uses a constant, put it in domain_alloc_paging
and use the domain's value instead of ops during finalise.

Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
---
 drivers/iommu/mtk_iommu.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
index 0a54c6521bf50a..1bc91b72120e88 100644
--- a/drivers/iommu/mtk_iommu.c
+++ b/drivers/iommu/mtk_iommu.c
@@ -648,7 +648,7 @@ static int mtk_iommu_domain_finalise(struct mtk_iommu_domain *dom,
 	if (share_dom) {
 		dom->iop = share_dom->iop;
 		dom->cfg = share_dom->cfg;
-		dom->domain.pgsize_bitmap = share_dom->cfg.pgsize_bitmap;
+		dom->domain.pgsize_bitmap = share_dom->domain.pgsize_bitmap;
 		goto update_iova_region;
 	}
 
@@ -656,7 +656,7 @@ static int mtk_iommu_domain_finalise(struct mtk_iommu_domain *dom,
 		.quirks = IO_PGTABLE_QUIRK_ARM_NS |
 			IO_PGTABLE_QUIRK_NO_PERMS |
 			IO_PGTABLE_QUIRK_ARM_MTK_EXT,
-		.pgsize_bitmap = mtk_iommu_ops.pgsize_bitmap,
+		.pgsize_bitmap = dom->domain.pgsize_bitmap,
 		.ias = MTK_IOMMU_HAS_FLAG(data->plat_data, IOVA_34_EN) ? 34 : 32,
 		.iommu_dev = data->dev,
 	};
@@ -675,9 +675,6 @@ static int mtk_iommu_domain_finalise(struct mtk_iommu_domain *dom,
 		return -ENOMEM;
 	}
 
-	/* Update our support page sizes bitmap */
-	dom->domain.pgsize_bitmap = dom->cfg.pgsize_bitmap;
-
 	data->share_dom = dom;
 
 update_iova_region:
@@ -697,6 +694,7 @@ static struct iommu_domain *mtk_iommu_domain_alloc_paging(struct device *dev)
 	if (!dom)
 		return NULL;
 	mutex_init(&dom->mutex);
+	dom->domain.pgsize_bitmap = SZ_4K | SZ_64K | SZ_1M | SZ_16M;
 
 	return &dom->domain;
 }
@@ -1019,7 +1017,6 @@ static const struct iommu_ops mtk_iommu_ops = {
 	.device_group	= mtk_iommu_device_group,
 	.of_xlate	= mtk_iommu_of_xlate,
 	.get_resv_regions = mtk_iommu_get_resv_regions,
-	.pgsize_bitmap	= SZ_4K | SZ_64K | SZ_1M | SZ_16M,
 	.owner		= THIS_MODULE,
 	.default_domain_ops = &(const struct iommu_domain_ops) {
 		.attach_dev	= mtk_iommu_attach_device,
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 6/7] iommu/qcom: Remove iommu_ops pgsize_bitmap
  2025-04-29 14:34 [PATCH 0/7] Remove ops.pgsize_bitmap Jason Gunthorpe
                   ` (4 preceding siblings ...)
  2025-04-29 14:34 ` [PATCH 5/7] iommu/mtk: Remove iommu_ops pgsize_bitmap Jason Gunthorpe
@ 2025-04-29 14:34 ` Jason Gunthorpe
  2025-04-29 14:34 ` [PATCH 7/7] iommu: Remove ops->pgsize_bitmap Jason Gunthorpe
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 16+ messages in thread
From: Jason Gunthorpe @ 2025-04-29 14:34 UTC (permalink / raw)
  To: Alexandre Ghiti, Alim Akhtar, Alyssa Rosenzweig,
	AngeloGioacchino Del Regno, Albert Ou, asahi, Baolin Wang,
	Lu Baolu, David Woodhouse, Gerald Schaefer, Heiko Stuebner, iommu,
	Janne Grunau, Jean-Philippe Brucker, Jernej Skrabec,
	Jonathan Hunter, Joerg Roedel, Kevin Tian, Krzysztof Kozlowski,
	linux-arm-kernel, linux-arm-msm, linux-mediatek, linux-riscv,
	linux-rockchip, linux-s390, linux-samsung-soc, linux-sunxi,
	linux-tegra, Marek Szyprowski, Matthias Brugger, Matthew Rosato,
	Neal Gompa, Orson Zhai, Palmer Dabbelt, Paul Walmsley, Rob Clark,
	Robin Murphy, Samuel Holland, Niklas Schnelle, Sven Peter,
	Thierry Reding, Tomasz Jeznach, Krishna Reddy, virtualization,
	Chen-Yu Tsai, Will Deacon, Yong Wu, Chunyan Zhang
  Cc: patches

This driver just uses a constant, put it in domain_alloc_paging
and use the domain's value instead of ops during init_domain.

Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
---
 drivers/iommu/arm/arm-smmu/qcom_iommu.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/iommu/arm/arm-smmu/qcom_iommu.c b/drivers/iommu/arm/arm-smmu/qcom_iommu.c
index 3907924646a20c..d599f778e9f47b 100644
--- a/drivers/iommu/arm/arm-smmu/qcom_iommu.c
+++ b/drivers/iommu/arm/arm-smmu/qcom_iommu.c
@@ -229,7 +229,7 @@ static int qcom_iommu_init_domain(struct iommu_domain *domain,
 		goto out_unlock;
 
 	pgtbl_cfg = (struct io_pgtable_cfg) {
-		.pgsize_bitmap	= qcom_iommu_ops.pgsize_bitmap,
+		.pgsize_bitmap	= domain->pgsize_bitmap,
 		.ias		= 32,
 		.oas		= 40,
 		.tlb		= &qcom_flush_ops,
@@ -246,8 +246,6 @@ static int qcom_iommu_init_domain(struct iommu_domain *domain,
 		goto out_clear_iommu;
 	}
 
-	/* Update the domain's page sizes to reflect the page table format */
-	domain->pgsize_bitmap = pgtbl_cfg.pgsize_bitmap;
 	domain->geometry.aperture_end = (1ULL << pgtbl_cfg.ias) - 1;
 	domain->geometry.force_aperture = true;
 
@@ -337,6 +335,7 @@ static struct iommu_domain *qcom_iommu_domain_alloc_paging(struct device *dev)
 
 	mutex_init(&qcom_domain->init_mutex);
 	spin_lock_init(&qcom_domain->pgtbl_lock);
+	qcom_domain->domain.pgsize_bitmap = SZ_4K | SZ_64K | SZ_1M | SZ_16M;
 
 	return &qcom_domain->domain;
 }
@@ -598,7 +597,6 @@ static const struct iommu_ops qcom_iommu_ops = {
 	.probe_device	= qcom_iommu_probe_device,
 	.device_group	= generic_device_group,
 	.of_xlate	= qcom_iommu_of_xlate,
-	.pgsize_bitmap	= SZ_4K | SZ_64K | SZ_1M | SZ_16M,
 	.default_domain_ops = &(const struct iommu_domain_ops) {
 		.attach_dev	= qcom_iommu_attach_dev,
 		.map_pages	= qcom_iommu_map,
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 7/7] iommu: Remove ops->pgsize_bitmap
  2025-04-29 14:34 [PATCH 0/7] Remove ops.pgsize_bitmap Jason Gunthorpe
                   ` (5 preceding siblings ...)
  2025-04-29 14:34 ` [PATCH 6/7] iommu/qcom: " Jason Gunthorpe
@ 2025-04-29 14:34 ` Jason Gunthorpe
  2025-04-30  2:34   ` Baolu Lu
  2025-04-30  9:16 ` [PATCH 0/7] Remove ops.pgsize_bitmap Tian, Kevin
  2025-05-15 16:33 ` Will Deacon
  8 siblings, 1 reply; 16+ messages in thread
From: Jason Gunthorpe @ 2025-04-29 14:34 UTC (permalink / raw)
  To: Alexandre Ghiti, Alim Akhtar, Alyssa Rosenzweig,
	AngeloGioacchino Del Regno, Albert Ou, asahi, Baolin Wang,
	Lu Baolu, David Woodhouse, Gerald Schaefer, Heiko Stuebner, iommu,
	Janne Grunau, Jean-Philippe Brucker, Jernej Skrabec,
	Jonathan Hunter, Joerg Roedel, Kevin Tian, Krzysztof Kozlowski,
	linux-arm-kernel, linux-arm-msm, linux-mediatek, linux-riscv,
	linux-rockchip, linux-s390, linux-samsung-soc, linux-sunxi,
	linux-tegra, Marek Szyprowski, Matthias Brugger, Matthew Rosato,
	Neal Gompa, Orson Zhai, Palmer Dabbelt, Paul Walmsley, Rob Clark,
	Robin Murphy, Samuel Holland, Niklas Schnelle, Sven Peter,
	Thierry Reding, Tomasz Jeznach, Krishna Reddy, virtualization,
	Chen-Yu Tsai, Will Deacon, Yong Wu, Chunyan Zhang
  Cc: patches

No driver uses it now, remove the core code.

Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
---
 drivers/iommu/iommu.c | 7 -------
 include/linux/iommu.h | 2 --
 2 files changed, 9 deletions(-)

diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index 900fb782c3a6a1..db23093c9fa856 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -2002,13 +2002,6 @@ static void iommu_domain_init(struct iommu_domain *domain, unsigned int type,
 	domain->owner = ops;
 	if (!domain->ops)
 		domain->ops = ops->default_domain_ops;
-
-	/*
-	 * If not already set, assume all sizes by default; the driver
-	 * may override this later
-	 */
-	if (!domain->pgsize_bitmap)
-		domain->pgsize_bitmap = ops->pgsize_bitmap;
 }
 
 static struct iommu_domain *
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index 1785caee597778..1c2ddf62a672e2 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -606,7 +606,6 @@ iommu_copy_struct_from_full_user_array(void *kdst, size_t kdst_entry_size,
  *                It is required to call iommufd_viommu_alloc() helper for
  *                a bundled allocation of the core and the driver structures,
  *                using the given @ictx pointer.
- * @pgsize_bitmap: bitmap of all possible supported page sizes
  * @owner: Driver module providing these ops
  * @identity_domain: An always available, always attachable identity
  *                   translation.
@@ -661,7 +660,6 @@ struct iommu_ops {
 		struct iommufd_ctx *ictx, unsigned int viommu_type);
 
 	const struct iommu_domain_ops *default_domain_ops;
-	unsigned long pgsize_bitmap;
 	struct module *owner;
 	struct iommu_domain *identity_domain;
 	struct iommu_domain *blocked_domain;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH 3/7] iommu: Remove ops.pgsize_bitmap from drivers that don't use it
  2025-04-29 14:34 ` [PATCH 3/7] iommu: Remove ops.pgsize_bitmap from drivers that don't use it Jason Gunthorpe
@ 2025-04-30  2:32   ` Baolu Lu
  2025-05-01 19:07   ` Sven Peter
  2025-05-29 20:46   ` Tomasz Jeznach
  2 siblings, 0 replies; 16+ messages in thread
From: Baolu Lu @ 2025-04-30  2:32 UTC (permalink / raw)
  To: Jason Gunthorpe, Alexandre Ghiti, Alim Akhtar, Alyssa Rosenzweig,
	AngeloGioacchino Del Regno, Albert Ou, asahi, Baolin Wang,
	David Woodhouse, Gerald Schaefer, Heiko Stuebner, iommu,
	Janne Grunau, Jean-Philippe Brucker, Jernej Skrabec,
	Jonathan Hunter, Joerg Roedel, Kevin Tian, Krzysztof Kozlowski,
	linux-arm-kernel, linux-arm-msm, linux-mediatek, linux-riscv,
	linux-rockchip, linux-s390, linux-samsung-soc, linux-sunxi,
	linux-tegra, Marek Szyprowski, Matthias Brugger, Matthew Rosato,
	Neal Gompa, Orson Zhai, Palmer Dabbelt, Paul Walmsley, Rob Clark,
	Robin Murphy, Samuel Holland, Niklas Schnelle, Sven Peter,
	Thierry Reding, Tomasz Jeznach, Krishna Reddy, virtualization,
	Chen-Yu Tsai, Will Deacon, Yong Wu, Chunyan Zhang
  Cc: patches

On 4/29/25 22:34, Jason Gunthorpe wrote:
> These drivers all set the domain->pgsize_bitmap in their
> domain_alloc_paging() functions, so the ops value is never used. Delete
> it.
> 
> Signed-off-by: Jason Gunthorpe<jgg@nvidia.com>
> ---
>   drivers/iommu/apple-dart.c       | 1 -
>   drivers/iommu/intel/iommu.c      | 1 -
>   drivers/iommu/iommufd/selftest.c | 1 -
>   drivers/iommu/riscv/iommu.c      | 1 -
>   drivers/iommu/virtio-iommu.c     | 6 ++----
>   5 files changed, 2 insertions(+), 8 deletions(-)

For intel vt-d driver,

Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 7/7] iommu: Remove ops->pgsize_bitmap
  2025-04-29 14:34 ` [PATCH 7/7] iommu: Remove ops->pgsize_bitmap Jason Gunthorpe
@ 2025-04-30  2:34   ` Baolu Lu
  0 siblings, 0 replies; 16+ messages in thread
From: Baolu Lu @ 2025-04-30  2:34 UTC (permalink / raw)
  To: Jason Gunthorpe, Alexandre Ghiti, Alim Akhtar, Alyssa Rosenzweig,
	AngeloGioacchino Del Regno, Albert Ou, asahi, Baolin Wang,
	David Woodhouse, Gerald Schaefer, Heiko Stuebner, iommu,
	Janne Grunau, Jean-Philippe Brucker, Jernej Skrabec,
	Jonathan Hunter, Joerg Roedel, Kevin Tian, Krzysztof Kozlowski,
	linux-arm-kernel, linux-arm-msm, linux-mediatek, linux-riscv,
	linux-rockchip, linux-s390, linux-samsung-soc, linux-sunxi,
	linux-tegra, Marek Szyprowski, Matthias Brugger, Matthew Rosato,
	Neal Gompa, Orson Zhai, Palmer Dabbelt, Paul Walmsley, Rob Clark,
	Robin Murphy, Samuel Holland, Niklas Schnelle, Sven Peter,
	Thierry Reding, Tomasz Jeznach, Krishna Reddy, virtualization,
	Chen-Yu Tsai, Will Deacon, Yong Wu, Chunyan Zhang
  Cc: patches

On 4/29/25 22:34, Jason Gunthorpe wrote:
> No driver uses it now, remove the core code.
> 
> Signed-off-by: Jason Gunthorpe<jgg@nvidia.com>

Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* RE: [PATCH 0/7] Remove ops.pgsize_bitmap
  2025-04-29 14:34 [PATCH 0/7] Remove ops.pgsize_bitmap Jason Gunthorpe
                   ` (6 preceding siblings ...)
  2025-04-29 14:34 ` [PATCH 7/7] iommu: Remove ops->pgsize_bitmap Jason Gunthorpe
@ 2025-04-30  9:16 ` Tian, Kevin
  2025-05-15 16:33 ` Will Deacon
  8 siblings, 0 replies; 16+ messages in thread
From: Tian, Kevin @ 2025-04-30  9:16 UTC (permalink / raw)
  To: Jason Gunthorpe, Alexandre Ghiti, Alim Akhtar, Alyssa Rosenzweig,
	AngeloGioacchino Del Regno, Albert Ou, asahi@lists.linux.dev,
	Baolin Wang, Lu Baolu, David Woodhouse, Gerald Schaefer,
	Heiko Stuebner, iommu@lists.linux.dev, Janne Grunau,
	Jean-Philippe Brucker, Jernej Skrabec, Jonathan Hunter,
	Joerg Roedel, Krzysztof Kozlowski,
	linux-arm-kernel@lists.infradead.org,
	linux-arm-msm@vger.kernel.org, linux-mediatek@lists.infradead.org,
	linux-riscv@lists.infradead.org,
	linux-rockchip@lists.infradead.org, linux-s390@vger.kernel.org,
	linux-samsung-soc@vger.kernel.org, linux-sunxi@lists.linux.dev,
	linux-tegra@vger.kernel.org, Marek Szyprowski, Matthias Brugger,
	Matthew Rosato, Neal Gompa, Orson Zhai, Palmer Dabbelt,
	Paul Walmsley, Rob Clark, Robin Murphy, Samuel Holland,
	Niklas Schnelle, Sven Peter, Thierry Reding, Tomasz Jeznach,
	Krishna Reddy, virtualization@lists.linux.dev, Chen-Yu Tsai,
	Will Deacon, Yong Wu, Chunyan Zhang
  Cc: patches@lists.linux.dev

> From: Jason Gunthorpe <jgg@nvidia.com>
> Sent: Tuesday, April 29, 2025 10:34 PM
> 
> Now that all drivers are using domain_alloc_paging() and dev is never
> NULL, we can have all drivers correctly set domain.pgsize_bitmap during
> their allocation function.
> 
> There are a few oddities that have accumulated here over past changes:
> 
>  - Some drivers always set domain.pgsize_bitmap during their
>    domain_alloc_paging() call but still provide a value in ops. This is dead
>    code, delete it.
> 
>  - Some drivers calculate a system global pgsize_bitmap in the ops, but
>    it is now trivial to use the per-instance value instead. In several
>    cases this is dead code, delete it. This also allows
>    constifying the ops in these drivers as a hardening measure
> 
>  - Some drivers have a fixed pgsize_bitmap, put it next to setting up the
>    geometry in their domain_alloc_paging() functions.
> 
>  - Finally a few drivers still use ops because they have a delayed
>    finalize operation. Set the constant pgsize_bitmap in the
>    domain_alloc_paging().
> 
> Then remove ops.pgsize_bitmap.
> 
> This is based on iommu next, and must go after the virtio
> domain_alloc_paging() conversion.
> 

for entire series:

Reviewed-by: Kevin Tian <kevin.tian@intel.com>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 4/7] iommu: Remove iommu_ops pgsize_bitmap from simple drivers
  2025-04-29 14:34 ` [PATCH 4/7] iommu: Remove iommu_ops pgsize_bitmap from simple drivers Jason Gunthorpe
@ 2025-04-30 13:15   ` Niklas Schnelle
  2025-04-30 13:21     ` Jason Gunthorpe
  0 siblings, 1 reply; 16+ messages in thread
From: Niklas Schnelle @ 2025-04-30 13:15 UTC (permalink / raw)
  To: Jason Gunthorpe, Alexandre Ghiti, Alim Akhtar, Alyssa Rosenzweig,
	AngeloGioacchino Del Regno, Albert Ou, asahi, Baolin Wang,
	Lu Baolu, David Woodhouse, Gerald Schaefer, Heiko Stuebner, iommu,
	Janne Grunau, Jean-Philippe Brucker, Jernej Skrabec,
	Jonathan Hunter, Joerg Roedel, Kevin Tian, Krzysztof Kozlowski,
	linux-arm-kernel, linux-arm-msm, linux-mediatek, linux-riscv,
	linux-rockchip, linux-s390, linux-samsung-soc, linux-sunxi,
	linux-tegra, Marek Szyprowski, Matthias Brugger, Matthew Rosato,
	Neal Gompa, Orson Zhai, Palmer Dabbelt, Paul Walmsley, Rob Clark,
	Robin Murphy, Samuel Holland, Sven Peter, Thierry Reding,
	Tomasz Jeznach, Krishna Reddy, virtualization, Chen-Yu Tsai,
	Will Deacon, Yong Wu, Chunyan Zhang
  Cc: patches

On Tue, 2025-04-29 at 11:34 -0300, Jason Gunthorpe wrote:
> These drivers just have a constant value for their page size, move it
> into their domain_alloc_paging function before setting up the geometry.
> 
> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
> ---
>  drivers/iommu/exynos-iommu.c   | 3 ++-
>  drivers/iommu/ipmmu-vmsa.c     | 4 ++--
>  drivers/iommu/mtk_iommu_v1.c   | 3 ++-
>  drivers/iommu/omap-iommu.c     | 3 ++-
>  drivers/iommu/rockchip-iommu.c | 3 ++-
>  drivers/iommu/s390-iommu.c     | 2 +-
>  drivers/iommu/sprd-iommu.c     | 3 ++-
>  drivers/iommu/sun50i-iommu.c   | 3 ++-
>  drivers/iommu/tegra-smmu.c     | 3 ++-
>  9 files changed, 17 insertions(+), 10 deletions(-)
> 
--- snip ---
> diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c
> index 3c62337f43c677..21c218976143ef 100644
> --- a/drivers/iommu/omap-iommu.c
> +++ b/drivers/iommu/omap-iommu.c
> @@ -1584,6 +1584,8 @@ static struct iommu_domain *omap_iommu_domain_alloc_paging(struct device *dev)
>  
>  	spin_lock_init(&omap_domain->lock);
>  
> +	omap_domain->domain.pgsize_bitmap = OMAP_IOMMU_PGSIZES;
> +
>  	omap_domain->domain.geometry.aperture_start = 0;
>  	omap_domain->domain.geometry.aperture_end   = (1ULL << 32) - 1;
>  	omap_domain->domain.geometry.force_aperture = true;
> @@ -1735,7 +1737,6 @@ static const struct iommu_ops omap_iommu_ops = {
>  	.release_device	= omap_iommu_release_device,
>  	.device_group	= generic_single_device_group,
>  	.of_xlate	= omap_iommu_of_xlate,
> -	.pgsize_bitmap	= OMAP_IOMMU_PGSIZES,
>  	.default_domain_ops = &(const struct iommu_domain_ops) {
>  		.attach_dev	= omap_iommu_attach_dev,
>  		.map_pages	= omap_iommu_map,
> diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c
> index 22f74ba33a0e38..f4a5ad096343ab 100644
> --- a/drivers/iommu/rockchip-iommu.c
> +++ b/drivers/iommu/rockchip-iommu.c
> @@ -1081,6 +1081,8 @@ static struct iommu_domain *rk_iommu_domain_alloc_paging(struct device *dev)
>  	spin_lock_init(&rk_domain->dt_lock);
>  	INIT_LIST_HEAD(&rk_domain->iommus);
>  
> +	rk_domain->domain.pgsize_bitmap = RK_IOMMU_PGSIZE_BITMAP;
> +
>  	rk_domain->domain.geometry.aperture_start = 0;
>  	rk_domain->domain.geometry.aperture_end   = DMA_BIT_MASK(32);
>  	rk_domain->domain.geometry.force_aperture = true;
> @@ -1171,7 +1173,6 @@ static const struct iommu_ops rk_iommu_ops = {
>  	.probe_device = rk_iommu_probe_device,
>  	.release_device = rk_iommu_release_device,
>  	.device_group = generic_single_device_group,
> -	.pgsize_bitmap = RK_IOMMU_PGSIZE_BITMAP,
>  	.of_xlate = rk_iommu_of_xlate,
>  	.default_domain_ops = &(const struct iommu_domain_ops) {
>  		.attach_dev	= rk_iommu_attach_device,
> diff --git a/drivers/iommu/s390-iommu.c b/drivers/iommu/s390-iommu.c
> index 433b59f435302b..9c80d61deb2c0b 100644
> --- a/drivers/iommu/s390-iommu.c
> +++ b/drivers/iommu/s390-iommu.c
> @@ -557,6 +557,7 @@ static struct iommu_domain *s390_domain_alloc_paging(struct device *dev)
>  	}
>  	zdev->end_dma = zdev->start_dma + aperture_size - 1;
>  
> +	s390_domain->domain.pgsize_bitmap = SZ_4K;
>  	s390_domain->domain.geometry.force_aperture = true;
>  	s390_domain->domain.geometry.aperture_start = 0;
>  	s390_domain->domain.geometry.aperture_end = max_tbl_size(s390_domain);
> @@ -1158,7 +1159,6 @@ static struct iommu_domain blocking_domain = {
>  	.domain_alloc_paging = s390_domain_alloc_paging, \
>  	.probe_device = s390_iommu_probe_device, \
>  	.device_group = generic_device_group, \
> -	.pgsize_bitmap = SZ_4K, \
>  	.get_resv_regions = s390_iommu_get_resv_regions, \
>  	.default_domain_ops = &(const struct iommu_domain_ops) { \
>  		.attach_dev	= s390_iommu_attach_device, \

I'm guessing there's no particular thought behind not adding an empty
line for s390-iommu.c like for the others? I slightly prefer not having
an empty line here but would be fine with it too, so just curious.

Acked-by: Niklas Schnelle <schnelle@linux.ibm.com> # for s390-iommu.c

> diff --git a/drivers/iommu/sprd-iommu.c b/drivers/iommu/sprd-iommu.c
--- snip ---

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 4/7] iommu: Remove iommu_ops pgsize_bitmap from simple drivers
  2025-04-30 13:15   ` Niklas Schnelle
@ 2025-04-30 13:21     ` Jason Gunthorpe
  0 siblings, 0 replies; 16+ messages in thread
From: Jason Gunthorpe @ 2025-04-30 13:21 UTC (permalink / raw)
  To: Niklas Schnelle
  Cc: Alexandre Ghiti, Alim Akhtar, Alyssa Rosenzweig,
	AngeloGioacchino Del Regno, Albert Ou, asahi, Baolin Wang,
	Lu Baolu, David Woodhouse, Gerald Schaefer, Heiko Stuebner, iommu,
	Janne Grunau, Jean-Philippe Brucker, Jernej Skrabec,
	Jonathan Hunter, Joerg Roedel, Kevin Tian, Krzysztof Kozlowski,
	linux-arm-kernel, linux-arm-msm, linux-mediatek, linux-riscv,
	linux-rockchip, linux-s390, linux-samsung-soc, linux-sunxi,
	linux-tegra, Marek Szyprowski, Matthias Brugger, Matthew Rosato,
	Neal Gompa, Orson Zhai, Palmer Dabbelt, Paul Walmsley, Rob Clark,
	Robin Murphy, Samuel Holland, Sven Peter, Thierry Reding,
	Tomasz Jeznach, Krishna Reddy, virtualization, Chen-Yu Tsai,
	Will Deacon, Yong Wu, Chunyan Zhang, patches

On Wed, Apr 30, 2025 at 03:15:14PM +0200, Niklas Schnelle wrote:
> > diff --git a/drivers/iommu/s390-iommu.c b/drivers/iommu/s390-iommu.c
> > index 433b59f435302b..9c80d61deb2c0b 100644
> > --- a/drivers/iommu/s390-iommu.c
> > +++ b/drivers/iommu/s390-iommu.c
> > @@ -557,6 +557,7 @@ static struct iommu_domain *s390_domain_alloc_paging(struct device *dev)
> >  	}
> >  	zdev->end_dma = zdev->start_dma + aperture_size - 1;
> >  
> > +	s390_domain->domain.pgsize_bitmap = SZ_4K;
> >  	s390_domain->domain.geometry.force_aperture = true;
> >  	s390_domain->domain.geometry.aperture_start = 0;
> >  	s390_domain->domain.geometry.aperture_end = max_tbl_size(s390_domain);
> > @@ -1158,7 +1159,6 @@ static struct iommu_domain blocking_domain = {
> >  	.domain_alloc_paging = s390_domain_alloc_paging, \
> >  	.probe_device = s390_iommu_probe_device, \
> >  	.device_group = generic_device_group, \
> > -	.pgsize_bitmap = SZ_4K, \
> >  	.get_resv_regions = s390_iommu_get_resv_regions, \
> >  	.default_domain_ops = &(const struct iommu_domain_ops) { \
> >  		.attach_dev	= s390_iommu_attach_device, \
> 
> I'm guessing there's no particular thought behind not adding an empty
> line for s390-iommu.c like for the others? I slightly prefer not having
> an empty line here but would be fine with it too, so just curious.

I think it was just done at a different time, I had to rebase this
hunk..

Thanks,
Jason

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 3/7] iommu: Remove ops.pgsize_bitmap from drivers that don't use it
  2025-04-29 14:34 ` [PATCH 3/7] iommu: Remove ops.pgsize_bitmap from drivers that don't use it Jason Gunthorpe
  2025-04-30  2:32   ` Baolu Lu
@ 2025-05-01 19:07   ` Sven Peter
  2025-05-29 20:46   ` Tomasz Jeznach
  2 siblings, 0 replies; 16+ messages in thread
From: Sven Peter @ 2025-05-01 19:07 UTC (permalink / raw)
  To: Jason Gunthorpe, Alexandre Ghiti, Alim Akhtar, Alyssa Rosenzweig,
	AngeloGioacchino Del Regno, Albert Ou, asahi, Baolin Wang,
	Lu Baolu, David Woodhouse, Gerald Schaefer, Heiko Stuebner, iommu,
	Janne Grunau, Jean-Philippe Brucker, Jernej Skrabec,
	Jonathan Hunter, Joerg Roedel, Kevin Tian, Krzysztof Kozlowski,
	linux-arm-kernel, linux-arm-msm, linux-mediatek, linux-riscv,
	linux-rockchip, linux-s390, linux-samsung-soc, linux-sunxi,
	linux-tegra, Marek Szyprowski, Matthias Brugger, Matthew Rosato,
	Neal Gompa, Orson Zhai, Palmer Dabbelt, Paul Walmsley, Rob Clark,
	Robin Murphy, Samuel Holland, Niklas Schnelle, Thierry Reding,
	Tomasz Jeznach, Krishna Reddy, virtualization, Chen-Yu Tsai,
	Will Deacon, Yong Wu, Chunyan Zhang
  Cc: patches

On Tue, Apr 29, 2025, at 16:34, Jason Gunthorpe wrote:
> These drivers all set the domain->pgsize_bitmap in their
> domain_alloc_paging() functions, so the ops value is never used. Delete
> it.
>
> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
> ---
>  drivers/iommu/apple-dart.c       | 1 -
>  drivers/iommu/intel/iommu.c      | 1 -
>  drivers/iommu/iommufd/selftest.c | 1 -
>  drivers/iommu/riscv/iommu.c      | 1 -
>  drivers/iommu/virtio-iommu.c     | 6 ++----
>  5 files changed, 2 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/iommu/apple-dart.c b/drivers/iommu/apple-dart.c
> index 757d24f67ad45a..190f28d7661515 100644
> --- a/drivers/iommu/apple-dart.c
> +++ b/drivers/iommu/apple-dart.c
> @@ -991,7 +991,6 @@ static const struct iommu_ops apple_dart_iommu_ops = {
>  	.of_xlate = apple_dart_of_xlate,
>  	.def_domain_type = apple_dart_def_domain_type,
>  	.get_resv_regions = apple_dart_get_resv_regions,
> -	.pgsize_bitmap = -1UL, /* Restricted during dart probe */
>  	.owner = THIS_MODULE,
>  	.default_domain_ops = &(const struct iommu_domain_ops) {
>  		.attach_dev	= apple_dart_attach_dev_paging,

Reviewed-by: Sven Peter <sven@svenpeter.dev> # for Apple DART



Best,


Sven

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 0/7] Remove ops.pgsize_bitmap
  2025-04-29 14:34 [PATCH 0/7] Remove ops.pgsize_bitmap Jason Gunthorpe
                   ` (7 preceding siblings ...)
  2025-04-30  9:16 ` [PATCH 0/7] Remove ops.pgsize_bitmap Tian, Kevin
@ 2025-05-15 16:33 ` Will Deacon
  8 siblings, 0 replies; 16+ messages in thread
From: Will Deacon @ 2025-05-15 16:33 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: Alexandre Ghiti, Alim Akhtar, Alyssa Rosenzweig,
	AngeloGioacchino Del Regno, Albert Ou, asahi, Baolin Wang,
	Lu Baolu, David Woodhouse, Gerald Schaefer, Heiko Stuebner, iommu,
	Janne Grunau, Jean-Philippe Brucker, Jernej Skrabec,
	Jonathan Hunter, Joerg Roedel, Kevin Tian, Krzysztof Kozlowski,
	linux-arm-kernel, linux-arm-msm, linux-mediatek, linux-riscv,
	linux-rockchip, linux-s390, linux-samsung-soc, linux-sunxi,
	linux-tegra, Marek Szyprowski, Matthias Brugger, Matthew Rosato,
	Neal Gompa, Orson Zhai, Palmer Dabbelt, Paul Walmsley, Rob Clark,
	Robin Murphy, Samuel Holland, Niklas Schnelle, Sven Peter,
	Thierry Reding, Tomasz Jeznach, Krishna Reddy, virtualization,
	Chen-Yu Tsai, Yong Wu, Chunyan Zhang, patches

On Tue, Apr 29, 2025 at 11:34:10AM -0300, Jason Gunthorpe wrote:
> Now that all drivers are using domain_alloc_paging() and dev is never
> NULL, we can have all drivers correctly set domain.pgsize_bitmap during
> their allocation function.
> 
> There are a few oddities that have accumulated here over past changes:
> 
>  - Some drivers always set domain.pgsize_bitmap during their
>    domain_alloc_paging() call but still provide a value in ops. This is dead
>    code, delete it.
> 
>  - Some drivers calculate a system global pgsize_bitmap in the ops, but
>    it is now trivial to use the per-instance value instead. In several
>    cases this is dead code, delete it. This also allows
>    constifying the ops in these drivers as a hardening measure
> 
>  - Some drivers have a fixed pgsize_bitmap, put it next to setting up the
>    geometry in their domain_alloc_paging() functions.
> 
>  - Finally a few drivers still use ops because they have a delayed
>    finalize operation. Set the constant pgsize_bitmap in the
>    domain_alloc_paging().
> 
> Then remove ops.pgsize_bitmap.
> 
> This is based on iommu next, and must go after the virtio
> domain_alloc_paging() conversion.
> 
> Jason Gunthorpe (7):
>   iommu/arm-smmu-v3: Remove iommu_ops pgsize_bitmap
>   iommu/arm-smmu: Remove iommu_ops pgsize_bitmap

These two SMMU changes look correct to me:

Acked-by: Will Deacon <will@kernel.org>

Please yell if you'd like me to pick them up separately from the rest
of the series.

Will

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 3/7] iommu: Remove ops.pgsize_bitmap from drivers that don't use it
  2025-04-29 14:34 ` [PATCH 3/7] iommu: Remove ops.pgsize_bitmap from drivers that don't use it Jason Gunthorpe
  2025-04-30  2:32   ` Baolu Lu
  2025-05-01 19:07   ` Sven Peter
@ 2025-05-29 20:46   ` Tomasz Jeznach
  2 siblings, 0 replies; 16+ messages in thread
From: Tomasz Jeznach @ 2025-05-29 20:46 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: Alexandre Ghiti, Alim Akhtar, Alyssa Rosenzweig,
	AngeloGioacchino Del Regno, Albert Ou, asahi, Baolin Wang,
	Lu Baolu, David Woodhouse, Gerald Schaefer, Heiko Stuebner, iommu,
	Janne Grunau, Jean-Philippe Brucker, Jernej Skrabec,
	Jonathan Hunter, Joerg Roedel, Kevin Tian, Krzysztof Kozlowski,
	linux-arm-kernel, linux-arm-msm, linux-mediatek, linux-riscv,
	linux-rockchip, linux-s390, linux-samsung-soc, linux-sunxi,
	linux-tegra, Marek Szyprowski, Matthias Brugger, Matthew Rosato,
	Neal Gompa, Orson Zhai, Palmer Dabbelt, Paul Walmsley, Rob Clark,
	Robin Murphy, Samuel Holland, Niklas Schnelle, Sven Peter,
	Thierry Reding, Krishna Reddy, virtualization, Chen-Yu Tsai,
	Will Deacon, Yong Wu, Chunyan Zhang, patches

On Tue, Apr 29, 2025 at 11:34:13AM -0300, Jason Gunthorpe wrote:
> These drivers all set the domain->pgsize_bitmap in their
> domain_alloc_paging() functions, so the ops value is never used. Delete
> it.
> 
> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
> ---
>  drivers/iommu/apple-dart.c       | 1 -
>  drivers/iommu/intel/iommu.c      | 1 -
>  drivers/iommu/iommufd/selftest.c | 1 -
>  drivers/iommu/riscv/iommu.c      | 1 -
>  drivers/iommu/virtio-iommu.c     | 6 ++----
>  5 files changed, 2 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/iommu/riscv/iommu.c b/drivers/iommu/riscv/iommu.c
> index bb57092ca90110..2d0d31ba28860a 100644
> --- a/drivers/iommu/riscv/iommu.c
> +++ b/drivers/iommu/riscv/iommu.c
> @@ -1533,7 +1533,6 @@ static void riscv_iommu_release_device(struct device *dev)
>  }
>  
>  static const struct iommu_ops riscv_iommu_ops = {
> -	.pgsize_bitmap = SZ_4K,
>  	.of_xlate = riscv_iommu_of_xlate,
>  	.identity_domain = &riscv_iommu_identity_domain,
>  	.blocked_domain = &riscv_iommu_blocking_domain,

Reviewed-by: Tomasz Jeznach <tjeznach@rivosinc.com> # for RISC-V

Sorry for the delayed response.
- Tomasz

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2025-05-29 20:46 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-29 14:34 [PATCH 0/7] Remove ops.pgsize_bitmap Jason Gunthorpe
2025-04-29 14:34 ` [PATCH 1/7] iommu/arm-smmu-v3: Remove iommu_ops pgsize_bitmap Jason Gunthorpe
2025-04-29 14:34 ` [PATCH 2/7] iommu/arm-smmu: " Jason Gunthorpe
2025-04-29 14:34 ` [PATCH 3/7] iommu: Remove ops.pgsize_bitmap from drivers that don't use it Jason Gunthorpe
2025-04-30  2:32   ` Baolu Lu
2025-05-01 19:07   ` Sven Peter
2025-05-29 20:46   ` Tomasz Jeznach
2025-04-29 14:34 ` [PATCH 4/7] iommu: Remove iommu_ops pgsize_bitmap from simple drivers Jason Gunthorpe
2025-04-30 13:15   ` Niklas Schnelle
2025-04-30 13:21     ` Jason Gunthorpe
2025-04-29 14:34 ` [PATCH 5/7] iommu/mtk: Remove iommu_ops pgsize_bitmap Jason Gunthorpe
2025-04-29 14:34 ` [PATCH 6/7] iommu/qcom: " Jason Gunthorpe
2025-04-29 14:34 ` [PATCH 7/7] iommu: Remove ops->pgsize_bitmap Jason Gunthorpe
2025-04-30  2:34   ` Baolu Lu
2025-04-30  9:16 ` [PATCH 0/7] Remove ops.pgsize_bitmap Tian, Kevin
2025-05-15 16:33 ` Will Deacon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).