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

From: Paolo Bonzini
Date: Tue Oct 15 2019 - 04:22:04 EST


On 15/10/19 05:16, Sean Christopherson wrote:
> 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"

Or even just

bool "AMD"
...
bool "Intel"

> endchoice
>
> The ends up looking like:
>
> <*> Kernel-based Virtual Machine (KVM) support
> KVM built-in support (KVM Intel) --->
> -*- KVM for Intel processors support

On top of this, it's also nice to hide the KVM_INTEL/KVM_AMD prompts if
linking statically. You can achieve that with

config KVM_INTEL
tristate
prompt "KVM for Intel processors support" if KVM=m
depends on (KVM=m && m) || KVM_INTEL_STATIC

config KVM_AMD
tristate
prompt "KVM for AMD processors support" if KVM=m
depends on (KVM=m && m) || KVM_AMD_STATIC

The left side of the "||" ensures that, if KVM=m, you can only choose
module build for both KVM_INTEL and KVM_AMD. Having just "depends on
KVM" would allow a pre-existing .config to choose the now-invalid
combination

CONFIG_KVM=y
CONFIG_KVM_INTEL=y
CONFIG_KVM_AMD=y

The right side of the "||" part is just for documentation, to avoid that
a selected symbol does not satisfy its dependencies.

Thanks,

Paolo