[RFC PATCH v2 1/5] vfio: Add UAPI flag for ZONE_DEVICE-backed DMABUF exports

From: Pranjal Shrivastava

Date: Tue Aug 04 2026 - 14:54:08 EST


Add an opt-in UAPI flag for exporting VFIO MMIO regions via dmabuf
backed by struct page metadata (via ZONE_DEVICE registration).

Signed-off-by: Pranjal Shrivastava <praan@xxxxxxxxxx>
---
include/uapi/linux/vfio.h | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/vfio.h b/include/uapi/linux/vfio.h
index cbe03e5d1009..3ae025b33e7f 100644
--- a/include/uapi/linux/vfio.h
+++ b/include/uapi/linux/vfio.h
@@ -1505,7 +1505,13 @@ struct vfio_device_feature_bus_master {
* 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.
*
- * flags should be 0.
+ * flags supports:
+ * - VFIO_DMA_BUF_FLAG_ZONE_DEVICE_BACKED: Request the kernel to allocate
+ * valid struct pages for the exported dmabuf range (via ZONE_DEVICE
+ * registration). This allows the exported dmabuf fd to be used by
+ * subsystems that rely on page metadata.
+ * (NOTE: This consumes extra system RAM to store BAR_SIZE / PAGE_SIZE
+ * struct pages).
*
* Return: The fd number on success, -1 and errno is set on failure.
*/
@@ -1516,6 +1522,8 @@ struct vfio_region_dma_range {
__u64 length;
};

+#define VFIO_DMA_BUF_FLAG_ZONE_DEVICE_BACKED (1 << 0)
+
struct vfio_device_feature_dma_buf {
__u32 region_index;
__u32 open_flags;
--
2.55.0.571.g244d577d93-goog