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

From: Sean Christopherson
Date: Tue Oct 15 2019 - 11:23:15 EST


On Tue, Oct 15, 2019 at 10:21:59AM +0200, Paolo Bonzini wrote:
> 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"

Ya.

> > 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

That's painfully obvious now that I see it. I always forget about putting
conditionals at the end...

> 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