fac818adb1
Change-Id: I574115f5e44e56ac2baaad71eeab6b9fd7149747
68 lines
2.3 KiB
Diff
68 lines
2.3 KiB
Diff
From 1551a13eed2544fe3f2c061f5bd81484b8ea877c Mon Sep 17 00:00:00 2001
|
|
From: libai <libai12@huawei.com>
|
|
Date: Tue, 19 Dec 2023 20:32:00 +0800
|
|
Subject: [PATCH 15/16] vdpa: don't suspend/resume device when vdpa device not
|
|
started
|
|
|
|
When vdpa device not started, we don't need to suspend vdpa device
|
|
and send vdpa device state information. Therefore, add the suspended
|
|
flag of vdpa device to distinguish whether the device is suspended and
|
|
use it to determine whether the device needs to resume in dest qemu.
|
|
|
|
Signed-off-by: libai <libai12@huawei.com>
|
|
---
|
|
hw/virtio/vdpa-dev-mig.c | 23 +++++++++++++++--------
|
|
1 file changed, 15 insertions(+), 8 deletions(-)
|
|
|
|
diff --git a/hw/virtio/vdpa-dev-mig.c b/hw/virtio/vdpa-dev-mig.c
|
|
index 1d29901..887c96a 100644
|
|
--- a/hw/virtio/vdpa-dev-mig.c
|
|
+++ b/hw/virtio/vdpa-dev-mig.c
|
|
@@ -294,10 +294,13 @@ static int vdpa_save_complete_precopy(QEMUFile *f, void *opaque)
|
|
int ret;
|
|
|
|
qemu_put_be64(f, VDPA_MIG_FLAG_DEV_CONFIG_STATE);
|
|
- ret = vhost_vdpa_dev_buffer_save(hdev, f);
|
|
- if (ret) {
|
|
- error_report("Save vdpa device buffer failed: %d\n", ret);
|
|
- return ret;
|
|
+ qemu_put_be16(f, (uint16_t)vdev->suspended);
|
|
+ if (vdev->suspended) {
|
|
+ ret = vhost_vdpa_dev_buffer_save(hdev, f);
|
|
+ if (ret) {
|
|
+ error_report("Save vdpa device buffer failed: %d\n", ret);
|
|
+ return ret;
|
|
+ }
|
|
}
|
|
qemu_put_be64(f, VDPA_MIG_FLAG_END_OF_STATE);
|
|
|
|
@@ -311,6 +314,7 @@ static int vdpa_load_state(QEMUFile *f, void *opaque, int version_id)
|
|
|
|
int ret;
|
|
uint64_t data;
|
|
+ uint16_t suspended;
|
|
|
|
data = qemu_get_be64(f);
|
|
while (data != VDPA_MIG_FLAG_END_OF_STATE) {
|
|
@@ -323,10 +327,13 @@ static int vdpa_load_state(QEMUFile *f, void *opaque, int version_id)
|
|
return -EINVAL;
|
|
}
|
|
} else if (data == VDPA_MIG_FLAG_DEV_CONFIG_STATE) {
|
|
- ret = vhost_vdpa_dev_buffer_load(hdev, f);
|
|
- if (ret) {
|
|
- error_report("fail to restore device buffer.\n");
|
|
- return ret;
|
|
+ suspended = qemu_get_be16(f);
|
|
+ if (suspended) {
|
|
+ ret = vhost_vdpa_dev_buffer_load(hdev, f);
|
|
+ if (ret) {
|
|
+ error_report("fail to restore device buffer.\n");
|
|
+ return ret;
|
|
+ }
|
|
}
|
|
}
|
|
|
|
--
|
|
2.46.0.windows.1
|
|
|