Skip to content

Commit ea4290d

Browse files
committed
KVM: x86: leave kvm.ko out of the build if no vendor module is requested
kvm.ko is nothing but library code shared by kvm-intel.ko and kvm-amd.ko. It provides no functionality on its own and it is unnecessary unless one of the vendor-specific module is compiled. In particular, /dev/kvm is not created until one of kvm-intel.ko or kvm-amd.ko is loaded. Use CONFIG_KVM to decide if it is built-in or a module, but use the vendor-specific modules for the actual decision on whether to build it. This also fixes a build failure when CONFIG_KVM_INTEL and CONFIG_KVM_AMD are both disabled. The cpu_emergency_register_virt_callback() function is called from kvm.ko, but it is only defined if at least one of CONFIG_KVM_INTEL and CONFIG_KVM_AMD is provided. Fixes: 590b09b ("KVM: x86: Register "emergency disable" callbacks when virt is enabled") Signed-off-by: Paolo Bonzini <[email protected]>
1 parent fcd1ec9 commit ea4290d

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

arch/x86/kvm/Kconfig

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ menuconfig VIRTUALIZATION
1717

1818
if VIRTUALIZATION
1919

20-
config KVM
21-
tristate "Kernel-based Virtual Machine (KVM) support"
20+
config KVM_X86
21+
def_tristate KVM if KVM_INTEL || KVM_AMD
2222
depends on X86_LOCAL_APIC
2323
select KVM_COMMON
2424
select KVM_GENERIC_MMU_NOTIFIER
@@ -44,7 +44,11 @@ config KVM
4444
select HAVE_KVM_PM_NOTIFIER if PM
4545
select KVM_GENERIC_HARDWARE_ENABLING
4646
select KVM_GENERIC_PRE_FAULT_MEMORY
47+
select KVM_GENERIC_PRIVATE_MEM if KVM_SW_PROTECTED_VM
4748
select KVM_WERROR if WERROR
49+
50+
config KVM
51+
tristate "Kernel-based Virtual Machine (KVM) support"
4852
help
4953
Support hosting fully virtualized guest machines using hardware
5054
virtualization extensions. You will need a fairly recent
@@ -77,7 +81,6 @@ config KVM_SW_PROTECTED_VM
7781
bool "Enable support for KVM software-protected VMs"
7882
depends on EXPERT
7983
depends on KVM && X86_64
80-
select KVM_GENERIC_PRIVATE_MEM
8184
help
8285
Enable support for KVM software-protected VMs. Currently, software-
8386
protected VMs are purely a development and testing vehicle for

arch/x86/kvm/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ kvm-intel-y += vmx/vmx_onhyperv.o vmx/hyperv_evmcs.o
3232
kvm-amd-y += svm/svm_onhyperv.o
3333
endif
3434

35-
obj-$(CONFIG_KVM) += kvm.o
35+
obj-$(CONFIG_KVM_X86) += kvm.o
3636
obj-$(CONFIG_KVM_INTEL) += kvm-intel.o
3737
obj-$(CONFIG_KVM_AMD) += kvm-amd.o
3838

0 commit comments

Comments
 (0)