[PATCH v2 30/30] iommu: remove iova_to_phys from domain_ops and io_pgtable_ops
From: Guanghui Feng
Date: Tue Jun 02 2026 - 07:02:12 EST
Now that all drivers implement iova_to_phys_length and all callers
have migrated, remove the deprecated interfaces:
- Remove .iova_to_phys from struct iommu_domain_ops
- Remove .iova_to_phys from struct io_pgtable_ops
- Remove fallback path in iommu_iova_to_phys_length()
- iommu_iova_to_phys() remains as a thin wrapper calling _length with NULL
Signed-off-by: Guanghui Feng <guanghuifeng@xxxxxxxxxxxxxxxxx>
---
drivers/iommu/iommu.c | 12 ++----------
include/linux/io-pgtable.h | 3 ---
include/linux/iommu.h | 3 ---
3 files changed, 2 insertions(+), 16 deletions(-)
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index 1b1aaa53dd16..84893d4c7c60 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -2554,7 +2554,7 @@ EXPORT_SYMBOL_GPL(iommu_detach_group);
* Like iommu_iova_to_phys() but additionally returns the page size of the
* PTE mapping at @iova through @mapped_length.
*
- * Return: The physical address for the given IOVA, or PHYS_ADDR_MAX if no translation.
+ * Return: The physical address for the given IOVA, or 0 if no translation.
*/
phys_addr_t iommu_iova_to_phys_length(struct iommu_domain *domain,
dma_addr_t iova,
@@ -2566,16 +2566,8 @@ phys_addr_t iommu_iova_to_phys_length(struct iommu_domain *domain,
if (domain->type == IOMMU_DOMAIN_IDENTITY)
return iova;
- if (!domain->ops->iova_to_phys_length) {
- /* Fallback to legacy iova_to_phys without length info */
- if (domain->ops->iova_to_phys) {
- phys_addr_t phys = domain->ops->iova_to_phys(domain, iova);
- if (phys && mapped_length)
- *mapped_length = PAGE_SIZE;
- return phys ? phys : PHYS_ADDR_MAX;
- }
+ if (!domain->ops->iova_to_phys_length)
return PHYS_ADDR_MAX;
- }
return domain->ops->iova_to_phys_length(domain, iova, mapped_length);
}
diff --git a/include/linux/io-pgtable.h b/include/linux/io-pgtable.h
index 42bcdd309b88..c595f5b51e61 100644
--- a/include/linux/io-pgtable.h
+++ b/include/linux/io-pgtable.h
@@ -202,7 +202,6 @@ struct arm_lpae_io_pgtable_walk_data {
*
* @map_pages: Map a physically contiguous range of pages of the same size.
* @unmap_pages: Unmap a range of virtually contiguous pages of the same size.
- * @iova_to_phys: Translate iova to physical address.
* @iova_to_phys_length: Translate iova to physical address and return the
* remaining mapped length from iova to the end of the
* mapping entry via @mapped_length. If @mapped_length is
@@ -222,8 +221,6 @@ struct io_pgtable_ops {
size_t (*unmap_pages)(struct io_pgtable_ops *ops, unsigned long iova,
size_t pgsize, size_t pgcount,
struct iommu_iotlb_gather *gather);
- phys_addr_t (*iova_to_phys)(struct io_pgtable_ops *ops,
- unsigned long iova);
phys_addr_t (*iova_to_phys_length)(struct io_pgtable_ops *ops,
unsigned long iova,
size_t *mapped_length);
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index 19da84c2922c..ca585647180b 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -746,7 +746,6 @@ struct iommu_ops {
* array->entry_num to report the number of handled
* invalidation requests. The driver data structure
* must be defined in include/uapi/linux/iommufd.h
- * @iova_to_phys: translate iova to physical address
* @iova_to_phys_length: translate iova to physical address and additionally
* return the page size of the PTE mapping at @iova
* through @mapped_length.
@@ -777,8 +776,6 @@ struct iommu_domain_ops {
int (*cache_invalidate_user)(struct iommu_domain *domain,
struct iommu_user_data_array *array);
- phys_addr_t (*iova_to_phys)(struct iommu_domain *domain,
- dma_addr_t iova);
phys_addr_t (*iova_to_phys_length)(struct iommu_domain *domain,
dma_addr_t iova,
size_t *mapped_length);
--
2.43.7