Skip to contentSkip to conversation

QMP: Emit Basic events

PATCH Applied Luiz Capitulino 2 participants 2 messages Jan 26, 2010 – Jan 27, 2010 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 QMP: Emit Basic events

While testing QMP on qemu-kvm I found that it's not emitting basic events like RESET or POWERDOWN.

The reason is that in QEMU upstream those events are triggered in QEMU's main loop (ie. vl.c:main_loop()), but control doesn't reach there in qemu-kvm as it has its own main loop in qemu-kvm.c:kvm_main_loop().

This commit adds the same set of events there too.

NOTE: The STOP event is not being added because it should be triggered in vm_stop() and not in the main loop, this will be fixed upstream.

---
 qemu-kvm.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
qemu-kvm.c +7 -3
index 1c34846..06706c9 100644
@@ -17,6 +17,7 @@
 #include "block.h"
 #include "compatfd.h"
 #include "gdbstub.h"
+#include "monitor.h"
 
 #include "qemu-kvm.h"
 #include "libkvm.h"
@@ -2124,11 +2125,14 @@ int kvm_main_loop(void)
                 vm_stop(0);
             } else
                 break;
-        } else if (qemu_powerdown_requested())
+        } else if (qemu_powerdown_requested()) {
+            monitor_protocol_event(QEVENT_POWERDOWN, NULL);
             qemu_irq_raise(qemu_system_powerdown);
-        else if (qemu_reset_requested())
+        } else if (qemu_reset_requested()) {
+            monitor_protocol_event(QEVENT_RESET, NULL);
             qemu_kvm_system_reset();
-        else if (kvm_debug_cpu_requested) {
+        } else if (kvm_debug_cpu_requested) {
+            monitor_protocol_event(QEVENT_DEBUG, NULL);
             gdb_set_stop_cpu(kvm_debug_cpu_requested);
             vm_stop(EXCP_DEBUG);
             kvm_debug_cpu_requested = NULL;
Signature · 1 line
1.6.6
#1 lore raw
Quoted 9 lines · Luiz Capitulino

While testing QMP on qemu-kvm I found that it's not emitting basic events like RESET or POWERDOWN.

The reason is that in QEMU upstream those events are triggered in QEMU's main loop (ie. vl.c:main_loop()), but control doesn't reach there in qemu-kvm as it has its own main loop in qemu-kvm.c:kvm_main_loop().

Quoted 7 lines

This commit adds the same set of events there too.

NOTE: The STOP event is not being added because it should be triggered in vm_stop() and not in the main loop, this will be fixed upstream.

Applied, thanks.