From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: Babu Moger <babu.moger@amd.com>, "Michael S . Tsirkin" <mst@redhat.com>
Subject: [PULL 10/16] target/i386: Add a couple of feature bits in 8000_0008_EBX
Date: Tue, 9 May 2023 11:04:47 +0200 [thread overview]
Message-ID: <20230509090453.37884-11-pbonzini@redhat.com> (raw)
In-Reply-To: <20230509090453.37884-1-pbonzini@redhat.com>
From: Babu Moger <babu.moger@amd.com>
Add the following feature bits.
amd-psfd : Predictive Store Forwarding Disable:
PSF is a hardware-based micro-architectural optimization
designed to improve the performance of code execution by
predicting address dependencies between loads and stores.
While SSBD (Speculative Store Bypass Disable) disables both
PSF and speculative store bypass, PSFD only disables PSF.
PSFD may be desirable for the software which is concerned
with the speculative behavior of PSF but desires a smaller
performance impact than setting SSBD.
Depends on the following kernel commit:
b73a54321ad8 ("KVM: x86: Expose Predictive Store Forwarding Disable")
stibp-always-on :
Single Thread Indirect Branch Prediction mode has enhanced
performance and may be left always on.
The documentation for the features are available in the links below.
a. Processor Programming Reference (PPR) for AMD Family 19h Model 01h,
Revision B1 Processors
b. SECURITY ANALYSIS OF AMD PREDICTIVE STORE FORWARDING
Signed-off-by: Babu Moger <babu.moger@amd.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Link: https://www.amd.com/system/files/documents/security-analysis-predictive-store-forwarding.pdf
Link: https://www.amd.com/system/files/TechDocs/55898_B1_pub_0.50.zip
Message-Id: <20230504205313.225073-4-babu.moger@amd.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
target/i386/cpu.c | 4 ++--
target/i386/cpu.h | 4 ++++
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 90a650a836a0..25ba7d0837ca 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -933,10 +933,10 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
NULL, NULL, NULL, NULL,
NULL, "wbnoinvd", NULL, NULL,
"ibpb", NULL, "ibrs", "amd-stibp",
- NULL, NULL, NULL, NULL,
+ NULL, "stibp-always-on", NULL, NULL,
NULL, NULL, NULL, NULL,
"amd-ssbd", "virt-ssbd", "amd-no-ssb", NULL,
- NULL, NULL, NULL, NULL,
+ "amd-psfd", NULL, NULL, NULL,
},
.cpuid = { .eax = 0x80000008, .reg = R_EBX, },
.tcg_features = 0,
diff --git a/target/i386/cpu.h b/target/i386/cpu.h
index 8504aaac6807..b45a97275bd0 100644
--- a/target/i386/cpu.h
+++ b/target/i386/cpu.h
@@ -946,8 +946,12 @@ uint64_t x86_cpu_get_supported_feature_word(FeatureWord w,
#define CPUID_8000_0008_EBX_IBRS (1U << 14)
/* Single Thread Indirect Branch Predictors */
#define CPUID_8000_0008_EBX_STIBP (1U << 15)
+/* STIBP mode has enhanced performance and may be left always on */
+#define CPUID_8000_0008_EBX_STIBP_ALWAYS_ON (1U << 17)
/* Speculative Store Bypass Disable */
#define CPUID_8000_0008_EBX_AMD_SSBD (1U << 24)
+/* Predictive Store Forwarding Disable */
+#define CPUID_8000_0008_EBX_AMD_PSFD (1U << 28)
#define CPUID_XSAVE_XSAVEOPT (1U << 0)
#define CPUID_XSAVE_XSAVEC (1U << 1)
--
2.40.1
next prev parent reply other threads:[~2023-05-09 9:06 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-09 9:04 [PULL 00/16] Misc patches for 2023-05-09 Paolo Bonzini
2023-05-09 9:04 ` [PULL 01/16] rcu: remove qatomic_mb_set, expand comments Paolo Bonzini
2023-05-09 9:04 ` [PULL 02/16] test-aio-multithread: do not use mb_read/mb_set for simple flags Paolo Bonzini
2023-05-09 9:04 ` [PULL 03/16] test-aio-multithread: simplify test_multi_co_schedule Paolo Bonzini
2023-05-09 9:04 ` [PULL 04/16] call_rcu: stop using mb_set/mb_read Paolo Bonzini
2023-05-09 9:04 ` [PULL 05/16] tb-maint: do not use mb_read/mb_set Paolo Bonzini
2023-05-09 9:04 ` [PULL 06/16] MAINTAINERS: add stanza for Kconfig files Paolo Bonzini
2023-05-09 9:04 ` [PULL 07/16] include/qemu/osdep.h: Bump _WIN32_WINNT to the Windows 8 API Paolo Bonzini
2023-05-09 9:04 ` [PULL 08/16] target/i386: allow versioned CPUs to specify new cache_info Paolo Bonzini
2023-05-09 9:04 ` [PULL 09/16] target/i386: Add new EPYC CPU versions with updated cache_info Paolo Bonzini
2023-05-09 9:04 ` Paolo Bonzini [this message]
2023-05-09 9:04 ` [PULL 11/16] target/i386: Add feature bits for CPUID_Fn80000021_EAX Paolo Bonzini
2023-05-09 9:04 ` [PULL 12/16] target/i386: Add missing feature bits in EPYC-Milan model Paolo Bonzini
2023-05-09 9:04 ` [PULL 13/16] target/i386: Add VNMI and automatic IBRS feature bits Paolo Bonzini
2023-05-09 9:04 ` [PULL 14/16] target/i386: Add EPYC-Genoa model to support Zen 4 processor series Paolo Bonzini
2023-05-09 9:04 ` [PULL 15/16] docs: clarify --without-default-devices Paolo Bonzini
2023-05-09 9:04 ` [PULL 16/16] meson: leave unnecessary modules out of the build Paolo Bonzini
2023-05-10 5:12 ` [PULL 00/16] Misc patches for 2023-05-09 Richard Henderson
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=20230509090453.37884-11-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=babu.moger@amd.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).