[PATCH 8/9] drm/gpu, iommu/io-pgtable: switch to iova_to_phys_length

From: Guanghui Feng

Date: Sun May 31 2026 - 05:41:54 EST


Migrate remaining callers of io_pgtable_ops.iova_to_phys:
- panthor_mmu: use ops->iova_to_phys_length(ops, iova, NULL)
- panfrost_mmu: same
- io-pgtable selftests: use iova_to_phys_length with NULL

Signed-off-by: Guanghui Feng <guanghuifeng@xxxxxxxxxxxxxxxxx>
Acked-by: Shiqiang Zhang <shiyu.zsq@xxxxxxxxxxxxxxxxx>
Acked-by: Simon Guo <wei.guo.simon@xxxxxxxxxxxxxxxxx>
---
drivers/gpu/drm/panfrost/panfrost_mmu.c | 2 +-
drivers/gpu/drm/panthor/panthor_mmu.c | 2 +-
drivers/iommu/io-pgtable-arm-selftests.c | 12 ++++++------
3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/panfrost/panfrost_mmu.c b/drivers/gpu/drm/panfrost/panfrost_mmu.c
index 4a3162c3b659..b7c420eb76ec 100644
--- a/drivers/gpu/drm/panfrost/panfrost_mmu.c
+++ b/drivers/gpu/drm/panfrost/panfrost_mmu.c
@@ -514,7 +514,7 @@ void panfrost_mmu_unmap(struct panfrost_gem_mapping *mapping)

if (bo->is_heap)
pgcount = 1;
- if (!bo->is_heap || ops->iova_to_phys(ops, iova)) {
+ if (!bo->is_heap || ops->iova_to_phys_length(ops, iova, NULL)) {
unmapped_page = ops->unmap_pages(ops, iova, pgsize, pgcount, NULL);
WARN_ON(unmapped_page != pgsize * pgcount);
}
diff --git a/drivers/gpu/drm/panthor/panthor_mmu.c b/drivers/gpu/drm/panthor/panthor_mmu.c
index 75d98dad7b1d..05bc7ec95931 100644
--- a/drivers/gpu/drm/panthor/panthor_mmu.c
+++ b/drivers/gpu/drm/panthor/panthor_mmu.c
@@ -903,7 +903,7 @@ static void panthor_vm_unmap_pages(struct panthor_vm *vm, u64 iova, u64 size)
* are out-of-sync. This is not supposed to happen, hence the
* above WARN_ON().
*/
- while (!ops->iova_to_phys(ops, iova + unmapped_sz) &&
+ while (!ops->iova_to_phys_length(ops, iova + unmapped_sz, NULL) &&
unmapped_sz < pgsize * pgcount)
unmapped_sz += SZ_4K;

diff --git a/drivers/iommu/io-pgtable-arm-selftests.c b/drivers/iommu/io-pgtable-arm-selftests.c
index 334e70350924..d1d0529f711d 100644
--- a/drivers/iommu/io-pgtable-arm-selftests.c
+++ b/drivers/iommu/io-pgtable-arm-selftests.c
@@ -72,13 +72,13 @@ static int arm_lpae_run_tests(struct kunit *test, struct io_pgtable_cfg *cfg)
* Initial sanity checks.
* Empty page tables shouldn't provide any translations.
*/
- if (ops->iova_to_phys(ops, 42))
+ if (ops->iova_to_phys_length(ops, 42, NULL))
return __FAIL(test, i);

- if (ops->iova_to_phys(ops, SZ_1G + 42))
+ if (ops->iova_to_phys_length(ops, SZ_1G + 42, NULL))
return __FAIL(test, i);

- if (ops->iova_to_phys(ops, SZ_2G + 42))
+ if (ops->iova_to_phys_length(ops, SZ_2G + 42, NULL))
return __FAIL(test, i);

/*
@@ -100,7 +100,7 @@ static int arm_lpae_run_tests(struct kunit *test, struct io_pgtable_cfg *cfg)
GFP_KERNEL, &mapped))
return __FAIL(test, i);

- if (ops->iova_to_phys(ops, iova + 42) != (iova + 42))
+ if (ops->iova_to_phys_length(ops, iova + 42, NULL) != (iova + 42))
return __FAIL(test, i);

iova += SZ_1G;
@@ -114,7 +114,7 @@ static int arm_lpae_run_tests(struct kunit *test, struct io_pgtable_cfg *cfg)
if (ops->unmap_pages(ops, iova, size, 1, NULL) != size)
return __FAIL(test, i);

- if (ops->iova_to_phys(ops, iova + 42))
+ if (ops->iova_to_phys_length(ops, iova + 42, NULL))
return __FAIL(test, i);

/* Remap full block */
@@ -122,7 +122,7 @@ static int arm_lpae_run_tests(struct kunit *test, struct io_pgtable_cfg *cfg)
IOMMU_WRITE, GFP_KERNEL, &mapped))
return __FAIL(test, i);

- if (ops->iova_to_phys(ops, iova + 42) != (iova + 42))
+ if (ops->iova_to_phys_length(ops, iova + 42, NULL) != (iova + 42))
return __FAIL(test, i);

iova += SZ_1G;
--
2.43.7