]>
Commit | Line | Data |
---|---|---|
1f91e7a4 GKH |
1 | From foo@baz Tue 14 May 2019 08:29:35 PM CEST |
2 | From: Eduardo Habkost <ehabkost@redhat.com> | |
3 | Date: Wed, 5 Dec 2018 17:19:56 -0200 | |
4 | Subject: kvm: x86: Report STIBP on GET_SUPPORTED_CPUID | |
5 | ||
6 | From: Eduardo Habkost <ehabkost@redhat.com> | |
7 | ||
8 | commit d7b09c827a6cf291f66637a36f46928dd1423184 upstream. | |
9 | ||
10 | Months ago, we have added code to allow direct access to MSR_IA32_SPEC_CTRL | |
11 | to the guest, which makes STIBP available to guests. This was implemented | |
12 | by commits d28b387fb74d ("KVM/VMX: Allow direct access to | |
13 | MSR_IA32_SPEC_CTRL") and b2ac58f90540 ("KVM/SVM: Allow direct access to | |
14 | MSR_IA32_SPEC_CTRL"). | |
15 | ||
16 | However, we never updated GET_SUPPORTED_CPUID to let userspace know that | |
17 | STIBP can be enabled in CPUID. Fix that by updating | |
18 | kvm_cpuid_8000_0008_ebx_x86_features and kvm_cpuid_7_0_edx_x86_features. | |
19 | ||
20 | Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> | |
21 | Reviewed-by: Jim Mattson <jmattson@google.com> | |
22 | Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | |
23 | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> | |
24 | Signed-off-by: Thomas Gleixner <tglx@linutronix.de> | |
25 | [bwh: Backported to 4.4: adjust context] | |
26 | Signed-off-by: Ben Hutchings <ben@decadent.org.uk> | |
27 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
28 | --- | |
29 | arch/x86/kvm/cpuid.c | 5 +++-- | |
30 | 1 file changed, 3 insertions(+), 2 deletions(-) | |
31 | ||
32 | --- a/arch/x86/kvm/cpuid.c | |
33 | +++ b/arch/x86/kvm/cpuid.c | |
34 | @@ -344,7 +344,7 @@ static inline int __do_cpuid_ent(struct | |
35 | /* cpuid 0x80000008.ebx */ | |
36 | const u32 kvm_cpuid_8000_0008_ebx_x86_features = | |
37 | F(AMD_IBPB) | F(AMD_IBRS) | F(AMD_SSBD) | F(VIRT_SSBD) | | |
38 | - F(AMD_SSB_NO); | |
39 | + F(AMD_SSB_NO) | F(AMD_STIBP); | |
40 | ||
41 | /* cpuid 0xC0000001.edx */ | |
42 | const u32 kvm_supported_word5_x86_features = | |
43 | @@ -365,7 +365,8 @@ static inline int __do_cpuid_ent(struct | |
44 | ||
45 | /* cpuid 7.0.edx*/ | |
46 | const u32 kvm_cpuid_7_0_edx_x86_features = | |
47 | - F(SPEC_CTRL) | F(SPEC_CTRL_SSBD) | F(ARCH_CAPABILITIES); | |
48 | + F(SPEC_CTRL) | F(SPEC_CTRL_SSBD) | F(ARCH_CAPABILITIES) | | |
49 | + F(INTEL_STIBP); | |
50 | ||
51 | /* all calls to cpuid_count() should be made on the same cpu */ | |
52 | get_cpu(); |