[PATCH v3 01/32] iommu: introduce iova_to_phys_length in iommu_domain_ops
Baolu Lu
baolu.lu at linux.intel.com
Wed Jun 3 19:44:46 PDT 2026
On 6/3/26 23:17, Guanghui Feng wrote:
> Add iova_to_phys_length callback to struct iommu_domain_ops alongside
> the existing iova_to_phys. The new callback returns both the physical
> address and the PTE mapping page size in a single page table walk.
>
> Add iommu_iova_to_phys_length() core function that:
> - Checks ops->iova_to_phys_length first (preferred path)
> - Falls back to ops->iova_to_phys for unmigrated drivers
>
> This enables callers like VFIO to efficiently traverse IOVA space
> by actual mapping granularity instead of fixed PAGE_SIZE steps.
>
> Signed-off-by: Guanghui Feng<guanghuifeng at linux.alibaba.com>
> Acked-by: Shiqiang Zhang<shiyu.zsq at linux.alibaba.com>
> Acked-by: Simon Guo<wei.guo.simon at linux.alibaba.com>
> ---
> drivers/iommu/iommu.c | 50 ++++++++++++++++++++++++++++++++++++++-----
> include/linux/iommu.h | 9 ++++++++
> 2 files changed, 54 insertions(+), 5 deletions(-)
Reviewed-by: Lu Baolu <baolu.lu at linux.intel.com>
More information about the linux-arm-kernel
mailing list