Commit 5a5e8a15 authored by Sean Christopherson's avatar Sean Christopherson Committed by Paolo Bonzini

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: default avatarSean Christopherson <sean.j.christopherson@intel.com>
Reviewed-by: default avatarJim Mattson <jmattson@google.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent 09abb5e3
...@@ -2696,6 +2696,7 @@ static void add_atomic_switch_msr_special(struct vcpu_vmx *vmx, ...@@ -2696,6 +2696,7 @@ static void add_atomic_switch_msr_special(struct vcpu_vmx *vmx,
u64 guest_val, u64 host_val) u64 guest_val, u64 host_val)
{ {
vmcs_write64(guest_val_vmcs, guest_val); vmcs_write64(guest_val_vmcs, guest_val);
if (host_val_vmcs != HOST_IA32_EFER)
vmcs_write64(host_val_vmcs, host_val); vmcs_write64(host_val_vmcs, host_val);
vm_entry_controls_setbit(vmx, entry); vm_entry_controls_setbit(vmx, entry);
vm_exit_controls_setbit(vmx, exit); vm_exit_controls_setbit(vmx, exit);
...@@ -6333,6 +6334,9 @@ static void vmx_set_constant_host_state(struct vcpu_vmx *vmx) ...@@ -6333,6 +6334,9 @@ static void vmx_set_constant_host_state(struct vcpu_vmx *vmx)
rdmsr(MSR_IA32_CR_PAT, low32, high32); rdmsr(MSR_IA32_CR_PAT, low32, high32);
vmcs_write64(HOST_IA32_PAT, low32 | ((u64) high32 << 32)); vmcs_write64(HOST_IA32_PAT, low32 | ((u64) high32 << 32));
} }
if (cpu_has_load_ia32_efer)
vmcs_write64(HOST_IA32_EFER, host_efer);
} }
static void set_cr4_guest_host_mask(struct vcpu_vmx *vmx) static void set_cr4_guest_host_mask(struct vcpu_vmx *vmx)
......
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