Re: [PATCH v3 3/7] KVM: SEV: Set supported SEV+ VM types during sev_hardware_setup()
From: Tom Lendacky
Date: Fri Apr 17 2026 - 10:24:35 EST
On 4/16/26 18:23, Sean Christopherson wrote:
> Set the supported SEV+ VM types during sev_hardware_setup() instead of
> waiting until sev_set_cpu_caps(). This will using the set of *fully*
> supported VM types to print the enabled/unusable/disabled messaged.
>
> For all intents and purposes, no functional change intended.
>
> Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx>
Reviewed-by: Tom Lendacky <thomas.lendacky@xxxxxxx>
> ---
> arch/x86/kvm/svm/sev.c | 21 ++++++++++++---------
> 1 file changed, 12 insertions(+), 9 deletions(-)
>
> diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c
> index c2126b3c3072..ea4ce371d5f3 100644
> --- a/arch/x86/kvm/svm/sev.c
> +++ b/arch/x86/kvm/svm/sev.c
> @@ -3013,18 +3013,14 @@ void sev_vm_destroy(struct kvm *kvm)
>
> void __init sev_set_cpu_caps(void)
> {
> - if (sev_enabled) {
> + if (sev_enabled)
> kvm_cpu_cap_set(X86_FEATURE_SEV);
> - kvm_caps.supported_vm_types |= BIT(KVM_X86_SEV_VM);
> - }
> - if (sev_es_enabled) {
> +
> + if (sev_es_enabled)
> kvm_cpu_cap_set(X86_FEATURE_SEV_ES);
> - kvm_caps.supported_vm_types |= BIT(KVM_X86_SEV_ES_VM);
> - }
> - if (sev_snp_enabled) {
> +
> + if (sev_snp_enabled)
> kvm_cpu_cap_set(X86_FEATURE_SEV_SNP);
> - kvm_caps.supported_vm_types |= BIT(KVM_X86_SNP_VM);
> - }
> }
>
> static bool is_sev_snp_initialized(void)
> @@ -3194,6 +3190,13 @@ void __init sev_hardware_setup(void)
> }
> }
>
> + if (sev_supported)
> + kvm_caps.supported_vm_types |= BIT(KVM_X86_SEV_VM);
> + if (sev_es_supported)
> + kvm_caps.supported_vm_types |= BIT(KVM_X86_SEV_ES_VM);
> + if (sev_snp_supported)
> + kvm_caps.supported_vm_types |= BIT(KVM_X86_SNP_VM);
> +
> if (boot_cpu_has(X86_FEATURE_SEV))
> pr_info("SEV %s (ASIDs %u - %u)\n",
> sev_supported ? min_sev_asid <= max_sev_asid ? "enabled" :