[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC PATCH v2 3/8] target/arm: Directly use arm_cpu_has_work instead
From: |
Claudio Fontana |
Subject: |
Re: [RFC PATCH v2 3/8] target/arm: Directly use arm_cpu_has_work instead of CPUClass::has_work |
Date: |
Mon, 8 Mar 2021 15:53:45 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 |
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é <f4bug@amsat.org>
Reviewed-by: Claudio Fontana <cfontana@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.
> */
>
- [RFC PATCH v2 0/8] cpu: Move CPUClass::has_work() to TCGCPUOps, Philippe Mathieu-Daudé, 2021/03/04
- [RFC PATCH v2 1/8] sysemu/tcg: Restrict tcg_exec_init() to CONFIG_TCG, Philippe Mathieu-Daudé, 2021/03/04
- [RFC PATCH v2 2/8] sysemu/tcg: Restrict qemu_tcg_mttcg_enabled() to TCG, Philippe Mathieu-Daudé, 2021/03/04
- [RFC PATCH v2 3/8] target/arm: Directly use arm_cpu_has_work instead of CPUClass::has_work, Philippe Mathieu-Daudé, 2021/03/04
- Re: [RFC PATCH v2 3/8] target/arm: Directly use arm_cpu_has_work instead of CPUClass::has_work,
Claudio Fontana <=
- [RFC PATCH v2 4/8] target/s390x: Move s390_cpu_has_work to excp_helper.c, Philippe Mathieu-Daudé, 2021/03/04
- [RFC PATCH v2 5/8] target/ppc: Duplicate the TCGCPUOps structure for POWER CPUs, Philippe Mathieu-Daudé, 2021/03/04
- [RFC PATCH v2 6/8] cpu: Declare cpu_has_work() in 'sysemu/tcg.h', Philippe Mathieu-Daudé, 2021/03/04
- [RFC PATCH v2 7/8] cpu: Move CPUClass::has_work() to TCGCPUOps, Philippe Mathieu-Daudé, 2021/03/04
- [RFC PATCH v2 8/8] target/arm: Restrict arm_cpu_has_work() to TCG, Philippe Mathieu-Daudé, 2021/03/04