qemu/vdpa-don-t-suspend-resume-device-when-vdpa-device-no.patch
Jiabo Feng 999512f123 QEMU update to version 6.2.0-87(master)
- vdpa: suspend function return 0 when the vdpa device is stopped
- vdpa: don't suspend/resume device when vdpa device not started
- vdpa: support vdpa device suspend/resume
- vdpa: correct param passed in when unregister save
- vdpa: set vring enable only if the vring address has already been set
- shadow_dev: introduce shadow dev for virtio-net device
- revert "tcg/loongarch64: Fix tcg_out_mov() Aborted"
- migration: Set downtime_start even for postcopy
- gdb-xml: fix duplicate register in arm-neon.xml
- iotests: fix default machine type detection
- migration: fix RAMBlock add NULL check
- s390x: Fix spelling errors
- ppc: spelling fixes
- hw/scsi/vhost-scsi: don't double close vhostfd on error
- virtio/vhost-vsock: don't double close vhostfd, remove redundant cleanup
- hw/scsi/vhost-scsi: don't leak vqs on error
- hw/i386/pc: Add missing property descriptions
- pcie_aer: Don't trigger a LSI if none are defined
- pci: Export the pci_intx() function
- hw/qdev: Cosmetic around documentation
- tests/unit: fix a -Wformat-truncation warning
- tests/avocado: mark ReplayKernelNormal.test_mips64el_malta as flaky
- i386/sev: Avoid SEV-ES crash due to missing MSR_EFER_LMA bit
- ui/vnc-clipboard: fix inflate_buffer
- hw/usb/hcd-xhci.c: spelling: tranfer

Signed-off-by: Jiabo Feng <fengjiabo1@huawei.com>
(cherry picked from commit 68fee7dc06a6beb5f69d951e22a7f16091f269ff)
2023-12-22 15:12:17 +08:00

68 lines
2.3 KiB
Diff

From daab4fa364c508d793ed28a920d50cd76efe7633 Mon Sep 17 00:00:00 2001
From: jiangdongxu <jiangdongxu1@huawei.com>
Date: Tue, 19 Dec 2023 20:32:00 +0800
Subject: [PATCH] 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: jiangdongxu <jiangdongxu1@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 4a45821892..9cd80f92eb 100644
--- a/hw/virtio/vdpa-dev-mig.c
+++ b/hw/virtio/vdpa-dev-mig.c
@@ -296,10 +296,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);
@@ -313,6 +316,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) {
@@ -325,10 +329,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.27.0