lkml.org 
[lkml]   [2019]   [Nov]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v3 10/19] KVM: VMX: Use VMX feature flag to query BIOS enabling
Date
Replace KVM's manual checks on IA32_FEATURE_CONTROL with a query on the
boot CPU's VMX feature flag. The VMX flag is now cleared during boot if
VMX isn't fully enabled via IA32_FEATURE_CONTROL, including the case
where IA32_FEATURE_CONTROL isn't supported.

Reviewed-by: Jim Mattson <jmattson@google.com>
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
---
arch/x86/kvm/vmx/vmx.c | 26 +-------------------------
1 file changed, 1 insertion(+), 25 deletions(-)

diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
index e9681e3fcb63..eff28130cb54 100644
--- a/arch/x86/kvm/vmx/vmx.c
+++ b/arch/x86/kvm/vmx/vmx.c
@@ -2192,31 +2192,7 @@ static __init int cpu_has_kvm_support(void)

static __init int vmx_disabled_by_bios(void)
{
- u64 msr;
-
- rdmsrl(MSR_IA32_FEATURE_CONTROL, msr);
-
- if (WARN_ON_ONCE(!(msr & FEAT_CTL_LOCKED)))
- return 1;
-
- /* launched w/ TXT and VMX disabled */
- if (!(msr & FEAT_CTL_VMX_ENABLED_INSIDE_SMX) &&
- tboot_enabled())
- return 1;
- /* launched w/o TXT and VMX only enabled w/ TXT */
- if (!(msr & FEAT_CTL_VMX_ENABLED_OUTSIDE_SMX) &&
- (msr & FEAT_CTL_VMX_ENABLED_INSIDE_SMX) &&
- !tboot_enabled()) {
- pr_warn("kvm: disable TXT in the BIOS or "
- "activate TXT before enabling KVM\n");
- return 1;
- }
- /* launched w/o TXT and VMX disabled */
- if (!(msr & FEAT_CTL_VMX_ENABLED_OUTSIDE_SMX) &&
- !tboot_enabled())
- return 1;
-
- return 0;
+ return !boot_cpu_has(X86_FEATURE_VMX);
}

static void kvm_cpu_vmxon(u64 addr)
--
2.24.0
\
 
 \ /
  Last update: 2019-11-19 04:15    [W:0.203 / U:0.272 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site