target/arm: Implement FEAT WFxT and enable for '-cpu max'
authorPeter Maydell <peter.maydell@linaro.org>
Tue, 30 Apr 2024 14:00:35 +0000 (15:00 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Thu, 30 May 2024 15:35:17 +0000 (16:35 +0100)
commita96edb687e76a44b554b7975d9deda522c2c4302
treec5af340cda56025d1b408433b88dc71836566ff9
parent408b2b3d9df631102919ada62add6d785f737f74
target/arm: Implement FEAT WFxT and enable for '-cpu max'

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>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20240430140035.3889879-3-peter.maydell@linaro.org
12 files changed:
docs/system/arm/emulation.rst
target/arm/cpu-features.h
target/arm/cpu.c
target/arm/cpu.h
target/arm/helper.c
target/arm/helper.h
target/arm/internals.h
target/arm/machine.c
target/arm/tcg/a64.decode
target/arm/tcg/cpu64.c
target/arm/tcg/op_helper.c
target/arm/tcg/translate-a64.c