]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
kvm: vmx: Skip all SYSCALL MSRs in setup_msrs() when !EFER.SCE
authorJim Mattson <jmattson@google.com>
Wed, 5 Dec 2018 23:29:01 +0000 (15:29 -0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 14 Dec 2018 16:59:49 +0000 (17:59 +0100)
Like IA32_STAR, IA32_LSTAR and IA32_FMASK only need to contain guest
values on VM-entry when the guest is in long mode and EFER.SCE is set.

Signed-off-by: Jim Mattson <jmattson@google.com>
Reviewed-by: Peter Shier <pshier@google.com>
Reviewed-by: Marc Orr <marcorr@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/vmx/vmx.c

index 2084db09762214b1e389e1ef950cad53d8d188f4..579f4c4144d2d67c60d0a3eace1aa9011fbf3011 100644 (file)
@@ -1375,19 +1375,19 @@ static void setup_msrs(struct vcpu_vmx *vmx)
 
        save_nmsrs = 0;
 #ifdef CONFIG_X86_64
-       if (is_long_mode(&vmx->vcpu)) {
-               index = __find_msr_index(vmx, MSR_SYSCALL_MASK);
+       /*
+        * The SYSCALL MSRs are only needed on long mode guests, and only
+        * when EFER.SCE is set.
+        */
+       if (is_long_mode(&vmx->vcpu) && (vmx->vcpu.arch.efer & EFER_SCE)) {
+               index = __find_msr_index(vmx, MSR_STAR);
                if (index >= 0)
                        move_msr_up(vmx, index, save_nmsrs++);
                index = __find_msr_index(vmx, MSR_LSTAR);
                if (index >= 0)
                        move_msr_up(vmx, index, save_nmsrs++);
-               /*
-                * MSR_STAR is only needed on long mode guests, and only
-                * if efer.sce is enabled.
-                */
-               index = __find_msr_index(vmx, MSR_STAR);
-               if ((index >= 0) && (vmx->vcpu.arch.efer & EFER_SCE))
+               index = __find_msr_index(vmx, MSR_SYSCALL_MASK);
+               if (index >= 0)
                        move_msr_up(vmx, index, save_nmsrs++);
        }
 #endif