|
|
9bac43 |
From bc88b0d69c0e81626e5c246cae83e499bfa3dccb Mon Sep 17 00:00:00 2001
|
|
|
9bac43 |
From: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9bac43 |
Date: Wed, 13 Dec 2017 15:47:37 -0200
|
|
|
9bac43 |
Subject: [PATCH 2/3] target-i386: cpu: add new CPUID bits for indirect branch
|
|
|
9bac43 |
predictor restrictions
|
|
|
9bac43 |
|
|
|
9bac43 |
RH-Author: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
9bac43 |
Message-id: <20171213174738.20852-3-ehabkost@redhat.com>
|
|
|
9bac43 |
Patchwork-id: n/a
|
|
|
9bac43 |
O-Subject: [CONFIDENTIAL][RHEL-7.5 qemu-kvm-rhev PATCH v2 2/3] target-i386: add
|
|
|
9bac43 |
support for SPEC_CTRL MSR
|
|
|
9bac43 |
Bugzilla: CVE-2017-5715
|
|
|
9bac43 |
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9bac43 |
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9bac43 |
|
|
|
9bac43 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9bac43 |
---
|
|
|
9bac43 |
target/i386/cpu.c | 23 ++++++++++++++++++++---
|
|
|
9bac43 |
target/i386/cpu.h | 1 +
|
|
|
9bac43 |
2 files changed, 21 insertions(+), 3 deletions(-)
|
|
|
9bac43 |
|
|
|
9bac43 |
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
|
|
|
9bac43 |
index c2dee60..364e52e 100644
|
|
|
9bac43 |
--- a/target/i386/cpu.c
|
|
|
9bac43 |
+++ b/target/i386/cpu.c
|
|
|
9bac43 |
@@ -456,8 +456,8 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
|
|
|
9bac43 |
NULL, NULL, NULL, NULL,
|
|
|
9bac43 |
NULL, NULL, NULL, NULL,
|
|
|
9bac43 |
NULL, NULL, NULL, NULL,
|
|
|
9bac43 |
- NULL, NULL, NULL, NULL,
|
|
|
9bac43 |
- NULL, NULL, NULL, NULL,
|
|
|
9bac43 |
+ NULL, NULL, "spec-ctrl", "stibp",
|
|
|
9bac43 |
+ NULL, "arch-facilities", NULL, NULL,
|
|
|
9bac43 |
},
|
|
|
9bac43 |
.cpuid_eax = 7,
|
|
|
9bac43 |
.cpuid_needs_ecx = true, .cpuid_ecx = 0,
|
|
|
9bac43 |
@@ -480,6 +480,22 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
|
|
|
9bac43 |
.tcg_features = TCG_APM_FEATURES,
|
|
|
9bac43 |
.unmigratable_flags = CPUID_APM_INVTSC,
|
|
|
9bac43 |
},
|
|
|
9bac43 |
+ [FEAT_8000_0008_EBX] = {
|
|
|
9bac43 |
+ .feat_names = {
|
|
|
9bac43 |
+ NULL, NULL, NULL, NULL,
|
|
|
9bac43 |
+ NULL, NULL, NULL, NULL,
|
|
|
9bac43 |
+ NULL, NULL, NULL, NULL,
|
|
|
9bac43 |
+ "ibpb", NULL, NULL, NULL,
|
|
|
9bac43 |
+ NULL, NULL, NULL, NULL,
|
|
|
9bac43 |
+ NULL, NULL, NULL, NULL,
|
|
|
9bac43 |
+ NULL, NULL, NULL, NULL,
|
|
|
9bac43 |
+ NULL, NULL, NULL, NULL,
|
|
|
9bac43 |
+ },
|
|
|
9bac43 |
+ .cpuid_eax = 0x80000008,
|
|
|
9bac43 |
+ .cpuid_reg = R_EBX,
|
|
|
9bac43 |
+ .tcg_features = 0,
|
|
|
9bac43 |
+ .unmigratable_flags = 0,
|
|
|
9bac43 |
+ },
|
|
|
9bac43 |
[FEAT_XSAVE] = {
|
|
|
9bac43 |
.feat_names = {
|
|
|
9bac43 |
"xsaveopt", "xsavec", "xgetbv1", "xsaves",
|
|
|
9bac43 |
@@ -3122,7 +3138,7 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
|
|
|
9bac43 |
} else {
|
|
|
9bac43 |
*eax = cpu->phys_bits;
|
|
|
9bac43 |
}
|
|
|
9bac43 |
- *ebx = 0;
|
|
|
9bac43 |
+ *ebx = env->features[FEAT_8000_0008_EBX];
|
|
|
9bac43 |
*ecx = 0;
|
|
|
9bac43 |
*edx = 0;
|
|
|
9bac43 |
if (cs->nr_cores * cs->nr_threads > 1) {
|
|
|
9bac43 |
@@ -3578,6 +3594,7 @@ static void x86_cpu_expand_features(X86CPU *cpu, Error **errp)
|
|
|
9bac43 |
x86_cpu_adjust_feat_level(cpu, FEAT_8000_0001_EDX);
|
|
|
9bac43 |
x86_cpu_adjust_feat_level(cpu, FEAT_8000_0001_ECX);
|
|
|
9bac43 |
x86_cpu_adjust_feat_level(cpu, FEAT_8000_0007_EDX);
|
|
|
9bac43 |
+ x86_cpu_adjust_feat_level(cpu, FEAT_8000_0008_EBX);
|
|
|
9bac43 |
x86_cpu_adjust_feat_level(cpu, FEAT_C000_0001_EDX);
|
|
|
9bac43 |
x86_cpu_adjust_feat_level(cpu, FEAT_SVM);
|
|
|
9bac43 |
x86_cpu_adjust_feat_level(cpu, FEAT_XSAVE);
|
|
|
9bac43 |
diff --git a/target/i386/cpu.h b/target/i386/cpu.h
|
|
|
9bac43 |
index 4dfb859..f2686d5 100644
|
|
|
9bac43 |
--- a/target/i386/cpu.h
|
|
|
9bac43 |
+++ b/target/i386/cpu.h
|
|
|
9bac43 |
@@ -454,6 +454,7 @@ typedef enum FeatureWord {
|
|
|
9bac43 |
FEAT_8000_0001_EDX, /* CPUID[8000_0001].EDX */
|
|
|
9bac43 |
FEAT_8000_0001_ECX, /* CPUID[8000_0001].ECX */
|
|
|
9bac43 |
FEAT_8000_0007_EDX, /* CPUID[8000_0007].EDX */
|
|
|
9bac43 |
+ FEAT_8000_0008_EBX, /* CPUID[8000_0008].EBX */
|
|
|
9bac43 |
FEAT_C000_0001_EDX, /* CPUID[C000_0001].EDX */
|
|
|
9bac43 |
FEAT_KVM, /* CPUID[4000_0001].EAX (KVM_CPUID_FEATURES) */
|
|
|
9bac43 |
FEAT_HYPERV_EAX, /* CPUID[4000_0003].EAX */
|
|
|
9bac43 |
--
|
|
|
9bac43 |
1.8.3.1
|
|
|
9bac43 |
|