[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH v3 14/20] docs/interop: define STANDALONE protocol feature fo
From: |
Alex Bennée |
Subject: |
[RFC PATCH v3 14/20] docs/interop: define STANDALONE protocol feature for vhost-user |
Date: |
Mon, 10 Jul 2023 16:35:16 +0100 |
Currently QEMU has to know some details about the back-end to be able
to setup the guest. While various parts of the setup can be delegated
to the backend (for example config handling) this is a very piecemeal
approach.
This patch suggests a new feature flag (VHOST_USER_PROTOCOL_F_STANDALONE)
which the back-end can advertise which allows a probe message to be
sent to get all the details QEMU needs to know in one message.
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
Initial RFC for discussion. I intend to prototype this work with QEMU
and one of the rust-vmm vhost-user daemons.
---
docs/interop/vhost-user.rst | 39 +++++++++++++++++++++++++++++++++++++
hw/virtio/vhost-user.c | 8 ++++++++
2 files changed, 47 insertions(+)
diff --git a/docs/interop/vhost-user.rst b/docs/interop/vhost-user.rst
index 5a070adbc1..a2080f56f3 100644
--- a/docs/interop/vhost-user.rst
+++ b/docs/interop/vhost-user.rst
@@ -275,6 +275,21 @@ Inflight description
:queue size: a 16-bit size of virtqueues
+Backend specifications
+^^^^^^^^^^^^^^^^^^^^^^
+
++-----------+-------------+------------+------------+
+| device id | config size | min_vqs | max_vqs |
++-----------+-------------+------------+------------+
+
+:device id: a 32-bit value holding the VirtIO device ID
+
+:config size: a 32-bit value holding the config size (see
``VHOST_USER_GET_CONFIG``)
+
+:min_vqs: a 32-bit value holding the minimum number of vqs supported
+
+:max_vqs: a 32-bit value holding the maximum number of vqs supported, must be
>= min_vqs
+
C structure
-----------
@@ -296,6 +311,7 @@ In QEMU the vhost-user message is implemented with the
following struct:
VhostUserConfig config;
VhostUserVringArea area;
VhostUserInflight inflight;
+ VhostUserBackendSpecs specs;
};
} QEMU_PACKED VhostUserMsg;
@@ -316,6 +332,7 @@ replies. Here is a list of the ones that do:
* ``VHOST_USER_GET_VRING_BASE``
* ``VHOST_USER_SET_LOG_BASE`` (if ``VHOST_USER_PROTOCOL_F_LOG_SHMFD``)
* ``VHOST_USER_GET_INFLIGHT_FD`` (if ``VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD``)
+* ``VHOST_USER_GET_BACKEND_SPECS`` (if ``VHOST_USER_PROTOCOL_F_STANDALONE``)
.. seealso::
@@ -885,6 +902,15 @@ Protocol features
#define VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS 15
#define VHOST_USER_PROTOCOL_F_STATUS 16
#define VHOST_USER_PROTOCOL_F_XEN_MMAP 17
+ #define VHOST_USER_PROTOCOL_F_STANDALONE 18
+
+Some features depend on others to be supported:
+
+* ``VHOST_USER_PROTOCOL_F_STANDALONE`` depends on:
+
+ * ``VHOST_USER_PROTOCOL_F_STATUS``
+ * ``VHOST_USER_PROTOCOL_F_CONFIG`` (if there is a config space)
+
Front-end message types
-----------------------
@@ -1440,6 +1466,19 @@ Front-end message types
query the back-end for its device status as defined in the Virtio
specification.
+``VHOST_USER_GET_BACKEND_SPECS``
+ :id: 41
+ :request payload: N/A
+ :reply payload: ``Backend specifications``
+
+ When the ``VHOST_USER_PROTOCOL_F_STANDALONE`` protocol feature has been
+ successfully negotiated, this message is submitted by the front-end to
+ query the back-end for its capabilities. This is intended to remove
+ the need for the front-end to know ahead of time what the VirtIO
+ device the backend emulates is.
+
+ The reply contains the device id, size of the config space and the
+ range of VirtQueues the backend supports.
Back-end message types
----------------------
diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
index c4e0cbd702..28b021d5d3 100644
--- a/hw/virtio/vhost-user.c
+++ b/hw/virtio/vhost-user.c
@@ -202,6 +202,13 @@ typedef struct VhostUserInflight {
uint16_t queue_size;
} VhostUserInflight;
+typedef struct VhostUserBackendSpecs {
+ uint32_t device_id;
+ uint32_t config_size;
+ uint32_t min_vqs;
+ uint32_t max_vqs;
+} VhostUserBackendSpecs;
+
typedef struct {
VhostUserRequest request;
@@ -226,6 +233,7 @@ typedef union {
VhostUserCryptoSession session;
VhostUserVringArea area;
VhostUserInflight inflight;
+ VhostUserBackendSpecs specs;
} VhostUserPayload;
typedef struct VhostUserMsg {
--
2.39.2
- Re: [PATCH v3 03/20] hw/virtio: fix typo in VIRTIO_CONFIG_IRQ_IDX comments, (continued)
- [PATCH v3 07/20] virtio: add vhost-user-base and a generic vhost-user-device, Alex Bennée, 2023/07/10
- [RFC PATCH v3 15/20] hw/virtio: move vhost_user_init earlier, Alex Bennée, 2023/07/10
- [RFC PATCH v3 19/20] hw/virtio: probe backend for specs if it supports it, Alex Bennée, 2023/07/10
- [PATCH v3 09/20] hw/virtio: derive vhost-user-rng from vhost-user-device, Alex Bennée, 2023/07/10
- [PATCH v3 10/20] hw/virtio: add config support to vhost-user-device, Alex Bennée, 2023/07/10
- [RFC PATCH v3 18/20] hw/virtio: validate F_STANDALONE also supports other protocol features, Alex Bennée, 2023/07/10
- [RFC PATCH v3 17/20] hw/virtio: push down allocation responsibility for vhost_dev->vqs, Alex Bennée, 2023/07/10
- [RFC PATCH v3 14/20] docs/interop: define STANDALONE protocol feature for vhost-user,
Alex Bennée <=
- [PATCH v3 12/20] hw/virtio: derive vhost-user-i2c from vhost-user-base, Alex Bennée, 2023/07/10
- [RFC PATCH v3 13/20] docs/system: add a basic enumeration of vhost-user devices, Alex Bennée, 2023/07/10
- [RFC PATCH v3 16/20] hw/virtio: move virtq initialisation into internal helper, Alex Bennée, 2023/07/10
- [RFC PATCH v3 20/20] hw/virtio: allow vhost-user-device to be driven by backend, Alex Bennée, 2023/07/10