File 0002-RFC-ppc-Include-quiesced-in-vmstate_ppc_cpu.patch of Package qemu

From a022a828d21a18e490aa7080f31c4f285c748f18 Mon Sep 17 00:00:00 2001
From: Fabian Vogt <fvogt@suse.de>
Date: Thu, 14 Aug 2025 12:56:05 +0200
Subject: [PATCH 2/2] RFC: ppc: Include quiesced in vmstate_ppc_cpu

Make sure that quiesced is included in VM snapshots, otherwise this state
is lost.

This fixes that guests with more than one CPU did not survive a
savevm/loadvm roundtrip.

Due to fb802acdc8b1 ("ppc/spapr: Fix RTAS stopped state"), secondary CPUs
are quiesced on reset, which needs to be overwritten by loadvm, otherwise
they appear suddenly stuck to the guest.

RFC because this isn't backwards-compatible: Migration to older QEMU will
fail. FWICT the patches this fixes would've had to make the new behaviour
specific to new machines.

Fixes: 96746f7a95a6 ("ppc/pnv: Fix direct controls quiesce")
Fixes: fb802acdc8b1 ("ppc/spapr: Fix RTAS stopped state")
---
 target/ppc/machine.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/target/ppc/machine.c b/target/ppc/machine.c
index d72e5ecb94..78bc1a98ff 100644
--- a/target/ppc/machine.c
+++ b/target/ppc/machine.c
@@ -671,7 +671,7 @@ static const VMStateDescription vmstate_bhrb = {
 
 const VMStateDescription vmstate_ppc_cpu = {
     .name = "cpu",
-    .version_id = 5,
+    .version_id = 6,
     .minimum_version_id = 5,
     .pre_save = cpu_pre_save,
     .post_load = cpu_post_load,
@@ -698,6 +698,9 @@ const VMStateDescription vmstate_ppc_cpu = {
         /* Backward compatible internal state */
         VMSTATE_UINTTL(env.hflags_compat_nmsr, PowerPCCPU),
 
+        /* "RTAS stopped" state, independent of internal halted state */
+        VMSTATE_BOOL_V(env.quiesced, PowerPCCPU, 6),
+
         VMSTATE_END_OF_LIST()
     },
     .subsections = (const VMStateDescription * const []) {
-- 
2.50.1

openSUSE Build Service is sponsored by