aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlauber Costa <glommer@redhat.com>2010-05-11 12:17:41 -0400
committerAvi Kivity <avi@redhat.com>2010-05-19 04:41:01 -0400
commit11c6bffa42b85e703c21a1d2372dce7262daca8e (patch)
tree54524f3693895ccfa95b3e28a75cd2c4bb55969b
parent489fb490dbf8dab0249ad82b56688ae3842a79e8 (diff)
KVM: x86: change msr numbers for kvmclock
Avi pointed out a while ago that those MSRs falls into the pentium PMU range. So the idea here is to add new ones, and after a while, deprecate the old ones. Signed-off-by: Glauber Costa <glommer@redhat.com> Acked-by: Zachary Amsden <zamsden@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
-rw-r--r--arch/x86/include/asm/kvm_para.h4
-rw-r--r--arch/x86/kvm/x86.c7
2 files changed, 10 insertions, 1 deletions
diff --git a/arch/x86/include/asm/kvm_para.h b/arch/x86/include/asm/kvm_para.h
index ffae1420e7d7..97348082782a 100644
--- a/arch/x86/include/asm/kvm_para.h
+++ b/arch/x86/include/asm/kvm_para.h
@@ -20,6 +20,10 @@
20#define MSR_KVM_WALL_CLOCK 0x11 20#define MSR_KVM_WALL_CLOCK 0x11
21#define MSR_KVM_SYSTEM_TIME 0x12 21#define MSR_KVM_SYSTEM_TIME 0x12
22 22
23/* Custom MSRs falls in the range 0x4b564d00-0x4b564dff */
24#define MSR_KVM_WALL_CLOCK_NEW 0x4b564d00
25#define MSR_KVM_SYSTEM_TIME_NEW 0x4b564d01
26
23#define KVM_MAX_MMU_OP_BATCH 32 27#define KVM_MAX_MMU_OP_BATCH 32
24 28
25/* Operations for KVM_HC_MMU_OP */ 29/* Operations for KVM_HC_MMU_OP */
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index fe6d126633d8..73d342c69ed4 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -664,9 +664,10 @@ static inline u32 bit(int bitno)
664 * kvm-specific. Those are put in the beginning of the list. 664 * kvm-specific. Those are put in the beginning of the list.
665 */ 665 */
666 666
667#define KVM_SAVE_MSRS_BEGIN 5 667#define KVM_SAVE_MSRS_BEGIN 7
668static u32 msrs_to_save[] = { 668static u32 msrs_to_save[] = {
669 MSR_KVM_SYSTEM_TIME, MSR_KVM_WALL_CLOCK, 669 MSR_KVM_SYSTEM_TIME, MSR_KVM_WALL_CLOCK,
670 MSR_KVM_SYSTEM_TIME_NEW, MSR_KVM_WALL_CLOCK_NEW,
670 HV_X64_MSR_GUEST_OS_ID, HV_X64_MSR_HYPERCALL, 671 HV_X64_MSR_GUEST_OS_ID, HV_X64_MSR_HYPERCALL,
671 HV_X64_MSR_APIC_ASSIST_PAGE, 672 HV_X64_MSR_APIC_ASSIST_PAGE,
672 MSR_IA32_SYSENTER_CS, MSR_IA32_SYSENTER_ESP, MSR_IA32_SYSENTER_EIP, 673 MSR_IA32_SYSENTER_CS, MSR_IA32_SYSENTER_ESP, MSR_IA32_SYSENTER_EIP,
@@ -1193,10 +1194,12 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 data)
1193 case MSR_IA32_MISC_ENABLE: 1194 case MSR_IA32_MISC_ENABLE:
1194 vcpu->arch.ia32_misc_enable_msr = data; 1195 vcpu->arch.ia32_misc_enable_msr = data;
1195 break; 1196 break;
1197 case MSR_KVM_WALL_CLOCK_NEW:
1196 case MSR_KVM_WALL_CLOCK: 1198 case MSR_KVM_WALL_CLOCK:
1197 vcpu->kvm->arch.wall_clock = data; 1199 vcpu->kvm->arch.wall_clock = data;
1198 kvm_write_wall_clock(vcpu->kvm, data); 1200 kvm_write_wall_clock(vcpu->kvm, data);
1199 break; 1201 break;
1202 case MSR_KVM_SYSTEM_TIME_NEW:
1200 case MSR_KVM_SYSTEM_TIME: { 1203 case MSR_KVM_SYSTEM_TIME: {
1201 if (vcpu->arch.time_page) { 1204 if (vcpu->arch.time_page) {
1202 kvm_release_page_dirty(vcpu->arch.time_page); 1205 kvm_release_page_dirty(vcpu->arch.time_page);
@@ -1468,9 +1471,11 @@ int kvm_get_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 *pdata)
1468 data = vcpu->arch.efer; 1471 data = vcpu->arch.efer;
1469 break; 1472 break;
1470 case MSR_KVM_WALL_CLOCK: 1473 case MSR_KVM_WALL_CLOCK:
1474 case MSR_KVM_WALL_CLOCK_NEW:
1471 data = vcpu->kvm->arch.wall_clock; 1475 data = vcpu->kvm->arch.wall_clock;
1472 break; 1476 break;
1473 case MSR_KVM_SYSTEM_TIME: 1477 case MSR_KVM_SYSTEM_TIME:
1478 case MSR_KVM_SYSTEM_TIME_NEW:
1474 data = vcpu->arch.time; 1479 data = vcpu->arch.time;
1475 break; 1480 break;
1476 case MSR_IA32_P5_MC_ADDR: 1481 case MSR_IA32_P5_MC_ADDR: