Re: [PATCH v2 10/30] iommu/ipmmu-vmsa: implement iova_to_phys_length

From: Jason Gunthorpe

Date: Tue Jun 02 2026 - 21:16:04 EST


On Tue, Jun 02, 2026 at 06:46:17PM +0800, Guanghui Feng wrote:
> Migrate IPMMU-VMSA to implement iova_to_phys_length, passing through
> mapped_length from io-pgtable.
>
> Signed-off-by: Guanghui Feng <guanghuifeng@xxxxxxxxxxxxxxxxx>
> ---
> drivers/iommu/ipmmu-vmsa.c | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c
> index 9386b752dea2..a1b659ddbdb5 100644
> --- a/drivers/iommu/ipmmu-vmsa.c
> +++ b/drivers/iommu/ipmmu-vmsa.c
> @@ -699,14 +699,18 @@ static void ipmmu_iotlb_sync(struct iommu_domain *io_domain,
> ipmmu_flush_iotlb_all(io_domain);
> }
>
> -static phys_addr_t ipmmu_iova_to_phys(struct iommu_domain *io_domain,
> - dma_addr_t iova)
> +static phys_addr_t ipmmu_iova_to_phys_length(struct iommu_domain *io_domain,
> + dma_addr_t iova, size_t *mapped_length)
> {
> struct ipmmu_vmsa_domain *domain = to_vmsa_domain(io_domain);
>
> + if (mapped_length)
> + *mapped_length = 0;

Why?

Jason