Skip to content

Commit dbee3d0

Browse files
committed
KVM: x86: VMX: fix build without hyper-v
Commit ceef7d1 ("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: ceef7d1 ("KVM: x86: VMX: hyper-v: Enlightened MSR-Bitmap support") Cc: Vitaly Kuznetsov <[email protected]> Cc: Paolo Bonzini <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent b08fc52 commit dbee3d0

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

arch/x86/kvm/vmx.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4429,13 +4429,16 @@ static int alloc_loaded_vmcs(struct loaded_vmcs *loaded_vmcs)
44294429
goto out_vmcs;
44304430
memset(loaded_vmcs->msr_bitmap, 0xff, PAGE_SIZE);
44314431

4432+
#if IS_ENABLED(CONFIG_HYPERV)
44324433
if (static_branch_unlikely(&enable_evmcs) &&
44334434
(ms_hyperv.nested_features & HV_X64_NESTED_MSR_BITMAP)) {
44344435
struct hv_enlightened_vmcs *evmcs =
44354436
(struct hv_enlightened_vmcs *)loaded_vmcs->vmcs;
44364437

44374438
evmcs->hv_enlightenments_control.msr_bitmap = 1;
44384439
}
4440+
#endif
4441+
44394442
}
44404443
return 0;
44414444

0 commit comments

Comments
 (0)