[PATCH v2 08/30] iommu/qcom_iommu: implement iova_to_phys_length

From: Guanghui Feng

Date: Tue Jun 02 2026 - 06:54:11 EST


Migrate Qualcomm IOMMU to implement iova_to_phys_length, calling
ops->iova_to_phys_length on the io-pgtable layer.

Signed-off-by: Guanghui Feng <guanghuifeng@xxxxxxxxxxxxxxxxx>
---
drivers/iommu/arm/arm-smmu/qcom_iommu.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/iommu/arm/arm-smmu/qcom_iommu.c b/drivers/iommu/arm/arm-smmu/qcom_iommu.c
index a1e8cf29f594..b36e31509c91 100644
--- a/drivers/iommu/arm/arm-smmu/qcom_iommu.c
+++ b/drivers/iommu/arm/arm-smmu/qcom_iommu.c
@@ -489,19 +489,22 @@ static void qcom_iommu_iotlb_sync(struct iommu_domain *domain,
qcom_iommu_flush_iotlb_all(domain);
}

-static phys_addr_t qcom_iommu_iova_to_phys(struct iommu_domain *domain,
- dma_addr_t iova)
+static phys_addr_t qcom_iommu_iova_to_phys_length(struct iommu_domain *domain,
+ dma_addr_t iova, size_t *mapped_length)
{
phys_addr_t ret;
unsigned long flags;
struct qcom_iommu_domain *qcom_domain = to_qcom_iommu_domain(domain);
struct io_pgtable_ops *ops = qcom_domain->pgtbl_ops;

+ if (mapped_length)
+ *mapped_length = 0;
+
if (!ops)
- return 0;
+ return PHYS_ADDR_MAX;

spin_lock_irqsave(&qcom_domain->pgtbl_lock, flags);
- ret = ops->iova_to_phys(ops, iova);
+ ret = ops->iova_to_phys_length(ops, iova, mapped_length);
spin_unlock_irqrestore(&qcom_domain->pgtbl_lock, flags);

return ret;
@@ -602,7 +605,7 @@ static const struct iommu_ops qcom_iommu_ops = {
.unmap_pages = qcom_iommu_unmap,
.flush_iotlb_all = qcom_iommu_flush_iotlb_all,
.iotlb_sync = qcom_iommu_iotlb_sync,
- .iova_to_phys = qcom_iommu_iova_to_phys,
+ .iova_to_phys_length = qcom_iommu_iova_to_phys_length,
.free = qcom_iommu_domain_free,
}
};
--
2.43.7