From: Eduardo Habkost <ehabkost@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Richard Henderson <rth@twiddle.net>,
qemu-devel@nongnu.org
Subject: [Qemu-devel] [PULL 6/8] i386: Add FEAT_8000_0008_EBX CPUID feature word
Date: Thu, 18 Jan 2018 00:01:55 -0200 [thread overview]
Message-ID: <20180118020157.25401-7-ehabkost@redhat.com> (raw)
In-Reply-To: <20180118020157.25401-1-ehabkost@redhat.com>
Add the new feature word and the "ibpb" feature flag.
Based on a patch by Paolo Bonzini.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20180109154519.25634-5-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
target/i386/cpu.h | 3 +++
target/i386/cpu.c | 19 ++++++++++++++++++-
2 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/target/i386/cpu.h b/target/i386/cpu.h
index d7bae242cd..30cc5628d2 100644
--- a/target/i386/cpu.h
+++ b/target/i386/cpu.h
@@ -472,6 +472,7 @@ typedef enum FeatureWord {
FEAT_8000_0001_EDX, /* CPUID[8000_0001].EDX */
FEAT_8000_0001_ECX, /* CPUID[8000_0001].ECX */
FEAT_8000_0007_EDX, /* CPUID[8000_0007].EDX */
+ FEAT_8000_0008_EBX, /* CPUID[8000_0008].EBX */
FEAT_C000_0001_EDX, /* CPUID[C000_0001].EDX */
FEAT_KVM, /* CPUID[4000_0001].EAX (KVM_CPUID_FEATURES) */
FEAT_HYPERV_EAX, /* CPUID[4000_0003].EAX */
@@ -669,6 +670,8 @@ typedef uint32_t FeatureWordArray[FEATURE_WORDS];
#define CPUID_7_0_EDX_AVX512_4FMAPS (1U << 3) /* AVX512 Multiply Accumulation Single Precision */
#define CPUID_7_0_EDX_SPEC_CTRL (1U << 26) /* Speculation Control */
+#define CPUID_8000_0008_EBX_IBPB (1U << 12) /* Indirect Branch Prediction Barrier */
+
#define CPUID_XSAVE_XSAVEOPT (1U << 0)
#define CPUID_XSAVE_XSAVEC (1U << 1)
#define CPUID_XSAVE_XGETBV1 (1U << 2)
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 7f815458a5..6fe14362cc 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -483,6 +483,22 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
.tcg_features = TCG_APM_FEATURES,
.unmigratable_flags = CPUID_APM_INVTSC,
},
+ [FEAT_8000_0008_EBX] = {
+ .feat_names = {
+ NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL,
+ "ibpb", NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL,
+ },
+ .cpuid_eax = 0x80000008,
+ .cpuid_reg = R_EBX,
+ .tcg_features = 0,
+ .unmigratable_flags = 0,
+ },
[FEAT_XSAVE] = {
.feat_names = {
"xsaveopt", "xsavec", "xgetbv1", "xsaves",
@@ -3130,7 +3146,7 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
} else {
*eax = cpu->phys_bits;
}
- *ebx = 0;
+ *ebx = env->features[FEAT_8000_0008_EBX];
*ecx = 0;
*edx = 0;
if (cs->nr_cores * cs->nr_threads > 1) {
@@ -3593,6 +3609,7 @@ static void x86_cpu_expand_features(X86CPU *cpu, Error **errp)
x86_cpu_adjust_feat_level(cpu, FEAT_8000_0001_EDX);
x86_cpu_adjust_feat_level(cpu, FEAT_8000_0001_ECX);
x86_cpu_adjust_feat_level(cpu, FEAT_8000_0007_EDX);
+ x86_cpu_adjust_feat_level(cpu, FEAT_8000_0008_EBX);
x86_cpu_adjust_feat_level(cpu, FEAT_C000_0001_EDX);
x86_cpu_adjust_feat_level(cpu, FEAT_SVM);
x86_cpu_adjust_feat_level(cpu, FEAT_XSAVE);
--
2.14.3
next prev parent reply other threads:[~2018-01-18 2:02 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-18 2:01 [Qemu-devel] [PULL 0/8] x86 queue, 2018-01-17 Eduardo Habkost
2018-01-18 2:01 ` [Qemu-devel] [PULL 1/8] pc: add 2.12 machine types Eduardo Habkost
2018-01-18 2:01 ` [Qemu-devel] [PULL 2/8] target/i386: add clflushopt to "Skylake-Server" cpu model Eduardo Habkost
2018-01-18 2:01 ` [Qemu-devel] [PULL 3/8] i386: Change X86CPUDefinition::model_id to const char* Eduardo Habkost
2018-01-18 2:01 ` [Qemu-devel] [PULL 4/8] i386: Add support for SPEC_CTRL MSR Eduardo Habkost
2018-01-18 2:01 ` [Qemu-devel] [PULL 5/8] i386: Add spec-ctrl CPUID bit Eduardo Habkost
2018-01-18 2:01 ` Eduardo Habkost [this message]
2018-01-18 2:01 ` [Qemu-devel] [PULL 7/8] i386: Add new -IBRS versions of Intel CPU models Eduardo Habkost
2018-01-18 2:01 ` [Qemu-devel] [PULL 8/8] i386: Add EPYC-IBPB CPU model Eduardo Habkost
2018-01-18 13:51 ` [Qemu-devel] [PULL 0/8] x86 queue, 2018-01-17 Peter Maydell
2018-01-23 8:40 ` Christian Ehrhardt
2018-01-23 9:59 ` Christian Borntraeger
2018-01-23 10:19 ` [Qemu-devel] [qemu-s390x] " Cornelia Huck
2018-01-23 10:34 ` [Qemu-devel] " Christian Ehrhardt
2018-01-23 10:50 ` [Qemu-devel] [qemu-s390x] " Cornelia Huck
2018-01-23 18:40 ` Michael Roth
2018-01-23 11:14 ` [Qemu-devel] " Peter Maydell
2018-01-23 16:40 ` [Qemu-devel] [qemu-s390x] " David Hildenbrand
2018-01-23 18:15 ` [Qemu-devel] " Michael Roth
2018-01-23 19:31 ` Eduardo Habkost
2018-01-23 21:33 ` Michael Roth
2018-01-26 1:29 ` Eduardo Habkost
2018-01-26 16:28 ` Michael Roth
2018-01-26 18:08 ` Eduardo Habkost
2018-01-26 18:17 ` Peter Maydell
2018-01-26 18:23 ` Michael Roth
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180118020157.25401-7-ehabkost@redhat.com \
--to=ehabkost@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.