diff mbox series

[Stable-8.2.5,16/21] target/loongarch/kvm: Fix VM recovery from disk failures

Message ID 20240527072435.52812-16-mjt@tls.msk.ru (mailing list archive)
State New, archived
Headers show
Series Patch Round-up for stable 8.2.5, freeze on 2024-06-07 | expand

Commit Message

Michael Tokarev May 27, 2024, 7:24 a.m. UTC
From: Song Gao <gaosong@loongson.cn>

vmstate does not save kvm_state_conter,
which can cause VM recovery from disk to fail.

Cc: qemu-stable@nongnu.org
Signed-off-by: Song Gao <gaosong@loongson.cn>
Acked-by: Peter Xu <peterx@redhat.com>
Message-Id: <20240508024732.3127792-1-gaosong@loongson.cn>
(cherry picked from commit 0eb285c3627b5406dd91bfa3b47402e5de92123f)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
(Mjt: adjust context for v8.2.0-205-g2d23bb1a3805
  "target/loongarch: Constify VMState in machine.c")
diff mbox series

Patch

diff --git a/target/loongarch/machine.c b/target/loongarch/machine.c
index 1c4e01d076..5a7df713e2 100644
--- a/target/loongarch/machine.c
+++ b/target/loongarch/machine.c
@@ -125,8 +125,8 @@  const VMStateDescription vmstate_tlb = {
 /* LoongArch CPU state */
 const VMStateDescription vmstate_loongarch_cpu = {
     .name = "cpu",
-    .version_id = 1,
-    .minimum_version_id = 1,
+    .version_id = 2,
+    .minimum_version_id = 2,
     .fields = (VMStateField[]) {
         VMSTATE_UINTTL_ARRAY(env.gpr, LoongArchCPU, 32),
         VMSTATE_UINTTL(env.pc, LoongArchCPU),
@@ -191,6 +191,8 @@  const VMStateDescription vmstate_loongarch_cpu = {
         VMSTATE_STRUCT_ARRAY(env.tlb, LoongArchCPU, LOONGARCH_TLB_MAX,
                              0, vmstate_tlb, LoongArchTLB),
 
+        VMSTATE_UINT64(kvm_state_counter, LoongArchCPU),
+
         VMSTATE_END_OF_LIST()
     },
     .subsections = (const VMStateDescription*[]) {