[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 2/2] target/arm: Implement FEAT WFxT and enable for '-cpu max
From: |
Peter Maydell |
Subject: |
Re: [PATCH 2/2] target/arm: Implement FEAT WFxT and enable for '-cpu max' |
Date: |
Fri, 31 May 2024 11:38:30 +0100 |
On Tue, 30 Apr 2024 at 15:00, Peter Maydell <peter.maydell@linaro.org> wrote:
>
> FEAT_WFxT introduces new instructions WFIT and WFET, which are like
> the existing WFI and WFE but allow the guest to pass a timeout value
> in a register. The instructions will wait for an interrupt/event as
> usual, but will also stop waiting when the value of CNTVCT_EL0 is
> greater than or equal to the specified timeout value.
>
> We implement WFIT by setting up a timer to expire at the right
> point; when the timer expires it sets the EXITTB interrupt, which
> will cause the CPU to leave the halted state. If we come out of
> halt for some other reason, we unset the pending timer.
>
> We implement WFET as a nop, which is architecturally permitted and
> matches the way we currently make WFE a nop.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> diff --git a/target/arm/cpu.c b/target/arm/cpu.c
> index a152def2413..006092a6b12 100644
> --- a/target/arm/cpu.c
> +++ b/target/arm/cpu.c
> @@ -1132,6 +1132,33 @@ static bool arm_cpu_virtio_is_big_endian(CPUState *cs)
> return arm_cpu_data_is_big_endian(env);
> }
>
> +static bool arm_cpu_exec_halt(CPUState *cs)
> +{
> + bool leave_halt = cpu_has_work(cs);
> +
> + if (leave_halt) {
> + /* We're about to come out of WFI/WFE: disable the WFxT timer */
> + ARMCPU *cpu = ARM_CPU(cs);
> + if (cpu->wfxt_timer) {
> + timer_del(cpu->wfxt_timer);
> + }
> + }
> + return leave_halt;
> +}
I noticed in my pre-pullreq testing that this function needs
an #ifdef CONFIG_TCG around it, since otherwise the compiler
complains that it is defined but never used if we're building
only-Xen or only-KVM. I'll add that when I put this in
target-arm.next, rather than respinning.
thanks
-- PMM
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [PATCH 2/2] target/arm: Implement FEAT WFxT and enable for '-cpu max',
Peter Maydell <=