On 3/4/21 11:23 PM, Philippe Mathieu-Daudé wrote: > There is only one CPUClass::has_work() ARM handler: arm_cpu_has_work(). > > Avoid a dereference by declaring it in "internals.h" and call it > directly in the WFI helper. > > Signed-off-by: Philippe Mathieu-Daudé <f4...@amsat.org>
Reviewed-by: Claudio Fontana <cfont...@suse.de> > --- > target/arm/internals.h | 1 + > target/arm/cpu.c | 2 +- > target/arm/op_helper.c | 2 +- > 3 files changed, 3 insertions(+), 2 deletions(-) > > diff --git a/target/arm/internals.h b/target/arm/internals.h > index 05cebc8597c..1930be08828 100644 > --- a/target/arm/internals.h > +++ b/target/arm/internals.h > @@ -172,6 +172,7 @@ static inline int r14_bank_number(int mode) > void arm_cpu_register_gdb_regs_for_features(ARMCPU *cpu); > void arm_translate_init(void); > > +bool arm_cpu_has_work(CPUState *cs); > #ifdef CONFIG_TCG > void arm_cpu_synchronize_from_tb(CPUState *cs, const TranslationBlock *tb); > #endif /* CONFIG_TCG */ > diff --git a/target/arm/cpu.c b/target/arm/cpu.c > index 5e018b2a732..6d2d9f2100f 100644 > --- a/target/arm/cpu.c > +++ b/target/arm/cpu.c > @@ -76,7 +76,7 @@ void arm_cpu_synchronize_from_tb(CPUState *cs, > } > #endif /* CONFIG_TCG */ > > -static bool arm_cpu_has_work(CPUState *cs) > +bool arm_cpu_has_work(CPUState *cs) > { > ARMCPU *cpu = ARM_CPU(cs); > > diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c > index 65cb37d088f..a4da6f4fde8 100644 > --- a/target/arm/op_helper.c > +++ b/target/arm/op_helper.c > @@ -289,7 +289,7 @@ void HELPER(wfi)(CPUARMState *env, uint32_t insn_len) > CPUState *cs = env_cpu(env); > int target_el = check_wfx_trap(env, false); > > - if (cpu_has_work(cs)) { > + if (arm_cpu_has_work(cs)) { > /* Don't bother to go into our "low power state" if > * we would just wake up immediately. > */ >