Skip to contentSkip to conversation

kvm: Rework VCPU reset

PATCH New Jan Kiszka 1 participant 1 message Apr 19, 2009 1 message not in the archive

lore
Share & tools
lore

Jan Kiszka

author
#1 lore raw

PATCH 2/2 kvm: Rework VCPU reset

In reply to a message not in the archive

Use standard callback with highest order to synchronize VCPU on reset after all device callbacks were execute. This allows to remove the special kvm hook in qemu_system_reset.

---

 kvm-all.c |    8 ++++++++
 vl.c      |    2 --
 2 files changed, 8 insertions(+), 2 deletions(-)
kvm-all.c +8 -0
index 9e9b462..1128bee 100644
@@ -22,6 +22,7 @@
 
 #include "qemu-common.h"
 #include "sysemu.h"
+#include "hw/hw.h"
 #include "gdbstub.h"
 #include "kvm.h"
 
@@ -321,6 +322,11 @@ int kvm_uncoalesce_mmio_region(target_phys_addr_t start, ram_addr_t size)
     return ret;
 }
 
+static void kvm_reset_vcpus(void *opaque)
+{
+    kvm_sync_vcpus();
+}
+
 int kvm_init(int smp_cpus)
 {
     KVMState *s;
@@ -411,6 +417,8 @@ int kvm_init(int smp_cpus)
     if (ret < 0)
         goto err;
 
+    qemu_register_reset(kvm_reset_vcpus, INT_MAX, NULL);
+
     kvm_state = s;
 
     return 0;
vl.c +0 -2
index 4a064bf..3cf8331 100644
@@ -3627,8 +3627,6 @@ void qemu_system_reset(void)
     for(re = first_reset_entry; re != NULL; re = re->next) {
         re->func(re->opaque);
     }
-    if (kvm_enabled())
-        kvm_sync_vcpus();
 }
 
 void qemu_system_reset_request(void)