Commit 8890239ed1 for qemu.org
commit 8890239ed11834e33dc75e1f937540ea7e3def83
Author: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Date: Wed Jul 2 12:03:09 2025 +0200
target/s390x: Make s390_cpu_set_state() return void
The return value of s390_cpu_set_state() is only used by the STOP
interrupt handler. Make the setter return void and count running
CPUs directly at that call site.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Eric Farman <farman@linux.ibm.com>
Message-Id: <20260923171116.31276-4-philmd@oss.qualcomm.com>
diff --git a/target/s390x/cpu-system.c b/target/s390x/cpu-system.c
index f12ef1bd1c..e1335d9be6 100644
--- a/target/s390x/cpu-system.c
+++ b/target/s390x/cpu-system.c
@@ -240,7 +240,7 @@ void s390_cpu_unhalt(S390CPU *cpu)
}
}
-unsigned int s390_cpu_set_state(uint8_t cpu_state, S390CPU *cpu)
+void s390_cpu_set_state(uint8_t cpu_state, S390CPU *cpu)
{
trace_cpu_set_state(CPU(cpu)->cpu_index, cpu_state);
@@ -271,8 +271,6 @@ unsigned int s390_cpu_set_state(uint8_t cpu_state, S390CPU *cpu)
kvm_s390_set_cpu_state(cpu, cpu_state);
}
cpu->env.cpu_state = cpu_state;
-
- return s390_count_running_cpus();
}
void s390_cmma_reset(void)
diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h
index 998bbb0d7f..2d1dcc7045 100644
--- a/target/s390x/cpu.h
+++ b/target/s390x/cpu.h
@@ -847,11 +847,10 @@ void s390_do_cpu_set_diag318(CPUState *cs, run_on_cpu_data arg);
int s390_assign_subch_ioeventfd(EventNotifier *notifier, uint32_t sch_id,
int vq, bool assign);
#ifndef CONFIG_USER_ONLY
-unsigned int s390_cpu_set_state(uint8_t cpu_state, S390CPU *cpu);
+void s390_cpu_set_state(uint8_t cpu_state, S390CPU *cpu);
#else
-static inline unsigned int s390_cpu_set_state(uint8_t cpu_state, S390CPU *cpu)
+static inline void s390_cpu_set_state(uint8_t cpu_state, S390CPU *cpu)
{
- return 0;
}
#endif /* CONFIG_USER_ONLY */
static inline uint8_t s390_cpu_get_state(const S390CPU *cpu)
diff --git a/target/s390x/sigp.c b/target/s390x/sigp.c
index b6d44c5c31..1801b8caa6 100644
--- a/target/s390x/sigp.c
+++ b/target/s390x/sigp.c
@@ -617,7 +617,8 @@ void do_stop_interrupt(CPUS390XState *env)
s390_store_status(cpu, S390_STORE_STATUS_DEF_ADDR, true);
}
env->sigp_order = 0;
- if (s390_cpu_set_state(S390_CPU_STATE_STOPPED, cpu) == 0) {
+ s390_cpu_set_state(S390_CPU_STATE_STOPPED, cpu);
+ if (s390_count_running_cpus() == 0) {
qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN);
}
env->pending_int &= ~INTERRUPT_STOP;