@@ -44,8 +44,6 @@ int kvm_log_stop(target_phys_addr_t phys_addr, ram_addr_t size);
int kvm_has_sync_mmu(void);
int kvm_has_vcpu_events(void);
int kvm_has_robust_singlestep(void);
-int kvm_put_vcpu_events(CPUState *env, int level);
-int kvm_get_vcpu_events(CPUState *env);
void kvm_cpu_register_phys_memory_client(void);
@@ -980,6 +980,8 @@ void kvm_arch_load_regs(CPUState *env, int level)
env->halted = 0;
}
+ kvm_put_vcpu_events(env, level);
+
/* must be last */
kvm_guest_debug_workarounds(env);
}
@@ -1153,6 +1155,7 @@ void kvm_arch_save_regs(CPUState *env)
}
}
kvm_arch_save_mpstate(env);
+ kvm_get_vcpu_events(env);
}
static void do_cpuid_ent(struct kvm_cpuid_entry2 *e, uint32_t function,
@@ -1224,7 +1227,7 @@ int kvm_arch_init_vcpu(CPUState *cenv)
qemu_kvm_load_lapic(cenv);
- cenv->interrupt_injected = -1;
+ kvm_arch_reset_vcpu(cenv);
#ifdef KVM_CPUID_SIGNATURE
/* Paravirtualization CPUIDs */
@@ -1391,7 +1394,6 @@ void kvm_arch_push_nmi(void *opaque)
void kvm_arch_cpu_reset(CPUState *env)
{
kvm_arch_reset_vcpu(env);
- kvm_put_vcpu_events(env, KVM_PUT_RESET_STATE);
kvm_reset_mpstate(env);
}
@@ -794,7 +794,7 @@ static int kvm_get_mp_state(CPUState *env)
}
#endif
-int kvm_put_vcpu_events(CPUState *env, int level)
+static int kvm_put_vcpu_events(CPUState *env, int level)
{
#ifdef KVM_CAP_VCPU_EVENTS
struct kvm_vcpu_events events;
@@ -830,7 +830,7 @@ int kvm_put_vcpu_events(CPUState *env, int level)
#endif
}
-int kvm_get_vcpu_events(CPUState *env)
+static int kvm_get_vcpu_events(CPUState *env)
{
#ifdef KVM_CAP_VCPU_EVENTS
struct kvm_vcpu_events events;
@@ -5,7 +5,6 @@
#include "exec-all.h"
#include "kvm.h"
-#include "qemu-kvm.h"
static const VMStateDescription vmstate_segment = {
.name = "segment",
@@ -322,10 +321,6 @@ static void cpu_pre_save(void *opaque)
CPUState *env = opaque;
int i;
- if (kvm_enabled()) {
- kvm_get_vcpu_events(env);
- }
-
/* FPU */
env->fpus_vmstate = (env->fpus & ~0x3800) | (env->fpstt & 0x7) << 11;
env->fptag_vmstate = 0;
@@ -362,7 +357,6 @@ static int cpu_post_load(void *opaque, int version_id)
if (kvm_enabled()) {
kvm_load_tsc(env);
- kvm_put_vcpu_events(env, KVM_PUT_FULL_STATE);
}
return 0;
Push reading/writing of vcpu_events into kvm_arch_load/save_regs to avoid KVM-specific hooks in generic code. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> --- kvm.h | 2 -- qemu-kvm-x86.c | 6 ++++-- target-i386/kvm.c | 4 ++-- target-i386/machine.c | 6 ------ 4 files changed, 6 insertions(+), 12 deletions(-)