]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - queue-4.4/kvm-x86-report-stibp-on-get_supported_cpuid.patch
4.4-stable patches
[thirdparty/kernel/stable-queue.git] / queue-4.4 / kvm-x86-report-stibp-on-get_supported_cpuid.patch
CommitLineData
1f91e7a4
GKH
1From foo@baz Tue 14 May 2019 08:29:35 PM CEST
2From: Eduardo Habkost <ehabkost@redhat.com>
3Date: Wed, 5 Dec 2018 17:19:56 -0200
4Subject: kvm: x86: Report STIBP on GET_SUPPORTED_CPUID
5
6From: Eduardo Habkost <ehabkost@redhat.com>
7
8commit d7b09c827a6cf291f66637a36f46928dd1423184 upstream.
9
10Months ago, we have added code to allow direct access to MSR_IA32_SPEC_CTRL
11to the guest, which makes STIBP available to guests. This was implemented
12by commits d28b387fb74d ("KVM/VMX: Allow direct access to
13MSR_IA32_SPEC_CTRL") and b2ac58f90540 ("KVM/SVM: Allow direct access to
14MSR_IA32_SPEC_CTRL").
15
16However, we never updated GET_SUPPORTED_CPUID to let userspace know that
17STIBP can be enabled in CPUID. Fix that by updating
18kvm_cpuid_8000_0008_ebx_x86_features and kvm_cpuid_7_0_edx_x86_features.
19
20Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
21Reviewed-by: Jim Mattson <jmattson@google.com>
22Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
23Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
24Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
25[bwh: Backported to 4.4: adjust context]
26Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
27Signed-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();