[RFC PATCH 03/12] virtio: add the VIRTIO_F_DMB feature bit

From: Alexander Graf

Date: Sun Aug 09 2026 - 14:22:53 EST


In preparation to support VIRTIO_F_DMB, define the feature bit. A
device that negotiates it holds its virtqueues and the buffers they
reference in a Device Memory Buffer, a shared memory region the device
owns. Every address the driver publishes to such a device is an offset
into that region, so the device can only reach memory the driver placed
there.

Define VIRTIO_F_DMB as 44 and raise VIRTIO_TRANSPORT_F_END to 45, so
virtio_dev_probe() preserves the bit into finalize_features() where a
transport can act on it. VIRTIO_DEVICE_F_MASK derives from the same
bound, and the expansion drivers/vdpa/vdpa.c writes out by hand moves
with it. The feature is a proposal before the virtio Technical
Committee and has no allocated number, so 44 is provisional.

Link: https://lore.kernel.org/virtio-comment/20260804161202.38619-1-graf@xxxxxxxxxx/
Assisted-by: Kiro:claude-opus-5 checkpatch sparse
Signed-off-by: Alexander Graf <graf@xxxxxxxxxx>
---
drivers/vdpa/vdpa.c | 2 +-
include/uapi/linux/virtio_config.h | 17 ++++++++++++++++-
2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c
index 1757a33f298f..ae9326394c2e 100644
--- a/drivers/vdpa/vdpa.c
+++ b/drivers/vdpa/vdpa.c
@@ -548,7 +548,7 @@ vdpa_nl_cmd_mgmtdev_get_dumpit(struct sk_buff *msg, struct netlink_callback *cb)

/*
* Bitmask for all per-device features: feature bits VIRTIO_TRANSPORT_F_START
- * through VIRTIO_TRANSPORT_F_END are unset, i.e. 0xfffff8000fffffff for
+ * through VIRTIO_TRANSPORT_F_END are unset, i.e. 0xffffc0000fffffff for
* all 64bit features. If the features are extended beyond 64 bits, or new
* "holes" are reserved for other type of features than per-device, this
* macro would have to be updated.
diff --git a/include/uapi/linux/virtio_config.h b/include/uapi/linux/virtio_config.h
index 2445f365bce7..986e2b5fb3c8 100644
--- a/include/uapi/linux/virtio_config.h
+++ b/include/uapi/linux/virtio_config.h
@@ -52,7 +52,7 @@
* rest are per-device feature bits.
*/
#define VIRTIO_TRANSPORT_F_START 28
-#define VIRTIO_TRANSPORT_F_END 42
+#define VIRTIO_TRANSPORT_F_END 45

#ifndef VIRTIO_CONFIG_NO_LEGACY
/* Do we get callbacks when the ring is completely used, even if we've
@@ -120,4 +120,19 @@
*/
#define VIRTIO_F_ADMIN_VQ 41

+/*
+ * This feature indicates that the device offers a Device Memory Buffer: a
+ * shared memory region, owned by the device, that holds the virtqueues and
+ * the buffers they reference. When this feature is negotiated, every address
+ * that the driver places in a virtqueue is an offset into the Device Memory
+ * Buffer region rather than a physical address or a bus address. The device
+ * is thereby confined to memory the driver has published in that region.
+ *
+ * The feature is a specification proposal before the virtio Technical
+ * Committee, not a ratified feature. The number below is provisional: the
+ * committee has allocated none for it, and it will change if the committee
+ * allocates a different one. Do not treat it as a stable interface yet.
+ */
+#define VIRTIO_F_DMB 44
+
#endif /* _UAPI_LINUX_VIRTIO_CONFIG_H */