From: Ben Cheatham <Benjamin.Cheatham@amd.com>
To: <qemu-devel@nongnu.org>
Cc: <babu.moger@amd.com>, Amit Shah <amit.shah@amd.com>,
Ben Cheatham <Benjamin.Cheatham@amd.com>
Subject: [PATCH 3/4] target/i386: Add getting RAPSIZE for ERAPS enabled guests
Date: Tue, 30 Jun 2026 10:33:14 -0500 [thread overview]
Message-ID: <20260630153315.1585-4-Benjamin.Cheatham@amd.com> (raw)
In-Reply-To: <20260630153315.1585-1-Benjamin.Cheatham@amd.com>
From: Amit Shah <amit.shah@amd.com>
Newer AMD CPUs have the ERAPS (Enhanced Return Address Predictor
Security) cpuid bit. When this bit is available, the size of the RSB is
indicated in EBX bits 16:23 of the same function. Allow the guest to use
these features when kvm is enabled and are available on the host.
NOTE: The commit description is from a patch made by Amit while the
actual changes are a subset of that patch, hence my Co-developed-by.
Amit, let me know if the attribution looks good to you.
Signed-off-by: Amit Shah <amit.shah@amd.com>
Co-developed-by: Ben Cheatham <Benjamin.Cheatham@amd.com>
Signed-off-by: Ben Cheatham <Benjamin.Cheatham@amd.com>
---
target/i386/cpu.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index a85cc67700fa..9342cc3ca4c6 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -9292,7 +9292,13 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
case 0x80000021:
*eax = *ebx = *ecx = *edx = 0;
*eax = env->features[FEAT_8000_0021_EAX];
- *ebx = env->features[FEAT_8000_0021_EBX];
+
+ if (kvm_enabled() && (*eax & CPUID_8000_0021_EAX_ERAPS)) {
+ *ebx |=
+ kvm_arch_get_supported_cpuid(cs->kvm_state, index, count, R_EBX) &
+ CPUID_8000_0021_EBX_RAPSIZE;
+ }
+
*ecx = env->features[FEAT_8000_0021_ECX];
break;
case 0x80000022:
--
2.53.0
next prev parent reply other threads:[~2026-06-30 15:41 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-30 15:33 [PATCH 0/4] Add Support for AMD EPYC Zen 6 CPU Model Ben Cheatham
2026-06-30 15:33 ` [PATCH 1/4] target/i386: Add AVX512 Bit Matrix Multiply (BMM) support Ben Cheatham
2026-06-30 15:33 ` [PATCH 2/4] target/i386: Update RAPSIZE definition Ben Cheatham
2026-06-30 15:33 ` Ben Cheatham [this message]
2026-06-30 16:07 ` [PATCH 3/4] target/i386: Add getting RAPSIZE for ERAPS enabled guests Shah, Amit
2026-06-30 16:38 ` Cheatham, Benjamin
2026-06-30 15:33 ` [PATCH 4/4] target/i386: Add EPYC-Venice CPU model Ben Cheatham
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=20260630153315.1585-4-Benjamin.Cheatham@amd.com \
--to=benjamin.cheatham@amd.com \
--cc=amit.shah@amd.com \
--cc=babu.moger@amd.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 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.