]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
iommu/arm-smmu-v3: Add arm_smmu_invs based arm_smmu_domain_inv_range()
authorNicolin Chen <nicolinc@nvidia.com>
Tue, 17 Mar 2026 07:59:22 +0000 (00:59 -0700)
committerWill Deacon <will@kernel.org>
Thu, 19 Mar 2026 15:08:22 +0000 (15:08 +0000)
commit587bb3e56a2c37bbd58efff24e56fe7dae472199
tree9291750dffe5ad78c4f914930b055f302be7e526
parentb77429757e4501e00f62cd4328bcfe6a9dbbf65e
iommu/arm-smmu-v3: Add arm_smmu_invs based arm_smmu_domain_inv_range()

Each smmu_domain now has an arm_smmu_invs that specifies the invalidation
steps to perform after any change the IOPTEs. This includes supports for
basic ASID/VMID, the special case for nesting, and ATC invalidations.

Introduce a new arm_smmu_domain_inv helper iterating smmu_domain->invs to
convert the invalidation array to commands. Any invalidation request with
no size specified means an entire flush over a range based one.

Take advantage of the sorted array to compatible batch operations together
to the same SMMU. For instance, ATC invaliations for multiple SIDs can be
pushed as a batch.

ATC invalidations must be completed before the driver disables ATS. Or the
device is permitted to ignore any racing invalidation that would cause an
SMMU timeout. The sequencing is done with a rwlock where holding the write
side of the rwlock means that there are no outstanding ATC invalidations.
If ATS is not used the rwlock is ignored, similar to the existing code.

Co-developed-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
Signed-off-by: Will Deacon <will@kernel.org>
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h