[PATCH 02/14] KVM: monolithic: x86: disable linking vmx and svm at the same time into the kernel

From: Andrea Arcangeli
Date: Sat Sep 28 2019 - 13:24:02 EST


Linking both vmx and svm into the kernel at the same time isn't
possible anymore or the kvm_x86/kvm_x86_pmu external function names
would collide.

Reported-by: kbuild test robot <lkp@xxxxxxxxx>
Signed-off-by: Andrea Arcangeli <aarcange@xxxxxxxxxx>
---
arch/x86/kvm/Kconfig | 24 ++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kvm/Kconfig b/arch/x86/kvm/Kconfig
index 840e12583b85..e1601c54355e 100644
--- a/arch/x86/kvm/Kconfig
+++ b/arch/x86/kvm/Kconfig
@@ -59,9 +59,29 @@ config KVM

If unsure, say N.

+if KVM=y
+
+choice
+ prompt "To link KVM statically into the kernel you need to choose"
+ help
+ In order to build a kernel with support for both AMD and Intel
+ CPUs, you need to set CONFIG_KVM=m.
+
+config KVM_AMD_STATIC
+ select KVM_AMD
+ bool "Link KVM AMD statically into the kernel"
+
+config KVM_INTEL_STATIC
+ select KVM_INTEL
+ bool "Link KVM Intel statically into the kernel"
+
+endchoice
+
+endif
+
config KVM_INTEL
tristate "KVM for Intel processors support"
- depends on KVM
+ depends on (KVM && !KVM_AMD_STATIC) || KVM_INTEL_STATIC
# for perf_guest_get_msrs():
depends on CPU_SUP_INTEL
---help---
@@ -73,7 +93,7 @@ config KVM_INTEL

config KVM_AMD
tristate "KVM for AMD processors support"
- depends on KVM
+ depends on (KVM && !KVM_INTEL_STATIC) || KVM_AMD_STATIC
---help---
Provides support for KVM on AMD processors equipped with the AMD-V
(SVM) extensions.