Hi Leon,
On 11/9/25 07:49, Leon Romanovsky wrote:
On Sun, Nov 9, 2025, at 07:33, Vivek Kasireddy wrote:
Cc: Alex Williamson <[email protected]>
Cc: Cédric Le Goater <[email protected]>
Signed-off-by: Vivek Kasireddy <[email protected]>
---
linux-headers/linux/vfio.h | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/linux-headers/linux/vfio.h b/linux-headers/linux/vfio.h
index 4d96d1fc12..bc11ca3663 100644
--- a/linux-headers/linux/vfio.h
+++ b/linux-headers/linux/vfio.h
@@ -1478,6 +1478,31 @@ struct vfio_device_feature_bus_master {
};
#define VFIO_DEVICE_FEATURE_BUS_MASTER 10
+/**
+ * Upon VFIO_DEVICE_FEATURE_GET create a dma_buf fd for the
+ * regions selected.
+ *
+ * open_flags are the typical flags passed to open(2), eg O_RDWR, O_CLOEXEC,
+ * etc. offset/length specify a slice of the region to create the dmabuf from.
+ * nr_ranges is the total number of (P2P DMA) ranges that comprise the dmabuf.
+ *
+ * Return: The fd number on success, -1 and errno is set on failure.
+ */
+#define VFIO_DEVICE_FEATURE_DMA_BUF 11
+
+struct vfio_region_dma_range {
+ __u64 offset;
+ __u64 length;
+};
+
+struct vfio_device_feature_dma_buf {
+ __u32 region_index;
+ __u32 open_flags;
+ __u32 flags;
+ __u32 nr_ranges;
+ struct vfio_region_dma_range dma_ranges[];
Not important comment at all, but in last versions of UAPI, this line is
struct vfio_region_dma_range dma_ranges[] __counted_by(nr_ranges);
https://lore.kernel.org/kvm/[email protected]/T/#Z2e.:..:20251106-dmabuf-vfio-v7-10-2503bf390699::40nvidia.com:1include:uapi:linux:vfio.h
The kernel dma-buf definitions will be included in the QEMU linux-headers/
directory with the update-linux-headers.sh script.
First, v8 of "vfio/pci: Allow MMIO regions to be exported" series [1] needs
be merged and I expect this will happen in the Linux v6.19 cycle. The QEMU
changes are then targeting QEMU 11.0 whose cycle will start next year now.
We still have some time to polish.
Thanks,
C.
[1]
https://lore.kernel.org//qemu-devel/[email protected]