[PATCH v3 11/32] iommu/mtk_iommu: implement iova_to_phys_length
Guanghui Feng
guanghuifeng at linux.alibaba.com
Wed Jun 3 08:17:43 PDT 2026
Migrate MediaTek IOMMU to implement iova_to_phys_length, passing through
mapped_length from io-pgtable.
Signed-off-by: Guanghui Feng <guanghuifeng at linux.alibaba.com>
---
drivers/iommu/mtk_iommu.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
index 2be990c108de..6ca31f8d4d96 100644
--- a/drivers/iommu/mtk_iommu.c
+++ b/drivers/iommu/mtk_iommu.c
@@ -858,13 +858,16 @@ static int mtk_iommu_sync_map(struct iommu_domain *domain, unsigned long iova,
return 0;
}
-static phys_addr_t mtk_iommu_iova_to_phys(struct iommu_domain *domain,
- dma_addr_t iova)
+static phys_addr_t mtk_iommu_iova_to_phys_length(struct iommu_domain *domain,
+ dma_addr_t iova, size_t *mapped_length)
{
struct mtk_iommu_domain *dom = to_mtk_domain(domain);
phys_addr_t pa;
- pa = dom->iop->iova_to_phys(dom->iop, iova);
+ pa = dom->iop->iova_to_phys_length(dom->iop, iova, mapped_length);
+ if (pa == PHYS_ADDR_MAX)
+ return PHYS_ADDR_MAX;
+
if (IS_ENABLED(CONFIG_PHYS_ADDR_T_64BIT) &&
dom->bank->parent_data->enable_4GB &&
pa >= MTK_IOMMU_4GB_MODE_REMAP_BASE)
@@ -1070,7 +1073,7 @@ static const struct iommu_ops mtk_iommu_ops = {
.flush_iotlb_all = mtk_iommu_flush_iotlb_all,
.iotlb_sync = mtk_iommu_iotlb_sync,
.iotlb_sync_map = mtk_iommu_sync_map,
- .iova_to_phys = mtk_iommu_iova_to_phys,
+ .iova_to_phys_length = mtk_iommu_iova_to_phys_length,
.free = mtk_iommu_domain_free,
}
};
--
2.43.7
More information about the linux-arm-kernel
mailing list