On Fri, Nov 07, 2025 at 12:49:33PM -0400, Jason Gunthorpe wrote:
> This function is used to establish the "private interconnect" between the
> VFIO DMABUF exporter and the iommufd DMABUF importer. This is intended to
> be a temporary API until the core DMABUF interface is improved to natively
> support a private interconnect and revocable negotiation.
>
> This function should only be called by iommufd when trying to map a
> DMABUF. For now iommufd will only support VFIO DMABUFs.
>
> The following improvements are needed in the DMABUF API to generically
> support more exporters with iommufd/kvm type importers that cannot use the
> DMA API:
>
> 1) Revoke semantics. VFIO needs to be able to prevent access to the MMIO
> during FLR, and so it will use dma_buf_move_notify() to prevent
> access. iommmufd does not support fault handling so it cannot
> implement the full move_notify. Instead if revoke is negotiated the
> exporter promises not to use move_notify() unless the importer can
> experiance failures. iommufd will unmap the dmabuf from the iommu page
> tables while it is revoked.
>
> 2) Private interconnect negotiation. iommufd will only be able to map
> a "private interconnect" that provides a phys_addr_t and a
> struct p2pdma_provider * to describe the memory. It cannot use a DMA
> mapped scatterlist since it is directly calling iommu_map().
>
> 3) NULL device during dma_buf_dynamic_attach(). Since iommufd doesn't use
> the DMA API it doesn't have a DMAable struct device to pass here.
>
> Signed-off-by: Jason Gunthorpe <[email protected]>
Reviewed-by: Nicolin Chen <[email protected]>