aboutsummaryrefslogtreecommitdiff
path: root/softmmu
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <f4bug@amsat.org>2022-02-03 01:58:55 +0100
committerPhilippe Mathieu-Daudé <f4bug@amsat.org>2022-03-06 13:15:42 +0100
commitad7d684dfde391de6fe5c0680f73097072fbf03a (patch)
tree4438c3a4296761b37187a6eff152f9a10441e916 /softmmu
parent5f74af8bab3978b766bdf78255079da3b8a1a888 (diff)
accel: Introduce AccelOpsClass::cpu_thread_is_idle()
Add cpu_thread_is_idle() to AccelOps, and implement it for the KVM / WHPX accelerators. Suggested-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20220207075426.81934-11-f4bug@amsat.org>
Diffstat (limited to 'softmmu')
-rw-r--r--softmmu/cpus.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/softmmu/cpus.c b/softmmu/cpus.c
index ac6bec5603..b17033d3bc 100644
--- a/softmmu/cpus.c
+++ b/softmmu/cpus.c
@@ -90,10 +90,12 @@ bool cpu_thread_is_idle(CPUState *cpu)
if (cpu_is_stopped(cpu)) {
return true;
}
- if (!cpu->halted || cpu_has_work(cpu) ||
- kvm_halt_in_kernel() || whpx_apic_in_platform()) {
+ if (!cpu->halted || cpu_has_work(cpu)) {
return false;
}
+ if (cpus_accel->cpu_thread_is_idle) {
+ return cpus_accel->cpu_thread_is_idle(cpu);
+ }
return true;
}