[PATCH 4/7] iommu: Remove iommu_ops pgsize_bitmap from simple drivers
Niklas Schnelle
schnelle at linux.ibm.com
Wed Apr 30 06:15:14 PDT 2025
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 at 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 at linux.ibm.com> # for s390-iommu.c
> diff --git a/drivers/iommu/sprd-iommu.c b/drivers/iommu/sprd-iommu.c
--- snip ---
More information about the Linux-mediatek
mailing list