Commit a14afa985e for qemu.org
commit a14afa985e347c6978ab83c9e7a90d8002462042
Author: Philippe Mathieu-Daudé <philmd@linaro.org>
Date: Fri Oct 3 16:14:51 2025 +0200
accel/hvf: Skip WFI if CPU has work to do
Avoid sleeping vCPU thread for any pending work, not just IRQs.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Message-ID: <20260112103034.65310-13-philmd@linaro.org>
diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c
index af28b8e882..d74703a3d5 100644
--- a/target/arm/hvf/hvf.c
+++ b/target/arm/hvf/hvf.c
@@ -1737,8 +1737,11 @@ static void hvf_wfi(CPUState *cpu)
uint64_t nanos;
uint32_t cntfrq;
- if (cpu_test_interrupt(cpu, CPU_INTERRUPT_HARD | CPU_INTERRUPT_FIQ)) {
- /* Interrupt pending, no need to wait */
+ if (cpu_has_work(cpu)) {
+ /*
+ * Don't bother to go into our "low power state" if
+ * we would just wake up immediately.
+ */
return;
}