Commit 84c8c5b8 authored by Jim Mattson's avatar Jim Mattson Committed by Paolo Bonzini

kvm: vmx: Skip all SYSCALL MSRs in setup_msrs() when !EFER.SCE

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: default avatarJim Mattson <jmattson@google.com>
Reviewed-by: default avatarPeter Shier <pshier@google.com>
Reviewed-by: default avatarMarc Orr <marcorr@google.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent db31c8f5
...@@ -1375,19 +1375,19 @@ static void setup_msrs(struct vcpu_vmx *vmx) ...@@ -1375,19 +1375,19 @@ static void setup_msrs(struct vcpu_vmx *vmx)
save_nmsrs = 0; save_nmsrs = 0;
#ifdef CONFIG_X86_64 #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) if (index >= 0)
move_msr_up(vmx, index, save_nmsrs++); move_msr_up(vmx, index, save_nmsrs++);
index = __find_msr_index(vmx, MSR_LSTAR); index = __find_msr_index(vmx, MSR_LSTAR);
if (index >= 0) if (index >= 0)
move_msr_up(vmx, index, save_nmsrs++); move_msr_up(vmx, index, save_nmsrs++);
/* index = __find_msr_index(vmx, MSR_SYSCALL_MASK);
* MSR_STAR is only needed on long mode guests, and only if (index >= 0)
* if efer.sce is enabled.
*/
index = __find_msr_index(vmx, MSR_STAR);
if ((index >= 0) && (vmx->vcpu.arch.efer & EFER_SCE))
move_msr_up(vmx, index, save_nmsrs++); move_msr_up(vmx, index, save_nmsrs++);
} }
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment