- hw/virtio/virtio-pmem: Replace impossible check by assertion - tests: Fix printf format string in acpi-utils.c - softmmu/dirtylimit: Add parameter check for hmp "set_vcpu_dirty_limit" - disas/riscv: Fix the typo of inverted order of pmpaddr13 and pmpaddr14 - qga: Fix memory leak when output stream is unused - ui/vnc-clipboard: fix infinite loop in inflate_buffer (CVE-2023-3255) - target/i386: Add few security fix bits in ARCH_CAPABILITIES into SapphireRapids CPU model - target/i386: Add new bit definitions of MSR_IA32_ARCH_CAPABILITIES - target/i386: Allow MCDT_NO if host supports - target/i386: Add support for MCDT_NO in CPUID enumeration - target/i386: Export MSR_ARCH_CAPABILITIES bits to guests - target/i386: add support for FB_CLEAR feature - target/i386: add support for FLUSH_L1D feature - crypto: remove shadowed 'ret' variable - hw/i2c/pmbus_device: Fix modifying QOM class internals from instance - hw/arm/xlnx-zynqmp: fix unsigned error when checking the RPUs number Signed-off-by: Jiabo Feng <fengjiabo1@huawei.com>
113 lines
4.3 KiB
Diff
113 lines
4.3 KiB
Diff
From a7329b80a2c8a50e53da17aa4eff0ef50aa21413 Mon Sep 17 00:00:00 2001
|
|
From: Tao Su <tao1.su@linux.intel.com>
|
|
Date: Thu, 6 Jul 2023 13:49:45 +0800
|
|
Subject: [PATCH] target/i386: Add support for MCDT_NO in CPUID enumeration
|
|
|
|
commit 9dd8b71091f47bac395f543779269c14d8d93c60 upstream.
|
|
|
|
CPUID.(EAX=7,ECX=2):EDX[bit 5] enumerates MCDT_NO. Processors enumerate
|
|
this bit as 1 do not exhibit MXCSR Configuration Dependent Timing (MCDT)
|
|
behavior and do not need to be mitigated to avoid data-dependent behavior
|
|
for certain instructions.
|
|
|
|
Since MCDT_NO is in a new sub-leaf, add a new CPUID feature word
|
|
FEAT_7_2_EDX. Also update cpuid_level_func7 by FEAT_7_2_EDX.
|
|
|
|
Intel-SIG: commit 9dd8b71091f4 ("target/i386: Add support for MCDT_NO in CPUID enumeration")
|
|
Backport support for MCDT_NO in CPUID enumeration
|
|
|
|
Signed-off-by: Tao Su <tao1.su@linux.intel.com>
|
|
Reviewed-by: Xiaoyao Li <xiaoyao.li@intel.com>
|
|
Message-ID: <20230706054949.66556-3-tao1.su@linux.intel.com>
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
[ jason: resolve conflict with FEAT_7_1_EDX which not backported yet ]
|
|
Signed-off-by: Jason Zeng <jason.zeng@intel.com>
|
|
---
|
|
target/i386/cpu.c | 26 ++++++++++++++++++++++++++
|
|
target/i386/cpu.h | 4 ++++
|
|
2 files changed, 30 insertions(+)
|
|
|
|
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
|
|
index b878a1bf20..685bfca37e 100644
|
|
--- a/target/i386/cpu.c
|
|
+++ b/target/i386/cpu.c
|
|
@@ -663,6 +663,7 @@ void x86_cpu_vendor_words2str(char *dst, uint32_t vendor1,
|
|
#define TCG_7_0_EDX_FEATURES CPUID_7_0_EDX_FSRM
|
|
#define TCG_7_1_EAX_FEATURES (CPUID_7_1_EAX_FZRM | CPUID_7_1_EAX_FSRS | \
|
|
CPUID_7_1_EAX_FSRC)
|
|
+#define TCG_7_2_EDX_FEATURES 0
|
|
#define TCG_APM_FEATURES 0
|
|
#define TCG_6_EAX_FEATURES CPUID_6_EAX_ARAT
|
|
#define TCG_XSAVE_FEATURES (CPUID_XSAVE_XSAVEOPT | CPUID_XSAVE_XGETBV1)
|
|
@@ -886,6 +887,25 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
|
|
},
|
|
.tcg_features = TCG_7_1_EAX_FEATURES,
|
|
},
|
|
+ [FEAT_7_2_EDX] = {
|
|
+ .type = CPUID_FEATURE_WORD,
|
|
+ .feat_names = {
|
|
+ NULL, NULL, NULL, NULL,
|
|
+ NULL, "mcdt-no", 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, NULL,
|
|
+ },
|
|
+ .cpuid = {
|
|
+ .eax = 7,
|
|
+ .needs_ecx = true, .ecx = 2,
|
|
+ .reg = R_EDX,
|
|
+ },
|
|
+ .tcg_features = TCG_7_2_EDX_FEATURES,
|
|
+ },
|
|
[FEAT_8000_0007_EDX] = {
|
|
.type = CPUID_FEATURE_WORD,
|
|
.feat_names = {
|
|
@@ -5531,6 +5551,11 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
|
|
*ebx = 0;
|
|
*ecx = 0;
|
|
*edx = 0;
|
|
+ } else if (count == 2) {
|
|
+ *edx = env->features[FEAT_7_2_EDX];
|
|
+ *eax = 0;
|
|
+ *ebx = 0;
|
|
+ *ecx = 0;
|
|
} else {
|
|
*eax = 0;
|
|
*ebx = 0;
|
|
@@ -6361,6 +6386,7 @@ void x86_cpu_expand_features(X86CPU *cpu, Error **errp)
|
|
x86_cpu_adjust_feat_level(cpu, FEAT_6_EAX);
|
|
x86_cpu_adjust_feat_level(cpu, FEAT_7_0_ECX);
|
|
x86_cpu_adjust_feat_level(cpu, FEAT_7_1_EAX);
|
|
+ x86_cpu_adjust_feat_level(cpu, FEAT_7_2_EDX);
|
|
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);
|
|
diff --git a/target/i386/cpu.h b/target/i386/cpu.h
|
|
index d9aac5acd2..edbaba0d62 100644
|
|
--- a/target/i386/cpu.h
|
|
+++ b/target/i386/cpu.h
|
|
@@ -601,6 +601,7 @@ typedef enum FeatureWord {
|
|
FEAT_SGX_12_0_EAX, /* CPUID[EAX=0x12,ECX=0].EAX (SGX) */
|
|
FEAT_SGX_12_0_EBX, /* CPUID[EAX=0x12,ECX=0].EBX (SGX MISCSELECT[31:0]) */
|
|
FEAT_SGX_12_1_EAX, /* CPUID[EAX=0x12,ECX=1].EAX (SGX ATTRIBUTES[31:0]) */
|
|
+ FEAT_7_2_EDX, /* CPUID[EAX=7,ECX=2].EDX */
|
|
FEATURE_WORDS,
|
|
} FeatureWord;
|
|
|
|
@@ -889,6 +890,9 @@ uint64_t x86_cpu_get_supported_feature_word(FeatureWord w,
|
|
/* Fast Short REP CMPS/SCAS */
|
|
#define CPUID_7_1_EAX_FSRC (1U << 12)
|
|
|
|
+/* Do not exhibit MXCSR Configuration Dependent Timing (MCDT) behavior */
|
|
+#define CPUID_7_2_EDX_MCDT_NO (1U << 5)
|
|
+
|
|
/* XFD Extend Feature Disabled */
|
|
#define CPUID_D_1_EAX_XFD (1U << 4)
|
|
|
|
--
|
|
2.41.0.windows.1
|
|
|