diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-06-12 23:28:00 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-06-12 23:28:00 -0400 |
commit | dbee3d02458b129b847c21f5fa60baba3eafc6f7 (patch) | |
tree | 5aaac9919c7544daba61b3180a8f5fd309b37fd2 | |
parent | b08fc5277aaa1d8ea15470d38bf36f19dfb0e125 (diff) |
KVM: x86: VMX: fix build without hyper-v
Commit ceef7d10dfb6 ("KVM: x86: VMX: hyper-v: Enlightened MSR-Bitmap
support") broke the build with Hyper-V disabled, because it accesses
ms_hyperv.nested_features without checking if that exists.
This is the quick-and-hacky build fix.
I suspect the proper fix is to replace the
static_branch_unlikely(&enable_evmcs)
tests with an inline helper function that also checks that CONFIG_HYPERV
is enabled, since without that, enable_evmcs makes no sense.
But I want a working build environment first and foremost, and I'm upset
this slipped through in the first place. My primary build tests missed
it because I tend to build with everything enabled, but it should have
been caught in the kvm tree.
Fixes: ceef7d10dfb6 ("KVM: x86: VMX: hyper-v: Enlightened MSR-Bitmap support")
Cc: Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | arch/x86/kvm/vmx.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index fc61e25966e4..d0dd35d582da 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -4429,6 +4429,7 @@ static int alloc_loaded_vmcs(struct loaded_vmcs *loaded_vmcs) | |||
4429 | goto out_vmcs; | 4429 | goto out_vmcs; |
4430 | memset(loaded_vmcs->msr_bitmap, 0xff, PAGE_SIZE); | 4430 | memset(loaded_vmcs->msr_bitmap, 0xff, PAGE_SIZE); |
4431 | 4431 | ||
4432 | #if IS_ENABLED(CONFIG_HYPERV) | ||
4432 | if (static_branch_unlikely(&enable_evmcs) && | 4433 | if (static_branch_unlikely(&enable_evmcs) && |
4433 | (ms_hyperv.nested_features & HV_X64_NESTED_MSR_BITMAP)) { | 4434 | (ms_hyperv.nested_features & HV_X64_NESTED_MSR_BITMAP)) { |
4434 | struct hv_enlightened_vmcs *evmcs = | 4435 | struct hv_enlightened_vmcs *evmcs = |
@@ -4436,6 +4437,8 @@ static int alloc_loaded_vmcs(struct loaded_vmcs *loaded_vmcs) | |||
4436 | 4437 | ||
4437 | evmcs->hv_enlightenments_control.msr_bitmap = 1; | 4438 | evmcs->hv_enlightenments_control.msr_bitmap = 1; |
4438 | } | 4439 | } |
4440 | #endif | ||
4441 | |||
4439 | } | 4442 | } |
4440 | return 0; | 4443 | return 0; |
4441 | 4444 | ||