Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

KVM: nVMX: Implement support for EFER saving on VM-exit

Implement and advertise VM_EXIT_SAVE_IA32_EFER. L0 traps EFER writes
unconditionally, so we always find the current L2 value in the
architectural state.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

authored by

Jan Kiszka and committed by
Paolo Bonzini
10ba54a5 59ab5a8f

+3 -1
+3 -1
arch/x86/kvm/vmx.c
··· 2206 2206 #endif 2207 2207 VM_EXIT_LOAD_IA32_PAT | VM_EXIT_SAVE_IA32_PAT; 2208 2208 nested_vmx_exit_ctls_high |= (VM_EXIT_ALWAYSON_WITHOUT_TRUE_MSR | 2209 - VM_EXIT_LOAD_IA32_EFER); 2209 + VM_EXIT_LOAD_IA32_EFER | VM_EXIT_SAVE_IA32_EFER); 2210 2210 2211 2211 /* entry controls */ 2212 2212 rdmsr(MSR_IA32_VMX_ENTRY_CTLS, ··· 8130 8130 vmcs12->guest_ia32_debugctl = vmcs_read64(GUEST_IA32_DEBUGCTL); 8131 8131 if (vmcs12->vm_exit_controls & VM_EXIT_SAVE_IA32_PAT) 8132 8132 vmcs12->guest_ia32_pat = vmcs_read64(GUEST_IA32_PAT); 8133 + if (vmcs12->vm_exit_controls & VM_EXIT_SAVE_IA32_EFER) 8134 + vmcs12->guest_ia32_efer = vcpu->arch.efer; 8133 8135 vmcs12->guest_sysenter_cs = vmcs_read32(GUEST_SYSENTER_CS); 8134 8136 vmcs12->guest_sysenter_esp = vmcs_readl(GUEST_SYSENTER_ESP); 8135 8137 vmcs12->guest_sysenter_eip = vmcs_readl(GUEST_SYSENTER_EIP);