* [PATCH v2 0/7] Remove ops.pgsize_bitmap
@ 2025-06-09 20:41 Jason Gunthorpe
2025-06-09 20:41 ` [PATCH v2 1/7] qiommu/arm-smmu-v3: Remove iommu_ops pgsize_bitmap Jason Gunthorpe
` (8 more replies)
0 siblings, 9 replies; 19+ messages in thread
From: Jason Gunthorpe @ 2025-06-09 20:41 UTC (permalink / raw)
To: 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, 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,
Krishna Reddy, virtualization, Chen-Yu Tsai, Will Deacon, Yong Wu,
Chunyan Zhang
Cc: Lu Baolu, Kevin Tian, patches, Niklas Schnelle, Sven Peter,
Tomasz Jeznach
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.
v2:
- Rebase on v6.16-rc1
v1: https://patch.msgid.link/r/0-v1-7c5282b0c334+2db-iommu_rm_ops_pgsize_jgg@nvidia.com
Jason Gunthorpe (7):
qiommu/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: 19272b37aa4f83ca52bdf9c16d5d81bdd1354494
--
2.43.0
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH v2 1/7] qiommu/arm-smmu-v3: Remove iommu_ops pgsize_bitmap
2025-06-09 20:41 [PATCH v2 0/7] Remove ops.pgsize_bitmap Jason Gunthorpe
@ 2025-06-09 20:41 ` Jason Gunthorpe
2025-06-09 22:15 ` Nicolin Chen
2025-06-09 20:41 ` [PATCH v2 2/7] iommu/arm-smmu: " Jason Gunthorpe
` (7 subsequent siblings)
8 siblings, 1 reply; 19+ messages in thread
From: Jason Gunthorpe @ 2025-06-09 20:41 UTC (permalink / raw)
To: 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, 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,
Krishna Reddy, virtualization, Chen-Yu Tsai, Will Deacon, Yong Wu,
Chunyan Zhang
Cc: Lu Baolu, Kevin Tian, patches, Niklas Schnelle, Sven Peter,
Tomasz Jeznach
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.
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Acked-by: Will Deacon <will@kernel.org>
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 10cc6dc26b7b7c..351fe2516b694e 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] 19+ messages in thread
* [PATCH v2 2/7] iommu/arm-smmu: Remove iommu_ops pgsize_bitmap
2025-06-09 20:41 [PATCH v2 0/7] Remove ops.pgsize_bitmap Jason Gunthorpe
2025-06-09 20:41 ` [PATCH v2 1/7] qiommu/arm-smmu-v3: Remove iommu_ops pgsize_bitmap Jason Gunthorpe
@ 2025-06-09 20:41 ` Jason Gunthorpe
2025-06-09 20:41 ` [PATCH v2 3/7] iommu: Remove ops.pgsize_bitmap from drivers that don't use it Jason Gunthorpe
` (6 subsequent siblings)
8 siblings, 0 replies; 19+ messages in thread
From: Jason Gunthorpe @ 2025-06-09 20:41 UTC (permalink / raw)
To: 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, 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,
Krishna Reddy, virtualization, Chen-Yu Tsai, Will Deacon, Yong Wu,
Chunyan Zhang
Cc: Lu Baolu, Kevin Tian, patches, Niklas Schnelle, Sven Peter,
Tomasz Jeznach
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.
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Acked-by: Will Deacon <will@kernel.org>
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 8d95b14c7d5a40..4ced4b5bee4df3 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)
@@ -919,6 +919,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.
@@ -931,6 +933,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;
}
@@ -1627,7 +1630,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,
@@ -1639,7 +1642,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,
@@ -1919,10 +1921,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] 19+ messages in thread
* [PATCH v2 3/7] iommu: Remove ops.pgsize_bitmap from drivers that don't use it
2025-06-09 20:41 [PATCH v2 0/7] Remove ops.pgsize_bitmap Jason Gunthorpe
2025-06-09 20:41 ` [PATCH v2 1/7] qiommu/arm-smmu-v3: Remove iommu_ops pgsize_bitmap Jason Gunthorpe
2025-06-09 20:41 ` [PATCH v2 2/7] iommu/arm-smmu: " Jason Gunthorpe
@ 2025-06-09 20:41 ` Jason Gunthorpe
2025-06-09 20:41 ` [PATCH v2 4/7] iommu: Remove iommu_ops pgsize_bitmap from simple drivers Jason Gunthorpe
` (5 subsequent siblings)
8 siblings, 0 replies; 19+ messages in thread
From: Jason Gunthorpe @ 2025-06-09 20:41 UTC (permalink / raw)
To: 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, 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,
Krishna Reddy, virtualization, Chen-Yu Tsai, Will Deacon, Yong Wu,
Chunyan Zhang
Cc: Lu Baolu, Kevin Tian, patches, Niklas Schnelle, Sven Peter,
Tomasz Jeznach
These drivers all set the domain->pgsize_bitmap in their
domain_alloc_paging() functions, so the ops value is never used. Delete
it.
Reviewed-by: Sven Peter <sven@svenpeter.dev> # for Apple DART
Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: Tomasz Jeznach <tjeznach@rivosinc.com> # for RISC-V
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 7aa3932251b2fd..68b695953c57ec 100644
--- a/drivers/iommu/intel/iommu.c
+++ b/drivers/iommu/intel/iommu.c
@@ -4365,7 +4365,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] 19+ messages in thread
* [PATCH v2 4/7] iommu: Remove iommu_ops pgsize_bitmap from simple drivers
2025-06-09 20:41 [PATCH v2 0/7] Remove ops.pgsize_bitmap Jason Gunthorpe
` (2 preceding siblings ...)
2025-06-09 20:41 ` [PATCH v2 3/7] iommu: Remove ops.pgsize_bitmap from drivers that don't use it Jason Gunthorpe
@ 2025-06-09 20:41 ` Jason Gunthorpe
2025-06-10 3:47 ` Chen-Yu Tsai
` (3 more replies)
2025-06-09 20:41 ` [PATCH v2 5/7] iommu/mtk: Remove iommu_ops pgsize_bitmap Jason Gunthorpe
` (4 subsequent siblings)
8 siblings, 4 replies; 19+ messages in thread
From: Jason Gunthorpe @ 2025-06-09 20:41 UTC (permalink / raw)
To: 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, 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,
Krishna Reddy, virtualization, Chen-Yu Tsai, Will Deacon, Yong Wu,
Chunyan Zhang
Cc: Lu Baolu, Kevin Tian, patches, Niklas Schnelle, Sven Peter,
Tomasz Jeznach
These drivers just have a constant value for their page size, move it
into their domain_alloc_paging function before setting up the geometry.
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Acked-by: Niklas Schnelle <schnelle@linux.ibm.com> # for s390-iommu.c
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] 19+ messages in thread
* [PATCH v2 5/7] iommu/mtk: Remove iommu_ops pgsize_bitmap
2025-06-09 20:41 [PATCH v2 0/7] Remove ops.pgsize_bitmap Jason Gunthorpe
` (3 preceding siblings ...)
2025-06-09 20:41 ` [PATCH v2 4/7] iommu: Remove iommu_ops pgsize_bitmap from simple drivers Jason Gunthorpe
@ 2025-06-09 20:41 ` Jason Gunthorpe
2025-06-11 9:40 ` AngeloGioacchino Del Regno
2025-06-09 20:41 ` [PATCH v2 6/7] iommu/qcom: " Jason Gunthorpe
` (3 subsequent siblings)
8 siblings, 1 reply; 19+ messages in thread
From: Jason Gunthorpe @ 2025-06-09 20:41 UTC (permalink / raw)
To: 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, 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,
Krishna Reddy, virtualization, Chen-Yu Tsai, Will Deacon, Yong Wu,
Chunyan Zhang
Cc: Lu Baolu, Kevin Tian, patches, Niklas Schnelle, Sven Peter,
Tomasz Jeznach
This driver just uses a constant, put it in domain_alloc_paging
and use the domain's value instead of ops during finalise.
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
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 cb95fecf6016d5..0e0285348d2b8e 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] 19+ messages in thread
* [PATCH v2 6/7] iommu/qcom: Remove iommu_ops pgsize_bitmap
2025-06-09 20:41 [PATCH v2 0/7] Remove ops.pgsize_bitmap Jason Gunthorpe
` (4 preceding siblings ...)
2025-06-09 20:41 ` [PATCH v2 5/7] iommu/mtk: Remove iommu_ops pgsize_bitmap Jason Gunthorpe
@ 2025-06-09 20:41 ` Jason Gunthorpe
2025-06-09 20:41 ` [PATCH v2 7/7] iommu: Remove ops->pgsize_bitmap Jason Gunthorpe
` (2 subsequent siblings)
8 siblings, 0 replies; 19+ messages in thread
From: Jason Gunthorpe @ 2025-06-09 20:41 UTC (permalink / raw)
To: 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, 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,
Krishna Reddy, virtualization, Chen-Yu Tsai, Will Deacon, Yong Wu,
Chunyan Zhang
Cc: Lu Baolu, Kevin Tian, patches, Niklas Schnelle, Sven Peter,
Tomasz Jeznach
This driver just uses a constant, put it in domain_alloc_paging
and use the domain's value instead of ops during init_domain.
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
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] 19+ messages in thread
* [PATCH v2 7/7] iommu: Remove ops->pgsize_bitmap
2025-06-09 20:41 [PATCH v2 0/7] Remove ops.pgsize_bitmap Jason Gunthorpe
` (5 preceding siblings ...)
2025-06-09 20:41 ` [PATCH v2 6/7] iommu/qcom: " Jason Gunthorpe
@ 2025-06-09 20:41 ` Jason Gunthorpe
2025-06-27 8:28 ` Joerg Roedel
2025-06-09 22:45 ` [PATCH v2 0/7] Remove ops.pgsize_bitmap Nicolin Chen
2025-06-27 6:56 ` Joerg Roedel
8 siblings, 1 reply; 19+ messages in thread
From: Jason Gunthorpe @ 2025-06-09 20:41 UTC (permalink / raw)
To: 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, 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,
Krishna Reddy, virtualization, Chen-Yu Tsai, Will Deacon, Yong Wu,
Chunyan Zhang
Cc: Lu Baolu, Kevin Tian, patches, Niklas Schnelle, Sven Peter,
Tomasz Jeznach
No driver uses it now, remove the core code.
Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
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 a4b606c591da66..060ebe330ee163 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 1567328079945f..7073be1d88415b 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -604,7 +604,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.
@@ -659,7 +658,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] 19+ messages in thread
* Re: [PATCH v2 1/7] qiommu/arm-smmu-v3: Remove iommu_ops pgsize_bitmap
2025-06-09 20:41 ` [PATCH v2 1/7] qiommu/arm-smmu-v3: Remove iommu_ops pgsize_bitmap Jason Gunthorpe
@ 2025-06-09 22:15 ` Nicolin Chen
2025-06-09 23:11 ` Jason Gunthorpe
0 siblings, 1 reply; 19+ messages in thread
From: Nicolin Chen @ 2025-06-09 22:15 UTC (permalink / raw)
To: Jason Gunthorpe
Cc: 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, 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,
Krishna Reddy, virtualization, Chen-Yu Tsai, Will Deacon, Yong Wu,
Chunyan Zhang, Lu Baolu, Kevin Tian, patches, Niklas Schnelle,
Sven Peter, Tomasz Jeznach
On Mon, Jun 09, 2025 at 05:41:25PM -0300, Jason Gunthorpe wrote:
> 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.
>
> Reviewed-by: Kevin Tian <kevin.tian@intel.com>
> Acked-by: Will Deacon <will@kernel.org>
> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
Is "qiommu" a typo in the subject?
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v2 0/7] Remove ops.pgsize_bitmap
2025-06-09 20:41 [PATCH v2 0/7] Remove ops.pgsize_bitmap Jason Gunthorpe
` (6 preceding siblings ...)
2025-06-09 20:41 ` [PATCH v2 7/7] iommu: Remove ops->pgsize_bitmap Jason Gunthorpe
@ 2025-06-09 22:45 ` Nicolin Chen
2025-06-27 6:56 ` Joerg Roedel
8 siblings, 0 replies; 19+ messages in thread
From: Nicolin Chen @ 2025-06-09 22:45 UTC (permalink / raw)
To: Jason Gunthorpe
Cc: 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, 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,
Krishna Reddy, virtualization, Chen-Yu Tsai, Will Deacon, Yong Wu,
Chunyan Zhang, Lu Baolu, Kevin Tian, patches, Niklas Schnelle,
Sven Peter, Tomasz Jeznach
On Mon, Jun 09, 2025 at 05:41:24PM -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.
>
> v2:
> - Rebase on v6.16-rc1
Sanity tests with SMMUv3 look good.
Tested-by: Nicolin Chen <nicolinc@nvidia.com>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v2 1/7] qiommu/arm-smmu-v3: Remove iommu_ops pgsize_bitmap
2025-06-09 22:15 ` Nicolin Chen
@ 2025-06-09 23:11 ` Jason Gunthorpe
0 siblings, 0 replies; 19+ messages in thread
From: Jason Gunthorpe @ 2025-06-09 23:11 UTC (permalink / raw)
To: Nicolin Chen
Cc: 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, 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,
Krishna Reddy, virtualization, Chen-Yu Tsai, Will Deacon, Yong Wu,
Chunyan Zhang, Lu Baolu, Kevin Tian, patches, Niklas Schnelle,
Sven Peter, Tomasz Jeznach
On Mon, Jun 09, 2025 at 03:15:47PM -0700, Nicolin Chen wrote:
> On Mon, Jun 09, 2025 at 05:41:25PM -0300, Jason Gunthorpe wrote:
> > 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.
> >
> > Reviewed-by: Kevin Tian <kevin.tian@intel.com>
> > Acked-by: Will Deacon <will@kernel.org>
> > Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
>
> Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
>
> Is "qiommu" a typo in the subject?
Yeah
Thanks,
Jason
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v2 4/7] iommu: Remove iommu_ops pgsize_bitmap from simple drivers
2025-06-09 20:41 ` [PATCH v2 4/7] iommu: Remove iommu_ops pgsize_bitmap from simple drivers Jason Gunthorpe
@ 2025-06-10 3:47 ` Chen-Yu Tsai
2025-06-10 9:11 ` Thierry Reding
` (2 subsequent siblings)
3 siblings, 0 replies; 19+ messages in thread
From: Chen-Yu Tsai @ 2025-06-10 3:47 UTC (permalink / raw)
To: Jason Gunthorpe
Cc: 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, 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,
Krishna Reddy, virtualization, Will Deacon, Yong Wu,
Chunyan Zhang, Lu Baolu, Kevin Tian, patches, Niklas Schnelle,
Sven Peter, Tomasz Jeznach
On Tue, Jun 10, 2025 at 4:41 AM Jason Gunthorpe <jgg@nvidia.com> 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.
>
> Reviewed-by: Kevin Tian <kevin.tian@intel.com>
> Acked-by: Niklas Schnelle <schnelle@linux.ibm.com> # for s390-iommu.c
> 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 ++-
Acked-by: Chen-Yu Tsai <wens@csie.org> # sun50i-iommu.c
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v2 4/7] iommu: Remove iommu_ops pgsize_bitmap from simple drivers
2025-06-09 20:41 ` [PATCH v2 4/7] iommu: Remove iommu_ops pgsize_bitmap from simple drivers Jason Gunthorpe
2025-06-10 3:47 ` Chen-Yu Tsai
@ 2025-06-10 9:11 ` Thierry Reding
2025-06-11 9:40 ` AngeloGioacchino Del Regno
2025-06-11 9:46 ` Marek Szyprowski
3 siblings, 0 replies; 19+ messages in thread
From: Thierry Reding @ 2025-06-10 9:11 UTC (permalink / raw)
To: Jason Gunthorpe
Cc: 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, 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, Krishna Reddy,
virtualization, Chen-Yu Tsai, Will Deacon, Yong Wu, Chunyan Zhang,
Lu Baolu, Kevin Tian, patches, Niklas Schnelle, Sven Peter,
Tomasz Jeznach
[-- Attachment #1: Type: text/plain, Size: 997 bytes --]
On Mon, Jun 09, 2025 at 05:41:28PM -0300, Jason Gunthorpe wrote:
[...]
> 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,
Acked-by: Thierry Reding <treding@nvidia.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v2 4/7] iommu: Remove iommu_ops pgsize_bitmap from simple drivers
2025-06-09 20:41 ` [PATCH v2 4/7] iommu: Remove iommu_ops pgsize_bitmap from simple drivers Jason Gunthorpe
2025-06-10 3:47 ` Chen-Yu Tsai
2025-06-10 9:11 ` Thierry Reding
@ 2025-06-11 9:40 ` AngeloGioacchino Del Regno
2025-06-11 9:46 ` Marek Szyprowski
3 siblings, 0 replies; 19+ messages in thread
From: AngeloGioacchino Del Regno @ 2025-06-11 9:40 UTC (permalink / raw)
To: Jason Gunthorpe, Alexandre Ghiti, Alim Akhtar, Alyssa Rosenzweig,
Albert Ou, asahi, Baolin Wang, David Woodhouse, Gerald Schaefer,
Heiko Stuebner, iommu, Janne Grunau, Jean-Philippe Brucker,
Jernej Skrabec, Jonathan Hunter, Joerg Roedel,
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, Krishna Reddy,
virtualization, Chen-Yu Tsai, Will Deacon, Yong Wu, Chunyan Zhang
Cc: Lu Baolu, Kevin Tian, patches, Niklas Schnelle, Sven Peter,
Tomasz Jeznach
Il 09/06/25 22:41, Jason Gunthorpe ha scritto:
> These drivers just have a constant value for their page size, move it
> into their domain_alloc_paging function before setting up the geometry.
>
> Reviewed-by: Kevin Tian <kevin.tian@intel.com>
> Acked-by: Niklas Schnelle <schnelle@linux.ibm.com> # for s390-iommu.c
> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
For MediaTek:
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v2 5/7] iommu/mtk: Remove iommu_ops pgsize_bitmap
2025-06-09 20:41 ` [PATCH v2 5/7] iommu/mtk: Remove iommu_ops pgsize_bitmap Jason Gunthorpe
@ 2025-06-11 9:40 ` AngeloGioacchino Del Regno
0 siblings, 0 replies; 19+ messages in thread
From: AngeloGioacchino Del Regno @ 2025-06-11 9:40 UTC (permalink / raw)
To: Jason Gunthorpe, Alexandre Ghiti, Alim Akhtar, Alyssa Rosenzweig,
Albert Ou, asahi, Baolin Wang, David Woodhouse, Gerald Schaefer,
Heiko Stuebner, iommu, Janne Grunau, Jean-Philippe Brucker,
Jernej Skrabec, Jonathan Hunter, Joerg Roedel,
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, Krishna Reddy,
virtualization, Chen-Yu Tsai, Will Deacon, Yong Wu, Chunyan Zhang
Cc: Lu Baolu, Kevin Tian, patches, Niklas Schnelle, Sven Peter,
Tomasz Jeznach
Il 09/06/25 22:41, Jason Gunthorpe ha scritto:
> This driver just uses a constant, put it in domain_alloc_paging
> and use the domain's value instead of ops during finalise.
>
> Reviewed-by: Kevin Tian <kevin.tian@intel.com>
> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v2 4/7] iommu: Remove iommu_ops pgsize_bitmap from simple drivers
2025-06-09 20:41 ` [PATCH v2 4/7] iommu: Remove iommu_ops pgsize_bitmap from simple drivers Jason Gunthorpe
` (2 preceding siblings ...)
2025-06-11 9:40 ` AngeloGioacchino Del Regno
@ 2025-06-11 9:46 ` Marek Szyprowski
3 siblings, 0 replies; 19+ messages in thread
From: Marek Szyprowski @ 2025-06-11 9:46 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, Krzysztof Kozlowski,
linux-arm-kernel, linux-arm-msm, linux-mediatek, linux-riscv,
linux-rockchip, linux-s390, linux-samsung-soc, linux-sunxi,
linux-tegra, Matthias Brugger, Matthew Rosato, Neal Gompa,
Orson Zhai, Palmer Dabbelt, Paul Walmsley, Rob Clark,
Robin Murphy, Samuel Holland, Sven Peter, Thierry Reding,
Krishna Reddy, virtualization, Chen-Yu Tsai, Will Deacon, Yong Wu,
Chunyan Zhang
Cc: Lu Baolu, Kevin Tian, patches, Niklas Schnelle, Sven Peter,
Tomasz Jeznach
On 09.06.2025 22:41, 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.
>
> Reviewed-by: Kevin Tian <kevin.tian@intel.com>
> Acked-by: Niklas Schnelle <schnelle@linux.ibm.com> # for s390-iommu.c
> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
> ---
> drivers/iommu/exynos-iommu.c | 3 ++-
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com> # for exynos-iommu.c
> 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,
Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v2 0/7] Remove ops.pgsize_bitmap
2025-06-09 20:41 [PATCH v2 0/7] Remove ops.pgsize_bitmap Jason Gunthorpe
` (7 preceding siblings ...)
2025-06-09 22:45 ` [PATCH v2 0/7] Remove ops.pgsize_bitmap Nicolin Chen
@ 2025-06-27 6:56 ` Joerg Roedel
8 siblings, 0 replies; 19+ messages in thread
From: Joerg Roedel @ 2025-06-27 6:56 UTC (permalink / raw)
To: Jason Gunthorpe
Cc: 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, 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,
Krishna Reddy, virtualization, Chen-Yu Tsai, Will Deacon, Yong Wu,
Chunyan Zhang, Lu Baolu, Kevin Tian, patches, Niklas Schnelle,
Sven Peter, Tomasz Jeznach
> Jason Gunthorpe (7):
> qiommu/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
Applied, thanks Jason.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v2 7/7] iommu: Remove ops->pgsize_bitmap
2025-06-09 20:41 ` [PATCH v2 7/7] iommu: Remove ops->pgsize_bitmap Jason Gunthorpe
@ 2025-06-27 8:28 ` Joerg Roedel
2025-06-27 12:59 ` Jason Gunthorpe
0 siblings, 1 reply; 19+ messages in thread
From: Joerg Roedel @ 2025-06-27 8:28 UTC (permalink / raw)
To: Jason Gunthorpe
Cc: 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, 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,
Krishna Reddy, virtualization, Chen-Yu Tsai, Will Deacon, Yong Wu,
Chunyan Zhang, Lu Baolu, Kevin Tian, patches, Niklas Schnelle,
Sven Peter, Tomasz Jeznach
Hi Jason,
On Mon, Jun 09, 2025 at 05:41:31PM -0300, Jason Gunthorpe wrote:
> No driver uses it now, remove the core code.
That is actually not true, the MSM driver still uses it, and this patch breaks
my arm32 compile tests. Please send a fix for this driver so that I can put it
on-top.
Regards,
Joerg
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v2 7/7] iommu: Remove ops->pgsize_bitmap
2025-06-27 8:28 ` Joerg Roedel
@ 2025-06-27 12:59 ` Jason Gunthorpe
0 siblings, 0 replies; 19+ messages in thread
From: Jason Gunthorpe @ 2025-06-27 12:59 UTC (permalink / raw)
To: Joerg Roedel
Cc: 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, 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,
Krishna Reddy, virtualization, Chen-Yu Tsai, Will Deacon, Yong Wu,
Chunyan Zhang, Lu Baolu, Kevin Tian, patches, Niklas Schnelle,
Sven Peter, Tomasz Jeznach
On Fri, Jun 27, 2025 at 10:28:28AM +0200, Joerg Roedel wrote:
> Hi Jason,
>
> On Mon, Jun 09, 2025 at 05:41:31PM -0300, Jason Gunthorpe wrote:
> > No driver uses it now, remove the core code.
>
> That is actually not true, the MSM driver still uses it, and this patch breaks
> my arm32 compile tests. Please send a fix for this driver so that I can put it
> on-top.
I'm really surprised the build bot didn't catch this, I'm sure it ran
on this series. I notice msm is not in the arm32 defconfig, maybe that
is why.
Jason
^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2025-06-27 12:59 UTC | newest]
Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-09 20:41 [PATCH v2 0/7] Remove ops.pgsize_bitmap Jason Gunthorpe
2025-06-09 20:41 ` [PATCH v2 1/7] qiommu/arm-smmu-v3: Remove iommu_ops pgsize_bitmap Jason Gunthorpe
2025-06-09 22:15 ` Nicolin Chen
2025-06-09 23:11 ` Jason Gunthorpe
2025-06-09 20:41 ` [PATCH v2 2/7] iommu/arm-smmu: " Jason Gunthorpe
2025-06-09 20:41 ` [PATCH v2 3/7] iommu: Remove ops.pgsize_bitmap from drivers that don't use it Jason Gunthorpe
2025-06-09 20:41 ` [PATCH v2 4/7] iommu: Remove iommu_ops pgsize_bitmap from simple drivers Jason Gunthorpe
2025-06-10 3:47 ` Chen-Yu Tsai
2025-06-10 9:11 ` Thierry Reding
2025-06-11 9:40 ` AngeloGioacchino Del Regno
2025-06-11 9:46 ` Marek Szyprowski
2025-06-09 20:41 ` [PATCH v2 5/7] iommu/mtk: Remove iommu_ops pgsize_bitmap Jason Gunthorpe
2025-06-11 9:40 ` AngeloGioacchino Del Regno
2025-06-09 20:41 ` [PATCH v2 6/7] iommu/qcom: " Jason Gunthorpe
2025-06-09 20:41 ` [PATCH v2 7/7] iommu: Remove ops->pgsize_bitmap Jason Gunthorpe
2025-06-27 8:28 ` Joerg Roedel
2025-06-27 12:59 ` Jason Gunthorpe
2025-06-09 22:45 ` [PATCH v2 0/7] Remove ops.pgsize_bitmap Nicolin Chen
2025-06-27 6:56 ` Joerg Roedel
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).