[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 13/14] target-arm: Don't halt on WFI unless we d
From: |
Edgar E. Iglesias |
Subject: |
Re: [Qemu-devel] [PATCH 13/14] target-arm: Don't halt on WFI unless we don't have any work |
Date: |
Thu, 28 May 2015 15:55:31 +1000 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Tue, May 19, 2015 at 07:33:33PM +0100, Peter Maydell wrote:
> Just NOP the WFI instruction if we have work to do.
> This doesn't make much difference currently (though it does avoid
> jumping out to the top level loop and immediately restarting),
> but the distinction between "halt" and "don't halt" will become
> more important when the decision to halt requires us to trap
> to a higher exception level instead.
>
> Suggested-by: Edgar E. Iglesias <address@hidden>
> Signed-off-by: Peter Maydell <address@hidden>
Reviewed-by: Edgar E. Iglesias <address@hidden>
> ---
> target-arm/op_helper.c | 7 +++++++
> target-arm/translate-a64.c | 4 ++++
> target-arm/translate.c | 4 ++++
> 3 files changed, 15 insertions(+)
>
> diff --git a/target-arm/op_helper.c b/target-arm/op_helper.c
> index 5963f3b..517dacc 100644
> --- a/target-arm/op_helper.c
> +++ b/target-arm/op_helper.c
> @@ -252,6 +252,13 @@ void HELPER(wfi)(CPUARMState *env)
> {
> CPUState *cs = CPU(arm_env_get_cpu(env));
>
> + if (cpu_has_work(cs)) {
> + /* Don't bother to go into our "low power state" if
> + * we would just wake up immediately.
> + */
> + return;
> + }
> +
> cs->exception_index = EXCP_HLT;
> cs->halted = 1;
> cpu_loop_exit(cs);
> diff --git a/target-arm/translate-a64.c b/target-arm/translate-a64.c
> index 8d08ccd..ffa6cb8 100644
> --- a/target-arm/translate-a64.c
> +++ b/target-arm/translate-a64.c
> @@ -11113,6 +11113,10 @@ void gen_intermediate_code_internal_a64(ARMCPU *cpu,
> */
> gen_a64_set_pc_im(dc->pc);
> gen_helper_wfi(cpu_env);
> + /* The helper doesn't necessarily throw an exception, but we
> + * must go back to the main loop to check for interrupts anyway.
> + */
> + tcg_gen_exit_tb(0);
> break;
> }
> }
> diff --git a/target-arm/translate.c b/target-arm/translate.c
> index ed2c43d..6493b9a 100644
> --- a/target-arm/translate.c
> +++ b/target-arm/translate.c
> @@ -11351,6 +11351,10 @@ static inline void
> gen_intermediate_code_internal(ARMCPU *cpu,
> break;
> case DISAS_WFI:
> gen_helper_wfi(cpu_env);
> + /* The helper doesn't necessarily throw an exception, but we
> + * must go back to the main loop to check for interrupts anyway.
> + */
> + tcg_gen_exit_tb(0);
> break;
> case DISAS_WFE:
> gen_helper_wfe(cpu_env);
> --
> 1.9.1
>
- [Qemu-devel] [PATCH 10/14] target-arm: Make singlestate TB flags common between AArch32/64, (continued)
- [Qemu-devel] [PATCH 10/14] target-arm: Make singlestate TB flags common between AArch32/64, Peter Maydell, 2015/05/19
- [Qemu-devel] [PATCH 05/14] target-arm: Set exception target EL in tlb_fill, Peter Maydell, 2015/05/19
- [Qemu-devel] [PATCH 08/14] target-arm: Allow cp access functions to indicate traps to EL2 or EL3, Peter Maydell, 2015/05/19
- [Qemu-devel] [PATCH 07/14] target-arm: Update interrupt handling to use target EL, Peter Maydell, 2015/05/19
- [Qemu-devel] [PATCH 01/14] target-arm: Add exception target el infrastructure, Peter Maydell, 2015/05/19
- [Qemu-devel] [PATCH 13/14] target-arm: Don't halt on WFI unless we don't have any work, Peter Maydell, 2015/05/19
- Re: [Qemu-devel] [PATCH 13/14] target-arm: Don't halt on WFI unless we don't have any work,
Edgar E. Iglesias <=
- [Qemu-devel] [PATCH 12/14] target-arm: Move TB flags down to fill gap, Peter Maydell, 2015/05/19
- [Qemu-devel] [PATCH 04/14] target-arm: Move setting of exception info into tlb_fill, Peter Maydell, 2015/05/19
- [Qemu-devel] [PATCH 02/14] target-arm: Extend helpers to route exceptions, Peter Maydell, 2015/05/19
- [Qemu-devel] [PATCH 06/14] target-arm: Make raise_exception() take syndrome and target EL, Peter Maydell, 2015/05/19
- [Qemu-devel] [PATCH 03/14] target-arm: Set correct syndrome for faults on MSR DAIF*, imm, Peter Maydell, 2015/05/19