Projects
home:dongzhihai
qemu
_service:tar_scm:vdpa-implement-vdpa-device-mig...
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:tar_scm:vdpa-implement-vdpa-device-migration.patch of Package qemu
From 4688e12c57a34801010abf2a4cf528fcef3b9ec0 Mon Sep 17 00:00:00 2001 From: libai <libai12@huawei.com> Date: Mon, 4 Dec 2023 15:59:56 +0800 Subject: [PATCH] vdpa: implement vdpa device migration Integrate the live migration code, call the registered live migration function, and open the vdpa live migration prototype Signed-off-by: libai <libai12@huawei.com> --- hw/virtio/vdpa-dev.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/hw/virtio/vdpa-dev.c b/hw/virtio/vdpa-dev.c index f22d5d5bc0..6af78a4229 100644 --- a/hw/virtio/vdpa-dev.c +++ b/hw/virtio/vdpa-dev.c @@ -28,6 +28,8 @@ #include "hw/virtio/vdpa-dev.h" #include "sysemu/sysemu.h" #include "sysemu/runstate.h" +#include "hw/virtio/vdpa-dev-mig.h" +#include "migration/migration.h" static void vhost_vdpa_device_dummy_handle_output(VirtIODevice *vdev, VirtQueue *vq) @@ -154,6 +156,8 @@ static void vhost_vdpa_device_realize(DeviceState *dev, Error **errp) vhost_vdpa_device_dummy_handle_output); } + vdpa_migration_register(v); + return; free_config: @@ -173,6 +177,7 @@ static void vhost_vdpa_device_unrealize(DeviceState *dev) VhostVdpaDevice *s = VHOST_VDPA_DEVICE(vdev); int i; + vdpa_migration_unregister(s); virtio_set_status(vdev, 0); for (i = 0; i < s->num_queues; i++) { @@ -308,6 +313,7 @@ static void vhost_vdpa_device_stop(VirtIODevice *vdev) static void vhost_vdpa_device_set_status(VirtIODevice *vdev, uint8_t status) { VhostVdpaDevice *s = VHOST_VDPA_DEVICE(vdev); + MigrationState *ms = migrate_get_current(); bool should_start = virtio_device_started(vdev, status); Error *local_err = NULL; int ret; @@ -320,6 +326,11 @@ static void vhost_vdpa_device_set_status(VirtIODevice *vdev, uint8_t status) return; } + if (ms->state == RUN_STATE_PAUSED || + ms->state == RUN_STATE_RESTORE_VM) { + return; + } + if (should_start) { ret = vhost_vdpa_device_start(vdev, &local_err); if (ret < 0) { @@ -338,7 +349,7 @@ static Property vhost_vdpa_device_properties[] = { static const VMStateDescription vmstate_vhost_vdpa_device = { .name = "vhost-vdpa-device", - .unmigratable = 1, + .unmigratable = 0, .minimum_version_id = 1, .version_id = 1, .fields = (VMStateField[]) { -- 2.27.0
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2