Re: [PATCH v2 04/11] KVM: SEV: publish supported VMSA features

From: Sean Christopherson
Date: Fri Feb 23 2024 - 12:02:05 EST


On Fri, Feb 23, 2024, Paolo Bonzini wrote:
> On 2/23/24 17:07, Sean Christopherson wrote:
> > > diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c
> > > index f760106c31f8..53e958805ab9 100644
> > > --- a/arch/x86/kvm/svm/sev.c
> > > +++ b/arch/x86/kvm/svm/sev.c
> > > @@ -59,10 +59,12 @@ module_param_named(sev_es, sev_es_enabled, bool, 0444);
> > > /* enable/disable SEV-ES DebugSwap support */
> > > static bool sev_es_debug_swap_enabled = true;
> > > module_param_named(debug_swap, sev_es_debug_swap_enabled, bool, 0444);
> > > +static u64 sev_supported_vmsa_features;
> > > #else
> > > #define sev_enabled false
> > > #define sev_es_enabled false
> > > #define sev_es_debug_swap_enabled false
> > > +#define sev_supported_vmsa_features 0
> >
> > Ok, I've reached my breaking point. Compiling sev.c for CONFIG_KVM_AMD_SEV=n is
> > getting untenable. Splattering #ifdefs _inside_ SEV specific functions is weird
> > and confusing.
>
> Ok, I think in some cases I prefer stubs but I'll weave your 4 patches in
> v3.

No problem, I don't have a strong preference. I initially added stubs instead of
the IS_ENABLED(). The main reason I switched is when I realized that sev_set_cpu_caps()
*cleared* capabilities, and so decided it would be safer to have a separate patch
that effectively stubbed out the global SEV calls.