[RFC PATCH 0/3] vfio-user: support multiple FDs backing region mmaps

Naman Gulati posted 3 patches 2 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260811233930.401797-1-namangulati@google.com
Maintainers: John Levon <john.levon@nutanix.com>, Thanos Makatos <thanos.makatos@nutanix.com>, "Cédric Le Goater" <clg@redhat.com>, Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>, Alex Williamson <alex@shazbot.org>
There is a newer version of this series
docs/interop/vfio-user.rst    | 71 +++++++++++++++++++++++++++++++++--
hw/vfio-user/device.c         | 63 +++++++++++++++++++++++++++++--
hw/vfio-user/protocol.h       | 20 ++++++++++
hw/vfio/device.c              | 50 ++++++++++++------------
hw/vfio/region.c              | 41 ++++++++++++++++----
hw/vfio/vfio-region.h         |  8 ++++
include/hw/vfio/vfio-device.h | 29 ++++++++++++--
7 files changed, 239 insertions(+), 43 deletions(-)
[RFC PATCH 0/3] vfio-user: support multiple FDs backing region mmaps
Posted by Naman Gulati 2 weeks ago
This series extends the vfio-user protocol specification to allow
servers to pass multiple file descriptors for different sparse memory
areas to be mmap'ed within a single device region.

This extension is intended for exposing paravirtualized PCI devices via
a vfio-user server that may have multiple unique sub-regions in a BAR
backed by some mmap'able buffers sourced from distinct file descriptors.

This change introduces a new capability:
  VFIO_REGION_INFO_CAP_SPARSE_MMAP_FDS

Unlike VFIO_REGION_INFO_CAP_SPARSE_MMAP (which maps all sparse areas
from a single open file descriptor), this new capability defines an
array of sparse mmap areas where each area contains an index into the
array of file descriptors.

When all sparse areas share a single file descriptor, servers may
continue to emit VFIO_REGION_INFO_CAP_SPARSE_MMAP and send exactly one
file descriptor in SCM_RIGHTS for backwards compatibility with older
clients.

The extensions in this series also lays the groundwork to make use of
the in-development series [1] extending vfio-pci to return distinct
dmabuf FDs for discrete regions of a device's BAR. A vfio-user server
may choose to return dmabuf FDs for various regions of a device's BAR to
map a vfio passthrough device into the guest, in order to retain control
of the device and be able to revoke mappings passed to the VM.


[1] https://lore.kernel.org/all/20260715174737.15287-1-matt@ozlabs.org

Naman Gulati (3):
  vfio-user: add multi-fd region mmap capability
  vfio: mmap sparse regions backed by multiple FDs
  vfio-user: implement client support for multi-fd region mmap

 docs/interop/vfio-user.rst    | 71 +++++++++++++++++++++++++++++++++--
 hw/vfio-user/device.c         | 63 +++++++++++++++++++++++++++++--
 hw/vfio-user/protocol.h       | 20 ++++++++++
 hw/vfio/device.c              | 50 ++++++++++++------------
 hw/vfio/region.c              | 41 ++++++++++++++++----
 hw/vfio/vfio-region.h         |  8 ++++
 include/hw/vfio/vfio-device.h | 29 ++++++++++++--
 7 files changed, 239 insertions(+), 43 deletions(-)

-- 
2.55.0.679.g6767b8d81c-goog