]>
Commit | Line | Data |
---|---|---|
f95a9ab8 SL |
1 | From 6688ee674bc40eb0df66195e870205542c8ae100 Mon Sep 17 00:00:00 2001 |
2 | From: Sasha Levin <sashal@kernel.org> | |
3 | Date: Mon, 22 May 2023 18:12:48 +0200 | |
4 | Subject: KVM: SVM: enhance info printk's in SEV init | |
5 | MIME-Version: 1.0 | |
6 | Content-Type: text/plain; charset=UTF-8 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ||
9 | From: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com> | |
10 | ||
11 | [ Upstream commit 6d1bc9754b04075d938b47cf7f7800814b8911a7 ] | |
12 | ||
13 | Let's print available ASID ranges for SEV/SEV-ES guests. | |
14 | This information can be useful for system administrator | |
15 | to debug if SEV/SEV-ES fails to enable. | |
16 | ||
17 | There are a few reasons. | |
18 | SEV: | |
19 | - NPT is disabled (module parameter) | |
20 | - CPU lacks some features (sev, decodeassists) | |
21 | - Maximum SEV ASID is 0 | |
22 | ||
23 | SEV-ES: | |
24 | - mmio_caching is disabled (module parameter) | |
25 | - CPU lacks sev_es feature | |
26 | - Minimum SEV ASID value is 1 (can be adjusted in BIOS/UEFI) | |
27 | ||
28 | Cc: Sean Christopherson <seanjc@google.com> | |
29 | Cc: Paolo Bonzini <pbonzini@redhat.com> | |
30 | Cc: Stéphane Graber <stgraber@ubuntu.com> | |
31 | Cc: kvm@vger.kernel.org | |
32 | Cc: linux-kernel@vger.kernel.org | |
33 | Suggested-by: Sean Christopherson <seanjc@google.com> | |
34 | Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com> | |
35 | Link: https://lore.kernel.org/r/20230522161249.800829-3-aleksandr.mikhalitsyn@canonical.com | |
36 | [sean: print '0' for min SEV-ES ASID if there are no available ASIDs] | |
37 | Signed-off-by: Sean Christopherson <seanjc@google.com> | |
38 | Stable-dep-of: 0aa6b90ef9d7 ("KVM: SVM: Add support for allowing zero SEV ASIDs") | |
39 | Signed-off-by: Sasha Levin <sashal@kernel.org> | |
40 | --- | |
41 | arch/x86/kvm/svm/sev.c | 11 +++++++++-- | |
42 | 1 file changed, 9 insertions(+), 2 deletions(-) | |
43 | ||
44 | diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c | |
45 | index 3dc0ee1fe9db9..1fe9257d87b2d 100644 | |
46 | --- a/arch/x86/kvm/svm/sev.c | |
47 | +++ b/arch/x86/kvm/svm/sev.c | |
48 | @@ -2217,7 +2217,6 @@ void __init sev_hardware_setup(void) | |
49 | if (misc_cg_set_capacity(MISC_CG_RES_SEV, sev_asid_count)) | |
50 | goto out; | |
51 | ||
52 | - pr_info("SEV supported: %u ASIDs\n", sev_asid_count); | |
53 | sev_supported = true; | |
54 | ||
55 | /* SEV-ES support requested? */ | |
56 | @@ -2245,10 +2244,18 @@ void __init sev_hardware_setup(void) | |
57 | if (misc_cg_set_capacity(MISC_CG_RES_SEV_ES, sev_es_asid_count)) | |
58 | goto out; | |
59 | ||
60 | - pr_info("SEV-ES supported: %u ASIDs\n", sev_es_asid_count); | |
61 | sev_es_supported = true; | |
62 | ||
63 | out: | |
64 | + if (boot_cpu_has(X86_FEATURE_SEV)) | |
65 | + pr_info("SEV %s (ASIDs %u - %u)\n", | |
66 | + sev_supported ? "enabled" : "disabled", | |
67 | + min_sev_asid, max_sev_asid); | |
68 | + if (boot_cpu_has(X86_FEATURE_SEV_ES)) | |
69 | + pr_info("SEV-ES %s (ASIDs %u - %u)\n", | |
70 | + sev_es_supported ? "enabled" : "disabled", | |
71 | + min_sev_asid > 1 ? 1 : 0, min_sev_asid - 1); | |
72 | + | |
73 | sev_enabled = sev_supported; | |
74 | sev_es_enabled = sev_es_supported; | |
75 | #endif | |
76 | -- | |
77 | 2.43.0 | |
78 |