@@ -885,6 +885,7 @@ 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_PRESETUP 18
Front-end message types
-----------------------
@@ -1440,6 +1441,15 @@ Front-end message types
query the back-end for its device status as defined in the Virtio
specification.
+``VHOST_USER_PRESETUP``
+ :id: 41
+ :equivalent ioctl: N/A
+ :request payload: ``u64``
+ :reply payload: N/A
+
+ When the ``VHOST_USER_PROTOCOL_F_PRESETUP`` protocol feature has been
+ successfully negotiated, this message is submitted by the front-end to
+ indicate start or end early setup. Value 1 means start, 2 means end.
Back-end message types
----------------------
@@ -74,6 +74,8 @@ enum VhostUserProtocolFeature {
/* Feature 14 reserved for VHOST_USER_PROTOCOL_F_INBAND_NOTIFICATIONS. */
VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS = 15,
VHOST_USER_PROTOCOL_F_STATUS = 16,
+ /* Feature 17 reserved for VHOST_USER_PROTOCOL_F_XEN_MMAP. */
+ VHOST_USER_PROTOCOL_F_PRESETUP = 18,
VHOST_USER_PROTOCOL_F_MAX
};
@@ -121,6 +123,7 @@ typedef enum VhostUserRequest {
VHOST_USER_REM_MEM_REG = 38,
VHOST_USER_SET_STATUS = 39,
VHOST_USER_GET_STATUS = 40,
+ VHOST_USER_PRESETUP = 41,
VHOST_USER_MAX
} VhostUserRequest;
@@ -132,6 +135,11 @@ typedef enum VhostUserBackendRequest {
VHOST_USER_BACKEND_MAX
} VhostUserBackendRequest;
+typedef enum VhostUserPresetupState {
+ VHOST_USER_PRESETUP_START = 1,
+ VHOST_USER_PRESETUP_END = 2,
+} VhostUserPresetupState;
+
typedef struct VhostUserMemoryRegion {
uint64_t guest_phys_addr;
uint64_t memory_size;
@@ -2741,6 +2749,27 @@ static void vhost_user_reset_status(struct vhost_dev *dev)
}
}
+static int vhost_user_set_presetup_state(struct vhost_dev *dev, bool start)
+{
+ if (start) {
+ return vhost_user_set_u64(dev, VHOST_USER_PRESETUP,
+ VHOST_USER_PRESETUP_START, false);
+ } else {
+ return vhost_user_set_u64(dev, VHOST_USER_PRESETUP,
+ VHOST_USER_PRESETUP_END, false);
+ }
+}
+
+static int vhost_user_presetup(struct vhost_dev *dev, bool start)
+{
+ if (!virtio_has_feature(dev->protocol_features,
+ VHOST_USER_PROTOCOL_F_PRESETUP)) {
+ return -ENOTSUP;
+ }
+
+ return vhost_user_set_presetup_state(dev, start);
+}
+
const VhostOps user_ops = {
.backend_type = VHOST_BACKEND_TYPE_USER,
.vhost_backend_init = vhost_user_backend_init,
@@ -2777,4 +2806,5 @@ const VhostOps user_ops = {
.vhost_set_inflight_fd = vhost_user_set_inflight_fd,
.vhost_dev_start = vhost_user_dev_start,
.vhost_reset_status = vhost_user_reset_status,
+ .vhost_presetup = vhost_user_presetup,
};
@@ -133,6 +133,8 @@ typedef int (*vhost_set_config_call_op)(struct vhost_dev *dev,
typedef void (*vhost_reset_status_op)(struct vhost_dev *dev);
+typedef int (*vhost_presetup_op)(struct vhost_dev *dev, bool start);
+
typedef struct VhostOps {
VhostBackendType backend_type;
vhost_backend_init vhost_backend_init;
@@ -181,6 +183,7 @@ typedef struct VhostOps {
vhost_force_iommu_op vhost_force_iommu;
vhost_set_config_call_op vhost_set_config_call;
vhost_reset_status_op vhost_reset_status;
+ vhost_presetup_op vhost_presetup;
} VhostOps;
int vhost_backend_update_device_iotlb(struct vhost_dev *dev,