aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <philmd@linaro.org>2025-07-08 11:57:45 +0200
committerThomas Huth <thuth@redhat.com>2025-07-11 10:33:56 +0200
commit693b3039d77195953e70f008991c80bf9c5b9691 (patch)
treee760a04db860e9799858aadc1e59e1f9bfdaad0e
parentb1180352f1c758ba4270cdaa3c41ceead3a43aad (diff)
downloadqemu-693b3039d77195953e70f008991c80bf9c5b9691.zip
qemu-693b3039d77195953e70f008991c80bf9c5b9691.tar.gz
qemu-693b3039d77195953e70f008991c80bf9c5b9691.tar.bz2
target/s390x: Have s390_cpu_halt() not return anything
Since halting a vCPU and how many left running do not need to be tied together, split the s390_count_running_cpus() call out of s390_cpu_halt() to the single caller using it: s390_handle_wait(). Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-ID: <20250708095746.12697-4-philmd@linaro.org> Signed-off-by: Thomas Huth <thuth@redhat.com>
-rw-r--r--target/s390x/cpu-system.c4
-rw-r--r--target/s390x/helper.c4
-rw-r--r--target/s390x/s390x-internal.h2
3 files changed, 5 insertions, 5 deletions
diff --git a/target/s390x/cpu-system.c b/target/s390x/cpu-system.c
index 2fa8c4d..709ccd5 100644
--- a/target/s390x/cpu-system.c
+++ b/target/s390x/cpu-system.c
@@ -214,7 +214,7 @@ unsigned s390_count_running_cpus(void)
return nr_running;
}
-unsigned int s390_cpu_halt(S390CPU *cpu)
+void s390_cpu_halt(S390CPU *cpu)
{
CPUState *cs = CPU(cpu);
trace_cpu_halt(cs->cpu_index);
@@ -223,8 +223,6 @@ unsigned int s390_cpu_halt(S390CPU *cpu)
cs->halted = 1;
cs->exception_index = EXCP_HLT;
}
-
- return s390_count_running_cpus();
}
void s390_cpu_unhalt(S390CPU *cpu)
diff --git a/target/s390x/helper.c b/target/s390x/helper.c
index 3c57c32..5c127da 100644
--- a/target/s390x/helper.c
+++ b/target/s390x/helper.c
@@ -91,7 +91,9 @@ void s390_handle_wait(S390CPU *cpu)
{
CPUState *cs = CPU(cpu);
- if (s390_cpu_halt(cpu) == 0) {
+ s390_cpu_halt(cpu);
+
+ if (s390_count_running_cpus() == 0) {
if (is_special_wait_psw(cpu->env.psw.addr)) {
qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN);
} else {
diff --git a/target/s390x/s390x-internal.h b/target/s390x/s390x-internal.h
index 145e472..56cce2e 100644
--- a/target/s390x/s390x-internal.h
+++ b/target/s390x/s390x-internal.h
@@ -239,7 +239,7 @@ uint32_t calc_cc(CPUS390XState *env, uint32_t cc_op, uint64_t src, uint64_t dst,
/* cpu.c */
#ifndef CONFIG_USER_ONLY
unsigned int s390_count_running_cpus(void);
-unsigned int s390_cpu_halt(S390CPU *cpu);
+void s390_cpu_halt(S390CPU *cpu);
void s390_cpu_unhalt(S390CPU *cpu);
void s390_cpu_system_init(Object *obj);
bool s390_cpu_system_realize(DeviceState *dev, Error **errp);