RE: [PATCH v7 4/6] iommufd: Add an ioctl to query PA from IOVA for noiommu mode

From: Tian, Kevin

Date: Wed Jun 03 2026 - 02:35:17 EST


> From: Jacob Pan <jacob.pan@xxxxxxxxxxxxxxxxxxx>
> Sent: Wednesday, June 3, 2026 1:45 PM
>
> To support no-IOMMU mode where userspace drivers perform unsafe DMA
> using physical addresses, introduce a new API to retrieve the
> physical address of a user-allocated DMA buffer that has been mapped to
> an IOVA via IOMMU_IOAS_MAP. The mapping is backed by SW-only I/O page
> tables maintained by the generic IOMMUPT framework.

s/generic IOMMUPT/GENERIC_PT/

> +/**
> + * 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
> + * @length: On input, maximum number of bytes to scan for contiguity (0
> means
> + * no limit). On output, actual number of contiguous bytes starting
> + * from out_phys.
> + * @out_phys: Output physical address the IOVA maps to
> + *
> + * Query the physical address backing an IOVA range. The entire range must
> be
> + * mapped already. For noiommu devices doing unsafe DMA only.
> + */

only the starting IOVA must be mapped in the range.

Reviewed-by: Kevin Tian <kevin.tian@xxxxxxxxx>