summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlauber Costa <glommer@redhat.com>2009-10-16 15:27:38 -0400
committerMarcelo Tosatti <mtosatti@redhat.com>2009-10-19 17:49:04 -0200
commit11ed4b344c0eb6f1c5d11a07c307e94174a13900 (patch)
tree546d56749cda473f81c5c0a39e2bd39ed602508a /qemu-kvm-x86.c
parentintroduce VMSTATE_U64 (diff)
downloadqemu-kvm-11ed4b344c0eb6f1c5d11a07c307e94174a13900.tar.gz
qemu-kvm-11ed4b344c0eb6f1c5d11a07c307e94174a13900.tar.bz2
qemu-kvm-11ed4b344c0eb6f1c5d11a07c307e94174a13900.zip
properly save kvm system time msr registers
Currently, the msrs involved in setting up pvclock are not saved over migration and/or save/restore. This patch puts their value in special fields in our CPUState, and deal with them using vmstate. kvm also has to account for it, by including them in the msr list for the ioctls. Signed-off-by: Glauber Costa <glommer@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'qemu-kvm-x86.c')
-rw-r--r--qemu-kvm-x86.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/qemu-kvm-x86.c b/qemu-kvm-x86.c
index d071d5e47..aa123defb 100644
--- a/qemu-kvm-x86.c
+++ b/qemu-kvm-x86.c
@@ -834,6 +834,12 @@ static int get_msr_entry(struct kvm_msr_entry *entry, CPUState *env)
case MSR_VM_HSAVE_PA:
env->vm_hsave = entry->data;
break;
+ case MSR_KVM_SYSTEM_TIME:
+ env->system_time_msr = entry->data;
+ break;
+ case MSR_KVM_WALL_CLOCK:
+ env->wall_clock_msr = entry->data;
+ break;
default:
printf("Warning unknown msr index 0x%x\n", entry->index);
return 1;
@@ -996,6 +1002,8 @@ void kvm_arch_load_regs(CPUState *env)
set_msr_entry(&msrs[n++], MSR_LSTAR , env->lstar);
}
#endif
+ set_msr_entry(&msrs[n++], MSR_KVM_SYSTEM_TIME, env->system_time_msr);
+ set_msr_entry(&msrs[n++], MSR_KVM_WALL_CLOCK, env->wall_clock_msr);
rc = kvm_set_msrs(env, msrs, n);
if (rc == -1)
@@ -1175,6 +1183,9 @@ void kvm_arch_save_regs(CPUState *env)
msrs[n++].index = MSR_LSTAR;
}
#endif
+ msrs[n++].index = MSR_KVM_SYSTEM_TIME;
+ msrs[n++].index = MSR_KVM_WALL_CLOCK;
+
rc = kvm_get_msrs(env, msrs, n);
if (rc == -1) {
perror("kvm_get_msrs FAILED");