Commit d33a1810d7f558dd1d486bc84f1cf8f96c982e2d

Authored by Jan Kiszka
Committed by Anthony Liguori
1 parent 8217606e

kvm: Rework VCPU reset

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.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Showing 2 changed files with 8 additions and 2 deletions
kvm-all.c
... ... @@ -22,6 +22,7 @@
22 22  
23 23 #include "qemu-common.h"
24 24 #include "sysemu.h"
  25 +#include "hw/hw.h"
25 26 #include "gdbstub.h"
26 27 #include "kvm.h"
27 28  
... ... @@ -376,6 +377,11 @@ int kvm_check_extension(KVMState *s, unsigned int extension)
376 377 return ret;
377 378 }
378 379  
  380 +static void kvm_reset_vcpus(void *opaque)
  381 +{
  382 + kvm_sync_vcpus();
  383 +}
  384 +
379 385 int kvm_init(int smp_cpus)
380 386 {
381 387 KVMState *s;
... ... @@ -462,6 +468,8 @@ int kvm_init(int smp_cpus)
462 468 if (ret < 0)
463 469 goto err;
464 470  
  471 + qemu_register_reset(kvm_reset_vcpus, INT_MAX, NULL);
  472 +
465 473 kvm_state = s;
466 474  
467 475 return 0;
... ...
... ... @@ -3659,8 +3659,6 @@ void qemu_system_reset(void)
3659 3659 for(re = first_reset_entry; re != NULL; re = re->next) {
3660 3660 re->func(re->opaque);
3661 3661 }
3662   - if (kvm_enabled())
3663   - kvm_sync_vcpus();
3664 3662 }
3665 3663  
3666 3664 void qemu_system_reset_request(void)
... ...