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é <[email protected]> --- target/arm/internals.h | 8 +------- target/arm/arm-powerctl.c | 7 +++++++ target/arm/cpu.c | 4 ++-- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/target/arm/internals.h b/target/arm/internals.h index 1775835ad50..1efda543270 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 diff --git a/target/arm/arm-powerctl.c b/target/arm/arm-powerctl.c index a06be5cc997..213e7ae056c 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 f58a1db843a..76aa47ac503 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); } -- 2.53.0
