Skip to content

Commit 5a5e8a1

Browse files
Sean Christophersonbonzini
authored andcommitted
KVM: vmx: write HOST_IA32_EFER in vmx_set_constant_host_state()
EFER is constant in the host and writing it once during setup means we can skip writing the host value in add_atomic_switch_msr_special(). Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com> Reviewed-by: Jim Mattson <jmattson@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
1 parent 09abb5e commit 5a5e8a1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

arch/x86/kvm/vmx.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2696,7 +2696,8 @@ static void add_atomic_switch_msr_special(struct vcpu_vmx *vmx,
26962696
u64 guest_val, u64 host_val)
26972697
{
26982698
vmcs_write64(guest_val_vmcs, guest_val);
2699-
vmcs_write64(host_val_vmcs, host_val);
2699+
if (host_val_vmcs != HOST_IA32_EFER)
2700+
vmcs_write64(host_val_vmcs, host_val);
27002701
vm_entry_controls_setbit(vmx, entry);
27012702
vm_exit_controls_setbit(vmx, exit);
27022703
}
@@ -6333,6 +6334,9 @@ static void vmx_set_constant_host_state(struct vcpu_vmx *vmx)
63336334
rdmsr(MSR_IA32_CR_PAT, low32, high32);
63346335
vmcs_write64(HOST_IA32_PAT, low32 | ((u64) high32 << 32));
63356336
}
6337+
6338+
if (cpu_has_load_ia32_efer)
6339+
vmcs_write64(HOST_IA32_EFER, host_efer);
63366340
}
63376341

63386342
static void set_cr4_guest_host_mask(struct vcpu_vmx *vmx)

0 commit comments

Comments
 (0)