diff options
Diffstat (limited to 'arch/x86/kvm/vmx.c')
-rw-r--r-- | arch/x86/kvm/vmx.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index c7668806163f..3f1696570b41 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -1494,6 +1494,12 @@ static inline bool cpu_has_vmx_vmfunc(void) | |||
1494 | SECONDARY_EXEC_ENABLE_VMFUNC; | 1494 | SECONDARY_EXEC_ENABLE_VMFUNC; |
1495 | } | 1495 | } |
1496 | 1496 | ||
1497 | static bool vmx_umip_emulated(void) | ||
1498 | { | ||
1499 | return vmcs_config.cpu_based_2nd_exec_ctrl & | ||
1500 | SECONDARY_EXEC_DESC; | ||
1501 | } | ||
1502 | |||
1497 | static inline bool report_flexpriority(void) | 1503 | static inline bool report_flexpriority(void) |
1498 | { | 1504 | { |
1499 | return flexpriority_enabled; | 1505 | return flexpriority_enabled; |
@@ -4761,14 +4767,16 @@ static int vmx_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) | |||
4761 | else | 4767 | else |
4762 | hw_cr4 |= KVM_PMODE_VM_CR4_ALWAYS_ON; | 4768 | hw_cr4 |= KVM_PMODE_VM_CR4_ALWAYS_ON; |
4763 | 4769 | ||
4764 | if ((cr4 & X86_CR4_UMIP) && !boot_cpu_has(X86_FEATURE_UMIP)) { | 4770 | if (!boot_cpu_has(X86_FEATURE_UMIP) && vmx_umip_emulated()) { |
4765 | vmcs_set_bits(SECONDARY_VM_EXEC_CONTROL, | 4771 | if (cr4 & X86_CR4_UMIP) { |
4766 | SECONDARY_EXEC_DESC); | 4772 | vmcs_set_bits(SECONDARY_VM_EXEC_CONTROL, |
4767 | hw_cr4 &= ~X86_CR4_UMIP; | ||
4768 | } else if (!is_guest_mode(vcpu) || | ||
4769 | !nested_cpu_has2(get_vmcs12(vcpu), SECONDARY_EXEC_DESC)) | ||
4770 | vmcs_clear_bits(SECONDARY_VM_EXEC_CONTROL, | ||
4771 | SECONDARY_EXEC_DESC); | 4773 | SECONDARY_EXEC_DESC); |
4774 | hw_cr4 &= ~X86_CR4_UMIP; | ||
4775 | } else if (!is_guest_mode(vcpu) || | ||
4776 | !nested_cpu_has2(get_vmcs12(vcpu), SECONDARY_EXEC_DESC)) | ||
4777 | vmcs_clear_bits(SECONDARY_VM_EXEC_CONTROL, | ||
4778 | SECONDARY_EXEC_DESC); | ||
4779 | } | ||
4772 | 4780 | ||
4773 | if (cr4 & X86_CR4_VMXE) { | 4781 | if (cr4 & X86_CR4_VMXE) { |
4774 | /* | 4782 | /* |
@@ -9497,12 +9505,6 @@ static bool vmx_xsaves_supported(void) | |||
9497 | SECONDARY_EXEC_XSAVES; | 9505 | SECONDARY_EXEC_XSAVES; |
9498 | } | 9506 | } |
9499 | 9507 | ||
9500 | static bool vmx_umip_emulated(void) | ||
9501 | { | ||
9502 | return vmcs_config.cpu_based_2nd_exec_ctrl & | ||
9503 | SECONDARY_EXEC_DESC; | ||
9504 | } | ||
9505 | |||
9506 | static void vmx_recover_nmi_blocking(struct vcpu_vmx *vmx) | 9508 | static void vmx_recover_nmi_blocking(struct vcpu_vmx *vmx) |
9507 | { | 9509 | { |
9508 | u32 exit_intr_info; | 9510 | u32 exit_intr_info; |