From: Pranjal Shrivastava <praan@google.com>
To: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
kvm@vger.kernel.org
Cc: Bjorn Helgaas <bhelgaas@google.com>,
Logan Gunthorpe <logang@deltatee.com>,
Alex Williamson <alex@shazbot.org>,
Jason Gunthorpe <jgg@ziepe.ca>, Kevin Tian <kevin.tian@intel.com>,
Pranjal Shrivastava <praan@google.com>,
Ankit Agrawal <ankita@nvidia.com>, Matt Evans <mattev@meta.com>,
Vivek Kasireddy <vivek.kasireddy@intel.com>,
Leon Romanovsky <leon@kernel.org>,
Shivaji Kant <shivajikant@google.com>,
Samiullah Khawaja <skhawaja@google.com>,
Unnati Sachan <unnatisachan@google.com>
Subject: [RFC PATCH v2 1/5] vfio: Add UAPI flag for ZONE_DEVICE-backed DMABUF exports
Date: Tue, 4 Aug 2026 18:50:46 +0000 [thread overview]
Message-ID: <20260804185050.2053672-2-praan@google.com> (raw)
In-Reply-To: <20260804185050.2053672-1-praan@google.com>
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@google.com>
---
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
next prev parent reply other threads:[~2026-08-04 18:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-04 18:50 [RFC PATCH v2 0/5] vfio/pci: Support ZONE_DEVICE-backed DMABUF Exports Pranjal Shrivastava
2026-08-04 18:50 ` Pranjal Shrivastava [this message]
2026-08-04 18:50 ` [RFC PATCH v2 2/5] vfio/pci: Implement ZONE_DEVICE registration for DMABUFs Pranjal Shrivastava
2026-08-04 18:50 ` [RFC PATCH v2 3/5] vfio/pci: Implement page-backed .map_dma_buf handler Pranjal Shrivastava
2026-08-04 18:50 ` [RFC PATCH v2 4/5] vfio/pci: Add .mmap handler for page-backed DMABUFs Pranjal Shrivastava
2026-08-04 18:50 ` [RFC PATCH v2 5/5] vfio/pci: Add revocation fence for ZONE_DEVICE DMABUFs Pranjal Shrivastava
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260804185050.2053672-2-praan@google.com \
--to=praan@google.com \
--cc=alex@shazbot.org \
--cc=ankita@nvidia.com \
--cc=bhelgaas@google.com \
--cc=jgg@ziepe.ca \
--cc=kevin.tian@intel.com \
--cc=kvm@vger.kernel.org \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=logang@deltatee.com \
--cc=mattev@meta.com \
--cc=shivajikant@google.com \
--cc=skhawaja@google.com \
--cc=unnatisachan@google.com \
--cc=vivek.kasireddy@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox