Re: [PATCH 02/14] KVM: monolithic: x86: disable linking vmx and svm at the same time into the kernel
From: Sean Christopherson
Date: Mon Oct 14 2019 - 23:16:23 EST
On Sat, Sep 28, 2019 at 01:23:11PM -0400, Andrea Arcangeli wrote:
> 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
Hmm, I see why the previous patch left KVM as a tristate. I tried a
variety of hacks to let KVM be a bool but nothing worked.
> +
> +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"
The prompt and choice text is way too long, e.g. in my usual window it
cuts off at:
To link KVM statically into the kernel you need to choose (Link KVM Intel statically into
Without the full text (the -> at the end), it's not obvious it's an option
menu (AMD was selected by default for me and it took me a second to figure
out what to hit enter on).
I think short and sweet is enough for the prompt, with the details of how
build both buried in the help text.
choice
prompt "KVM built-in support"
help
Here be a long and detailed help text.
config KVM_AMD_STATIC
select KVM_AMD
bool "KVM AMD"
config KVM_INTEL_STATIC
select KVM_INTEL
bool "KVM Intel"
endchoice
The ends up looking like:
<*> Kernel-based Virtual Machine (KVM) support
KVM built-in support (KVM Intel) --->
-*- KVM for Intel processors support
> +
> +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.