diff options
author | Laurent Vivier <lvivier@redhat.com> | 2024-12-19 12:13:58 +0100 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2025-01-20 19:51:24 +0100 |
commit | 878e16345461eb2745c761f6929fd6e9da0df447 (patch) | |
tree | 90e05d3370e23364613bc110644e6696c46ccac4 | |
parent | 78c73e9395b13354272010d2f202c819689d48f8 (diff) | |
download | passt-878e16345461eb2745c761f6929fd6e9da0df447.tar passt-878e16345461eb2745c761f6929fd6e9da0df447.tar.gz passt-878e16345461eb2745c761f6929fd6e9da0df447.tar.bz2 passt-878e16345461eb2745c761f6929fd6e9da0df447.tar.lz passt-878e16345461eb2745c761f6929fd6e9da0df447.tar.xz passt-878e16345461eb2745c761f6929fd6e9da0df447.tar.zst passt-878e16345461eb2745c761f6929fd6e9da0df447.zip |
vhost-user: add VHOST_USER_CHECK_DEVICE_STATE command
After transferring the back-end’s internal state during migration,
check whether the back-end was able to successfully fully process
the state.
The value returned indicates success or error;
0 is success, any non-zero value is an error.
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
-rw-r--r-- | vhost_user.c | 21 | ||||
-rw-r--r-- | virtio.h | 18 |
2 files changed, 31 insertions, 8 deletions
diff --git a/vhost_user.c b/vhost_user.c index 747b7f6..2962709 100644 --- a/vhost_user.c +++ b/vhost_user.c @@ -981,6 +981,23 @@ static bool vu_set_vring_enable_exec(struct vu_dev *vdev, } /** + * vu_check_device_state_exec() -- Return device state migration result + * @vdev: vhost-user device + * @vmsg: vhost-user message + * + * Return: True as the reply contains the migration result + */ +static bool vu_check_device_state_exec(struct vu_dev *vdev, + struct vhost_user_msg *msg) +{ + (void)vdev; + + vmsg_set_reply_u64(msg, vdev->device_state_result); + + return true; +} + +/** * vu_init() - Initialize vhost-user device structure * @c: execution context * @vdev: vhost-user device @@ -1001,6 +1018,7 @@ void vu_init(struct ctx *c) } c->vdev->log_table = NULL; c->vdev->log_call_fd = -1; + c->vdev->device_state_result = -1; } @@ -1049,6 +1067,8 @@ void vu_cleanup(struct vu_dev *vdev) vdev->nregions = 0; vu_close_log(vdev); + + vdev->device_state_result = -1; } /** @@ -1079,6 +1099,7 @@ static bool (*vu_handle[VHOST_USER_MAX])(struct vu_dev *vdev, [VHOST_USER_SET_VRING_CALL] = vu_set_vring_call_exec, [VHOST_USER_SET_VRING_ERR] = vu_set_vring_err_exec, [VHOST_USER_SET_VRING_ENABLE] = vu_set_vring_enable_exec, + [VHOST_USER_CHECK_DEVICE_STATE] = vu_check_device_state_exec, }; /** @@ -98,14 +98,15 @@ struct vu_dev_region { /** * struct vu_dev - vhost-user device information - * @context: Execution context - * @nregions: Number of shared memory regions - * @regions: Guest shared memory regions - * @features: Vhost-user features - * @protocol_features: Vhost-user protocol features - * @log_call_fd: Eventfd to report logging update - * @log_size: Size of the logging memory region - * @log_table: Base of the logging memory region + * @context: Execution context + * @nregions: Number of shared memory regions + * @regions: Guest shared memory regions + * @features: Vhost-user features + * @protocol_features: Vhost-user protocol features + * @log_call_fd: Eventfd to report logging update + * @log_size: Size of the logging memory region + * @log_table: Base of the logging memory region + * @device_state_result: Device state migration result */ struct vu_dev { struct ctx *context; @@ -117,6 +118,7 @@ struct vu_dev { int log_call_fd; uint64_t log_size; uint8_t *log_table; + int device_state_result; }; /** |