diff options
author | Emilio G. Cota <cota@braap.org> | 2018-10-21 13:30:35 -0400 |
---|---|---|
committer | Alex Bennée <alex.bennee@linaro.org> | 2019-10-28 15:12:38 +0000 |
commit | 30865f316856cc346f4af7ec28586c4a636b0109 (patch) | |
tree | 238e7c54ec573e96fe0be6908c4d4f3aecfea9ea /cpus.c | |
parent | c36f7a642cd81cff566ffe23e0a863ac4d7f1f91 (diff) | |
download | qemu-30865f316856cc346f4af7ec28586c4a636b0109.zip qemu-30865f316856cc346f4af7ec28586c4a636b0109.tar.gz qemu-30865f316856cc346f4af7ec28586c4a636b0109.tar.bz2 |
cpu: hook plugin vcpu events
Signed-off-by: Emilio G. Cota <cota@braap.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Diffstat (limited to 'cpus.c')
-rw-r--r-- | cpus.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -45,6 +45,7 @@ #include "exec/exec-all.h" #include "qemu/thread.h" +#include "qemu/plugin.h" #include "sysemu/cpus.h" #include "sysemu/qtest.h" #include "qemu/main-loop.h" @@ -1264,9 +1265,18 @@ static void qemu_tcg_rr_wait_io_event(void) static void qemu_wait_io_event(CPUState *cpu) { + bool slept = false; + while (cpu_thread_is_idle(cpu)) { + if (!slept) { + slept = true; + qemu_plugin_vcpu_idle_cb(cpu); + } qemu_cond_wait(cpu->halt_cond, &qemu_global_mutex); } + if (slept) { + qemu_plugin_vcpu_resume_cb(cpu); + } #ifdef _WIN32 /* Eat dummy APC queued by qemu_cpu_kick_thread. */ |