mbox series

[v2,0/7] Remove ops.pgsize_bitmap

Message ID 0-v2-68a2e1ba507c+1fb-iommu_rm_ops_pgsize_jgg@nvidia.com
Headers show
Series Remove ops.pgsize_bitmap | expand

Message

Jason Gunthorpe June 9, 2025, 8:41 p.m. UTC
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

Comments

Nicolin Chen June 9, 2025, 10:15 p.m. UTC | #1
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?
Jason Gunthorpe June 9, 2025, 11:11 p.m. UTC | #2
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