RE: [PATCH v3 3/9] vfio/pci: Add a helper to create a DMABUF for a BAR-map VMA
From: Tian, Kevin
Date: Fri Jun 12 2026 - 04:43:36 EST
> From: Matt Evans <matt@xxxxxxxxxx>
> Sent: Wednesday, June 10, 2026 11:43 PM
>
> This helper, vfio_pci_core_mmap_prep_dmabuf(), creates a single-range
> DMABUF for the purpose of mapping a PCI BAR. This is used in a future
> commit by VFIO's ordinary mmap() path.
>
> This function transfers ownership of the VFIO device fd to the
> DMABUF, which fput()s when it's released.
>
> Refactor the existing vfio_pci_core_feature_dma_buf() to split out
> export code common to the two paths, VFIO_DEVICE_FEATURE_DMA_BUF
> and
> this new VFIO_BAR mmap().
>
> Signed-off-by: Matt Evans <matt@xxxxxxxxxx>
Reviewed-by: Kevin Tian <kevin.tian@xxxxxxxxx>