Commit b0eaa3a19b for qemu.org
commit b0eaa3a19b5c285d6f140b50d3ab1729e0efdcd4
Author: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Date: Tue Sep 22 08:32:19 2026 +0200
target/arm: Un-inline arm_set_cpu_power_state()
Move arm_set_cpu_power_state() from the header to arm-powerctl.c,
keeping the power-state helper with the other power-control code.
Restrict the call in arm_cpu_reset_hold() to system emulation.
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20260923171116.31276-7-philmd@oss.qualcomm.com>
diff --git a/target/arm/arm-powerctl.c b/target/arm/arm-powerctl.c
index a06be5cc99..213e7ae056 100644
--- a/target/arm/arm-powerctl.c
+++ b/target/arm/arm-powerctl.c
@@ -45,6 +45,13 @@ struct CpuOnInfo {
bool target_aa64;
};
+void arm_set_cpu_power_state(ARMCPU *cpu, ARMPSCIState state)
+{
+ CPUARMState *env = &cpu->env;
+
+ cpu->power_state = state;
+ env->halt_reason = state == PSCI_OFF ? HALT_PSCI : NOT_HALTED;
+}
static void arm_set_cpu_on_async_work(CPUState *target_cpu_state,
run_on_cpu_data data)
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
index f58a1db843..76aa47ac50 100644
--- a/target/arm/cpu.c
+++ b/target/arm/cpu.c
@@ -351,8 +351,6 @@ static void arm_cpu_reset_hold(Object *obj, ResetType type)
env->vfp.xregs[ARM_VFP_MVFR1] = cpu->isar.mvfr1;
env->vfp.xregs[ARM_VFP_MVFR2] = cpu->isar.mvfr2;
- arm_set_cpu_power_state(cpu, cs->start_powered_off ? PSCI_OFF : PSCI_ON);
-
if (arm_feature(env, ARM_FEATURE_AARCH64)) {
/* 64 bit CPUs always start in 64 bit mode */
env->aarch64 = true;
@@ -671,6 +669,8 @@ static void arm_cpu_reset_hold(Object *obj, ResetType type)
arm_set_ah_fp_behaviours(&env->vfp.fp_status[FPST_AH_F16]);
#ifndef CONFIG_USER_ONLY
+ arm_set_cpu_power_state(cpu, cs->start_powered_off ? PSCI_OFF : PSCI_ON);
+
if (kvm_enabled()) {
kvm_arm_reset_vcpu(cpu);
}
diff --git a/target/arm/internals.h b/target/arm/internals.h
index 1775835ad5..1efda54327 100644
--- a/target/arm/internals.h
+++ b/target/arm/internals.h
@@ -2082,12 +2082,6 @@ bool arm_cpu_match_cpreg_mig_tolerance(ARMCPU *cpu, uint64_t kvmidx,
/**
* arm_set_cpu_power_state() - set power state synced with halt_reason
*/
-static inline void arm_set_cpu_power_state(ARMCPU *cpu, ARMPSCIState state)
-{
- CPUARMState *env = &cpu->env;
-
- cpu->power_state = state;
- env->halt_reason = state == PSCI_OFF ? HALT_PSCI : NOT_HALTED;
-}
+void arm_set_cpu_power_state(ARMCPU *cpu, ARMPSCIState state);
#endif