From: Philippe Mathieu-Daudé Date: Fri, 3 Oct 2025 14:14:51 +0000 (+0200) Subject: accel/hvf: Skip WFI if CPU has work to do X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a14afa985e347c6978ab83c9e7a90d8002462042;p=thirdparty%2Fqemu.git 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é Reviewed-by: Alex Bennée Reviewed-by: Richard Henderson Reviewed-by: Akihiko Odaki 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; }