[PATCH 2/2] drivers/arm-smmu-v3: Implement .iotlb_sync_map callback

Daniel Mentz
2025-09-27T22:40:13Z

Implement .iotlb_sync_map callback based on the new callback in the
io-pgtable code.

Signed-off-by: Daniel Mentz <danielmentz@google.com>
---
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)

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 2a8b46b948f0..0ffcc6c8e4bf 100644
--- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
+++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
@@ -2541,6 +2541,7 @@ static int arm_smmu_domain_finalise(struct arm_smmu_domain *smmu_domain,
pgtbl_cfg = (struct io_pgtable_cfg) {
.pgsize_bitmap = smmu->pgsize_bitmap,
.coherent_walk = smmu->features & ARM_SMMU_FEAT_COHERENCY,
+ .defer_sync_pte = true,
.tlb = &arm_smmu_flush_ops,
.iommu_dev = smmu->dev,
};
@@ -3366,6 +3367,18 @@ static int arm_smmu_map_pages(struct iommu_domain *domain, unsigned long iova,
return ops->map_pages(ops, iova, paddr, pgsize, pgcount, prot, gfp, mapped);
}

+static int arm_smmu_iotlb_sync_map(struct iommu_domain *domain,
+ unsigned long iova, size_t size)
+{
+ struct io_pgtable_ops *ops = to_smmu_domain(domain)->pgtbl_ops;
+
+ if (!ops || !ops->iotlb_sync_map)
+ return 0;
+
+ ops->iotlb_sync_map(ops, iova, size);
+ return 0;
+}
+
static size_t arm_smmu_unmap_pages(struct iommu_domain *domain, unsigned long iova,
size_t pgsize, size_t pgcount,
struct iommu_iotlb_gather *gather)
@@ -3700,6 +3713,7 @@ static const struct iommu_ops arm_smmu_ops = {
.map_pages = arm_smmu_map_pages,
.unmap_pages = arm_smmu_unmap_pages,
.flush_iotlb_all = arm_smmu_flush_iotlb_all,
+ .iotlb_sync_map = arm_smmu_iotlb_sync_map,
.iotlb_sync = arm_smmu_iotlb_sync,
.iova_to_phys = arm_smmu_iova_to_phys,
.free = arm_smmu_domain_free_paging,
--
2.51.0.570.gb178f27e6d-goog