aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/x86.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/kvm/x86.c')
-rw-r--r--arch/x86/kvm/x86.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 385cd0a1e23d..4de5bc0a8e86 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -503,16 +503,19 @@ static inline u32 bit(int bitno)
503 * and KVM_SET_MSRS, and KVM_GET_MSR_INDEX_LIST. 503 * and KVM_SET_MSRS, and KVM_GET_MSR_INDEX_LIST.
504 * 504 *
505 * This list is modified at module load time to reflect the 505 * This list is modified at module load time to reflect the
506 * capabilities of the host cpu. 506 * capabilities of the host cpu. This capabilities test skips MSRs that are
507 * kvm-specific. Those are put in the beginning of the list.
507 */ 508 */
509
510#define KVM_SAVE_MSRS_BEGIN 2
508static u32 msrs_to_save[] = { 511static u32 msrs_to_save[] = {
512 MSR_KVM_SYSTEM_TIME, MSR_KVM_WALL_CLOCK,
509 MSR_IA32_SYSENTER_CS, MSR_IA32_SYSENTER_ESP, MSR_IA32_SYSENTER_EIP, 513 MSR_IA32_SYSENTER_CS, MSR_IA32_SYSENTER_ESP, MSR_IA32_SYSENTER_EIP,
510 MSR_K6_STAR, 514 MSR_K6_STAR,
511#ifdef CONFIG_X86_64 515#ifdef CONFIG_X86_64
512 MSR_CSTAR, MSR_KERNEL_GS_BASE, MSR_SYSCALL_MASK, MSR_LSTAR, 516 MSR_CSTAR, MSR_KERNEL_GS_BASE, MSR_SYSCALL_MASK, MSR_LSTAR,
513#endif 517#endif
514 MSR_IA32_TSC, MSR_KVM_SYSTEM_TIME, MSR_KVM_WALL_CLOCK, 518 MSR_IA32_TSC, MSR_IA32_PERF_STATUS, MSR_IA32_CR_PAT, MSR_VM_HSAVE_PA
515 MSR_IA32_PERF_STATUS, MSR_IA32_CR_PAT, MSR_VM_HSAVE_PA
516}; 519};
517 520
518static unsigned num_msrs_to_save; 521static unsigned num_msrs_to_save;
@@ -2446,7 +2449,8 @@ static void kvm_init_msr_list(void)
2446 u32 dummy[2]; 2449 u32 dummy[2];
2447 unsigned i, j; 2450 unsigned i, j;
2448 2451
2449 for (i = j = 0; i < ARRAY_SIZE(msrs_to_save); i++) { 2452 /* skip the first msrs in the list. KVM-specific */
2453 for (i = j = KVM_SAVE_MSRS_BEGIN; i < ARRAY_SIZE(msrs_to_save); i++) {
2450 if (rdmsr_safe(msrs_to_save[i], &dummy[0], &dummy[1]) < 0) 2454 if (rdmsr_safe(msrs_to_save[i], &dummy[0], &dummy[1]) < 0)
2451 continue; 2455 continue;
2452 if (j < i) 2456 if (j < i)