Commit bb495851c6 for qemu.org
commit bb495851c6744ede99b457d50255964a61249221
Author: Janosch Frank <frankja@linux.ibm.com>
Date: Wed Sep 23 08:20:59 2026 +0000
target/s390x: Extend comment about PV cpu load state
When implementing PV in KVM we chose to add the cpu load state to the
mp state solely to have a way to keep the UV happy. The UV requires us
to set that state before running the boot cpu since entering that
state sets the initial PSW.
Since entering that state in KVM only sets off the UV call which
causes the initial PSW load and does not set the KVM tracking to
operating, we need a second set mp state to reach operating state.
Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Eric Farman <farman@linux.ibm.com>
Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Message-ID: <20260923082146.62803-1-frankja@linux.ibm.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
diff --git a/target/s390x/cpu-system.c b/target/s390x/cpu-system.c
index c938c77d0b..f12ef1bd1c 100644
--- a/target/s390x/cpu-system.c
+++ b/target/s390x/cpu-system.c
@@ -73,8 +73,12 @@ static void s390_cpu_load_normal(CPUState *s)
cpu->env.psw.addr = spsw & PSW_MASK_SHORT_ADDR;
} else {
/*
- * Firmware requires us to set the load state before we set
- * the cpu to operating on protected guests.
+ * Firmware/UV requires us to set the load state before we run
+ * the cpu on (re)boots. The UV load includes operating so the
+ * second set state isn't really needed but KVM doesn't update
+ * its internal state to operating on load. So we have to set
+ * operating again. The UV doesn't mind that since it's
+ * effectively a NOP.
*/
s390_cpu_set_state(S390_CPU_STATE_LOAD, cpu);
}