AVX10_VNNI_INT (0x24.0x1.ECX[bit 2]) is a discrete feature bit
introduced on Intel Diamond Rapids, which enumerates the support for
EVEX VPDP* instructions for INT8/INT16 [*].
Although Intel AVX10.2 has already included new VPDP* INT8/INT16 VNNI
instructions, a bit - AVX10_VNNI_INT - is still be separated. Relevant
new instructions can be checked by either CPUID AVX10.2 OR
AVX10_VNNI_INT (e.g., VPDPBSSD).
Support CPUID 0x24.0x1 subleaf with AVX10_VNNI_INT enumeration for
Guest.
[*]: Intel Advanced Vector Extensions 10.2 Architecture Specification
(rev 5.0).
Tested-by: Xudong Hao <xudong.hao@intel.com>
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
---
Reference link: https://cdrdv2.intel.com/v1/dl/getContent/856721
---
target/i386/cpu.c | 29 ++++++++++++++++++++++++++++-
target/i386/cpu.h | 4 ++++
2 files changed, 32 insertions(+), 1 deletion(-)
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 1985a6b3b835..0a6bb9ec21c5 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -1038,6 +1038,7 @@ void x86_cpu_vendor_words2str(char *dst, uint32_t vendor1,
#define TCG_24_0_EBX_FEATURES 0
#define TCG_29_0_EBX_FEATURES 0
#define TCG_1E_1_EAX_FEATURES 0
+#define TCG_24_1_ECX_FEATURES 0
#if defined CONFIG_USER_ONLY
#define CPUID_8000_0008_EBX_KERNEL_FEATURES (CPUID_8000_0008_EBX_IBPB | \
@@ -1385,6 +1386,18 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
},
.tcg_features = TCG_29_0_EBX_FEATURES,
},
+ [FEAT_24_1_ECX] = {
+ .type = CPUID_FEATURE_WORD,
+ .feat_names = {
+ [2] = "avx10-vnni-int",
+ },
+ .cpuid = {
+ .eax = 0x24,
+ .needs_ecx = true, .ecx = 1,
+ .reg = R_ECX,
+ },
+ .tcg_features = TCG_24_1_ECX_FEATURES,
+ },
[FEAT_8000_0007_EDX] = {
.type = CPUID_FEATURE_WORD,
.feat_names = {
@@ -2041,6 +2054,11 @@ static FeatureDep feature_dependencies[] = {
.from = { FEAT_7_1_EDX, CPUID_7_1_EDX_APX },
.to = { FEAT_29_0_EBX, ~0ull },
},
+
+ {
+ .from = { FEAT_7_1_EDX, CPUID_7_1_EDX_AVX10 },
+ .to = { FEAT_24_1_ECX, ~0ull },
+ },
};
typedef struct X86RegisterInfo32 {
@@ -8457,8 +8475,17 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
*ebx = 0;
*ecx = 0;
*edx = 0;
- if ((env->features[FEAT_7_1_EDX] & CPUID_7_1_EDX_AVX10) && count == 0) {
+
+ if (!(env->features[FEAT_7_1_EDX] & CPUID_7_1_EDX_AVX10)) {
+ break;
+ }
+ if (count == 0) {
+ uint32_t unused;
+ x86_cpu_get_supported_cpuid(0x1E, 0, eax, &unused,
+ &unused, &unused);
*ebx = env->features[FEAT_24_0_EBX] | env->avx10_version;
+ } else if (count == 1) {
+ *ecx = env->features[FEAT_24_1_ECX];
}
break;
}
diff --git a/target/i386/cpu.h b/target/i386/cpu.h
index df57b41567eb..970a4d03a560 100644
--- a/target/i386/cpu.h
+++ b/target/i386/cpu.h
@@ -699,6 +699,7 @@ typedef enum FeatureWord {
FEAT_24_0_EBX, /* CPUID[EAX=0x24,ECX=0].EBX */
FEAT_29_0_EBX, /* CPUID[EAX=0x29,ECX=0].EBX */
FEAT_1E_1_EAX, /* CPUID[EAX=0x1E,ECX=1].EAX */
+ FEAT_24_1_ECX, /* CPUID[EAX=0x24,ECX=0].ECX */
FEATURE_WORDS,
} FeatureWord;
@@ -1100,6 +1101,9 @@ uint64_t x86_cpu_get_supported_feature_word(X86CPU *cpu, FeatureWord w);
CPUID_24_0_EBX_AVX10_256 | \
CPUID_24_0_EBX_AVX10_512)
+/* AVX10_VNNI_INT instruction */
+#define CPUID_24_1_ECX_AVX10_VNNI_INT (1U << 2)
+
/*
* New Conditional Instructions (NCIs), explicit New Data Destination (NDD)
* controls, and explicit Flags Suppression (NF) controls for select sets of
--
2.34.1