Re: [PATCH 4/9] vfio/pci: Convert BAR mmap() to use a DMABUF
From: Alex Williamson
Date: Tue May 05 2026 - 10:51:27 EST
On Tue, 5 May 2026 13:49:11 +0300
Leon Romanovsky <leon@xxxxxxxxxx> wrote:
> On Mon, May 04, 2026 at 04:40:41AM -0300, Jason Gunthorpe wrote:
> > On Fri, May 01, 2026 at 04:19:15PM -0600, Alex Williamson wrote:
> >
> > > Exporting dma-bufs from vfio-pci is a feature, but mmap of MMIO BARs is
> > > a legacy requirement. That legacy requirement now depends on
> > > PCI_P2PDMA, which depends on 64BIT and ZONE_DEVICE.
> >
> > That should be split up now, Leon missed it when he added the new
> > APIs that didn't require ZONE_DEVICE..
>
> Sorry, what did I miss here?
> VFIO_DMABUF is an optional feature and is enabled only when P2P support is
> available. It does not affect legacy systems where P2P cannot be enabled.
If we look at the long term view of moving exclusively to cdev/iommufd,
where VFIO_DMABUF becomes the mechanism for implementing P2P DMA
mappings, VFIO_DMABUF may be optional, but it's highly desirable for
legacy compatibility. There's an argument though that providing P2P
compatibility on platforms that support PCI_P2PDMA is probably
sufficient.
However, in providing mmap of dmabufs as a feature, this series is
wiring all mmaps through dmabufs and therefore that dependency becomes
fundamental to the use of vfio-pci. Thus the discussion whether the
noted config requirements could be lifted. Thanks,
Alex
PS - Please also weigh in on the dmabuf underflow[1]
[1]https://lore.kernel.org/all/20260501131236.278ac431@xxxxxxxxxxx/