Re: [PATCH v5 5/9] iommufd: Add an ioctl to query PA from IOVA for noiommu mode
From: Jason Gunthorpe
Date: Wed May 13 2026 - 08:22:38 EST
On Wed, May 13, 2026 at 03:53:43PM +0800, Baolu Lu wrote:
> > #define IOMMU_IOAS_MAP _IO(IOMMUFD_TYPE, IOMMUFD_CMD_IOAS_MAP)
> > +/**
> > + * struct iommu_ioas_noiommu_get_pa - ioctl(IOMMU_IOAS_NOIOMMU_GET_PA)
> > + * @size: sizeof(struct iommu_ioas_noiommu_get_pa)
> > + * @flags: Reserved, must be 0 for now
> > + * @ioas_id: IOAS ID to query IOVA to PA mapping from
> > + * @__reserved: Must be 0
> > + * @iova: IOVA to query
> > + * @out_length: Number of bytes contiguous physical address starting from phys
>
> Nit: Instead of making this behavior mandatory, would it be valuable to
> allocate a bit in @flags to toggle this behavior? For extremely large
> mappings (e.g., several GBs of contiguous hugepages), the loop to
> determine the contiguous physical addresses might take a long time. A
> very long scan could theoretically delay userspace DMA setup.
If we are worrying about that then a iova/length pair would be
appropriate such that out_len doesn't exceed the length. Right now it
stops at the area boundary IIRC.
Jason