Skip to content

Commit 6d1bc97

Browse files
mihalicynsean-jc
authored andcommitted
KVM: SVM: enhance info printk's in SEV init
Let's print available ASID ranges for SEV/SEV-ES guests. This information can be useful for system administrator to debug if SEV/SEV-ES fails to enable. There are a few reasons. SEV: - NPT is disabled (module parameter) - CPU lacks some features (sev, decodeassists) - Maximum SEV ASID is 0 SEV-ES: - mmio_caching is disabled (module parameter) - CPU lacks sev_es feature - Minimum SEV ASID value is 1 (can be adjusted in BIOS/UEFI) Cc: Sean Christopherson <seanjc@google.com> Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Stéphane Graber <stgraber@ubuntu.com> Cc: kvm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Suggested-by: Sean Christopherson <seanjc@google.com> Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com> Link: https://lore.kernel.org/r/20230522161249.800829-3-aleksandr.mikhalitsyn@canonical.com [sean: print '0' for min SEV-ES ASID if there are no available ASIDs] Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent 791a089 commit 6d1bc97

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

arch/x86/kvm/svm/sev.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2219,7 +2219,6 @@ void __init sev_hardware_setup(void)
22192219
if (misc_cg_set_capacity(MISC_CG_RES_SEV, sev_asid_count))
22202220
goto out;
22212221

2222-
pr_info("SEV supported: %u ASIDs\n", sev_asid_count);
22232222
sev_supported = true;
22242223

22252224
/* SEV-ES support requested? */
@@ -2247,10 +2246,18 @@ void __init sev_hardware_setup(void)
22472246
if (misc_cg_set_capacity(MISC_CG_RES_SEV_ES, sev_es_asid_count))
22482247
goto out;
22492248

2250-
pr_info("SEV-ES supported: %u ASIDs\n", sev_es_asid_count);
22512249
sev_es_supported = true;
22522250

22532251
out:
2252+
if (boot_cpu_has(X86_FEATURE_SEV))
2253+
pr_info("SEV %s (ASIDs %u - %u)\n",
2254+
sev_supported ? "enabled" : "disabled",
2255+
min_sev_asid, max_sev_asid);
2256+
if (boot_cpu_has(X86_FEATURE_SEV_ES))
2257+
pr_info("SEV-ES %s (ASIDs %u - %u)\n",
2258+
sev_es_supported ? "enabled" : "disabled",
2259+
min_sev_asid > 1 ? 1 : 0, min_sev_asid - 1);
2260+
22542261
sev_enabled = sev_supported;
22552262
sev_es_enabled = sev_es_supported;
22562263
#endif

0 commit comments

Comments
 (0)