127 lines
4.9 KiB
Diff
127 lines
4.9 KiB
Diff
|
From 2a2f74c53258ef67034307b59afe2f4c679afaa2 Mon Sep 17 00:00:00 2001
|
|||
|
From: Bandan Das <bsd@redhat.com>
|
|||
|
Date: Wed, 9 Aug 2023 12:32:00 -0400
|
|||
|
Subject: [PATCH 4/7] target/i386: Add feature bits for CPUID_Fn80000021_EAX
|
|||
|
MIME-Version: 1.0
|
|||
|
Content-Type: text/plain; charset=UTF-8
|
|||
|
Content-Transfer-Encoding: 8bit
|
|||
|
|
|||
|
RH-Author: Bandan Das <None>
|
|||
|
RH-MergeRequest: 198: Add EPYC-Genoa CPU model in qemu
|
|||
|
RH-Bugzilla: 2094913
|
|||
|
RH-Acked-by: Wei Huang <None>
|
|||
|
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|||
|
RH-Commit: [4/7] 133044a7245226308406a684a875e1f96a394516 (bdas1/qemu-kvm)
|
|||
|
|
|||
|
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2094913
|
|||
|
|
|||
|
commit b70eec312b185197d639bff689007727e596afd1
|
|||
|
Author: Babu Moger <babu.moger@amd.com>
|
|||
|
Date: Thu May 4 15:53:09 2023 -0500
|
|||
|
|
|||
|
target/i386: Add feature bits for CPUID_Fn80000021_EAX
|
|||
|
|
|||
|
Add the following feature bits.
|
|||
|
no-nested-data-bp : Processor ignores nested data breakpoints.
|
|||
|
lfence-always-serializing : LFENCE instruction is always serializing.
|
|||
|
null-sel-cls-base : Null Selector Clears Base. When this bit is
|
|||
|
set, a null segment load clears the segment base.
|
|||
|
|
|||
|
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. AMD64 Architecture Programmer’s Manual Volumes 1–5 Publication No. Revision
|
|||
|
40332 4.05 Date October 2022
|
|||
|
|
|||
|
Signed-off-by: Babu Moger <babu.moger@amd.com>
|
|||
|
Acked-by: Michael S. Tsirkin <mst@redhat.com>
|
|||
|
Link: https://www.amd.com/system/files/TechDocs/55898_B1_pub_0.50.zip
|
|||
|
Link: https://www.amd.com/system/files/TechDocs/40332_4.05.pdf
|
|||
|
Message-Id: <20230504205313.225073-5-babu.moger@amd.com>
|
|||
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|||
|
|
|||
|
Signed-off-by: Bandan Das <bsd@redhat.com>
|
|||
|
---
|
|||
|
target/i386/cpu.c | 24 ++++++++++++++++++++++++
|
|||
|
target/i386/cpu.h | 8 ++++++++
|
|||
|
2 files changed, 32 insertions(+)
|
|||
|
|
|||
|
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
|
|||
|
index c8f88aefc7..7ddebbaa3c 100644
|
|||
|
--- a/target/i386/cpu.c
|
|||
|
+++ b/target/i386/cpu.c
|
|||
|
@@ -920,6 +920,22 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
|
|||
|
.tcg_features = 0,
|
|||
|
.unmigratable_flags = 0,
|
|||
|
},
|
|||
|
+ [FEAT_8000_0021_EAX] = {
|
|||
|
+ .type = CPUID_FEATURE_WORD,
|
|||
|
+ .feat_names = {
|
|||
|
+ "no-nested-data-bp", NULL, "lfence-always-serializing", NULL,
|
|||
|
+ NULL, NULL, "null-sel-clr-base", NULL,
|
|||
|
+ NULL, NULL, NULL, NULL,
|
|||
|
+ NULL, NULL, NULL, NULL,
|
|||
|
+ NULL, NULL, NULL, NULL,
|
|||
|
+ NULL, NULL, NULL, NULL,
|
|||
|
+ NULL, NULL, NULL, NULL,
|
|||
|
+ NULL, NULL, NULL, NULL,
|
|||
|
+ },
|
|||
|
+ .cpuid = { .eax = 0x80000021, .reg = R_EAX, },
|
|||
|
+ .tcg_features = 0,
|
|||
|
+ .unmigratable_flags = 0,
|
|||
|
+ },
|
|||
|
[FEAT_XSAVE] = {
|
|||
|
.type = CPUID_FEATURE_WORD,
|
|||
|
.feat_names = {
|
|||
|
@@ -6156,6 +6172,10 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
|
|||
|
*ebx |= (sev_get_reduced_phys_bits() & 0x3f) << 6; /* EBX[11:6] */
|
|||
|
}
|
|||
|
break;
|
|||
|
+ case 0x80000021:
|
|||
|
+ *eax = env->features[FEAT_8000_0021_EAX];
|
|||
|
+ *ebx = *ecx = *edx = 0;
|
|||
|
+ break;
|
|||
|
default:
|
|||
|
/* reserved values: zero */
|
|||
|
*eax = 0;
|
|||
|
@@ -6585,6 +6605,10 @@ void x86_cpu_expand_features(X86CPU *cpu, Error **errp)
|
|||
|
x86_cpu_adjust_level(cpu, &env->cpuid_min_xlevel, 0x8000001F);
|
|||
|
}
|
|||
|
|
|||
|
+ if (env->features[FEAT_8000_0021_EAX]) {
|
|||
|
+ x86_cpu_adjust_level(cpu, &env->cpuid_min_xlevel, 0x80000021);
|
|||
|
+ }
|
|||
|
+
|
|||
|
/* SGX requires CPUID[0x12] for EPC enumeration */
|
|||
|
if (env->features[FEAT_7_0_EBX] & CPUID_7_0_EBX_SGX) {
|
|||
|
x86_cpu_adjust_level(cpu, &env->cpuid_min_level, 0x12);
|
|||
|
diff --git a/target/i386/cpu.h b/target/i386/cpu.h
|
|||
|
index 81d2200543..c37abf62ae 100644
|
|||
|
--- a/target/i386/cpu.h
|
|||
|
+++ b/target/i386/cpu.h
|
|||
|
@@ -600,6 +600,7 @@ typedef enum FeatureWord {
|
|||
|
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_8000_0021_EAX, /* CPUID[8000_0021].EAX */
|
|||
|
FEAT_C000_0001_EDX, /* CPUID[C000_0001].EDX */
|
|||
|
FEAT_KVM, /* CPUID[4000_0001].EAX (KVM_CPUID_FEATURES) */
|
|||
|
FEAT_KVM_HINTS, /* CPUID[4000_0001].EDX */
|
|||
|
@@ -941,6 +942,13 @@ uint64_t x86_cpu_get_supported_feature_word(FeatureWord w,
|
|||
|
/* Predictive Store Forwarding Disable */
|
|||
|
#define CPUID_8000_0008_EBX_AMD_PSFD (1U << 28)
|
|||
|
|
|||
|
+/* Processor ignores nested data breakpoints */
|
|||
|
+#define CPUID_8000_0021_EAX_No_NESTED_DATA_BP (1U << 0)
|
|||
|
+/* LFENCE is always serializing */
|
|||
|
+#define CPUID_8000_0021_EAX_LFENCE_ALWAYS_SERIALIZING (1U << 2)
|
|||
|
+/* Null Selector Clears Base */
|
|||
|
+#define CPUID_8000_0021_EAX_NULL_SEL_CLR_BASE (1U << 6)
|
|||
|
+
|
|||
|
#define CPUID_XSAVE_XSAVEOPT (1U << 0)
|
|||
|
#define CPUID_XSAVE_XSAVEC (1U << 1)
|
|||
|
#define CPUID_XSAVE_XGETBV1 (1U << 2)
|
|||
|
--
|
|||
|
2.39.3
|
|||
|
|