summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcelo Tosatti <mtosatti@redhat.com>2010-01-27 20:44:01 -0200
committerMarcelo Tosatti <mtosatti@redhat.com>2010-01-31 19:20:09 -0200
commitae5ae0d52085d9f16216741c27736cf8fbdfe22d (patch)
tree92619b7d1b89b229a486e82f4d74b39ea6c6ac2b /target-i386
parentFix kvm_load_mpstate for vcpu hot add (diff)
downloadqemu-kvm-ae5ae0d52085d9f16216741c27736cf8fbdfe22d.tar.gz
qemu-kvm-ae5ae0d52085d9f16216741c27736cf8fbdfe22d.tar.bz2
qemu-kvm-ae5ae0d52085d9f16216741c27736cf8fbdfe22d.zip
qemu-kvm: enable get/set vcpu events on reset and migration
qemu-kvm should reset and save/restore vcpu events. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Acked-by: Jan Kiszka <jan.kiszka@siemens.com> Acked-by: Gleb Natapov <gleb@redhat.com>
Diffstat (limited to 'target-i386')
-rw-r--r--target-i386/kvm.c8
-rw-r--r--target-i386/machine.c6
2 files changed, 11 insertions, 3 deletions
diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index c338bf7cd..cb7077b41 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -226,6 +226,7 @@ int kvm_arch_init_vcpu(CPUState *env)
return kvm_vcpu_ioctl(env, KVM_SET_CPUID2, &cpuid_data);
}
+#endif
void kvm_arch_reset_vcpu(CPUState *env)
{
env->exception_injected = -1;
@@ -233,6 +234,7 @@ void kvm_arch_reset_vcpu(CPUState *env)
env->nmi_injected = 0;
env->nmi_pending = 0;
}
+#ifdef KVM_UPSTREAM
static int kvm_has_msr_star(CPUState *env)
{
@@ -717,8 +719,9 @@ static int kvm_get_mp_state(CPUState *env)
env->mp_state = mp_state.mp_state;
return 0;
}
+#endif
-static int kvm_put_vcpu_events(CPUState *env)
+int kvm_put_vcpu_events(CPUState *env)
{
#ifdef KVM_CAP_VCPU_EVENTS
struct kvm_vcpu_events events;
@@ -748,7 +751,7 @@ static int kvm_put_vcpu_events(CPUState *env)
#endif
}
-static int kvm_get_vcpu_events(CPUState *env)
+int kvm_get_vcpu_events(CPUState *env)
{
#ifdef KVM_CAP_VCPU_EVENTS
struct kvm_vcpu_events events;
@@ -785,6 +788,7 @@ static int kvm_get_vcpu_events(CPUState *env)
return 0;
}
+#ifdef KVM_UPSTREAM
int kvm_arch_put_registers(CPUState *env)
{
int ret;
diff --git a/target-i386/machine.c b/target-i386/machine.c
index 47ca6e856..0b8a33afd 100644
--- a/target-i386/machine.c
+++ b/target-i386/machine.c
@@ -323,7 +323,10 @@ static void cpu_pre_save(void *opaque)
int i;
cpu_synchronize_state(env);
- kvm_save_mpstate(env);
+ if (kvm_enabled()) {
+ kvm_save_mpstate(env);
+ kvm_get_vcpu_events(env);
+ }
/* FPU */
env->fpus_vmstate = (env->fpus & ~0x3800) | (env->fpstt & 0x7) << 11;
@@ -374,6 +377,7 @@ static int cpu_post_load(void *opaque, int version_id)
kvm_load_tsc(env);
kvm_load_mpstate(env);
+ kvm_put_vcpu_events(env);
}
return 0;