Commit ea4290d7 authored by Paolo Bonzini's avatar Paolo Bonzini

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: 590b09b1 ("KVM: x86: Register "emergency disable" callbacks when virt is enabled")
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent fcd1ec9c
...@@ -17,8 +17,8 @@ menuconfig VIRTUALIZATION ...@@ -17,8 +17,8 @@ menuconfig VIRTUALIZATION
if VIRTUALIZATION if VIRTUALIZATION
config KVM config KVM_X86
tristate "Kernel-based Virtual Machine (KVM) support" def_tristate KVM if KVM_INTEL || KVM_AMD
depends on X86_LOCAL_APIC depends on X86_LOCAL_APIC
select KVM_COMMON select KVM_COMMON
select KVM_GENERIC_MMU_NOTIFIER select KVM_GENERIC_MMU_NOTIFIER
...@@ -44,7 +44,11 @@ config KVM ...@@ -44,7 +44,11 @@ config KVM
select HAVE_KVM_PM_NOTIFIER if PM select HAVE_KVM_PM_NOTIFIER if PM
select KVM_GENERIC_HARDWARE_ENABLING select KVM_GENERIC_HARDWARE_ENABLING
select KVM_GENERIC_PRE_FAULT_MEMORY select KVM_GENERIC_PRE_FAULT_MEMORY
select KVM_GENERIC_PRIVATE_MEM if KVM_SW_PROTECTED_VM
select KVM_WERROR if WERROR select KVM_WERROR if WERROR
config KVM
tristate "Kernel-based Virtual Machine (KVM) support"
help help
Support hosting fully virtualized guest machines using hardware Support hosting fully virtualized guest machines using hardware
virtualization extensions. You will need a fairly recent virtualization extensions. You will need a fairly recent
...@@ -77,7 +81,6 @@ config KVM_SW_PROTECTED_VM ...@@ -77,7 +81,6 @@ config KVM_SW_PROTECTED_VM
bool "Enable support for KVM software-protected VMs" bool "Enable support for KVM software-protected VMs"
depends on EXPERT depends on EXPERT
depends on KVM && X86_64 depends on KVM && X86_64
select KVM_GENERIC_PRIVATE_MEM
help help
Enable support for KVM software-protected VMs. Currently, software- Enable support for KVM software-protected VMs. Currently, software-
protected VMs are purely a development and testing vehicle for protected VMs are purely a development and testing vehicle for
......
...@@ -32,7 +32,7 @@ kvm-intel-y += vmx/vmx_onhyperv.o vmx/hyperv_evmcs.o ...@@ -32,7 +32,7 @@ kvm-intel-y += vmx/vmx_onhyperv.o vmx/hyperv_evmcs.o
kvm-amd-y += svm/svm_onhyperv.o kvm-amd-y += svm/svm_onhyperv.o
endif endif
obj-$(CONFIG_KVM) += kvm.o obj-$(CONFIG_KVM_X86) += kvm.o
obj-$(CONFIG_KVM_INTEL) += kvm-intel.o obj-$(CONFIG_KVM_INTEL) += kvm-intel.o
obj-$(CONFIG_KVM_AMD) += kvm-amd.o obj-$(CONFIG_KVM_AMD) += kvm-amd.o
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment