From: Zhao Liu <zhao1.liu@intel.com>
To: "Paolo Bonzini" <pbonzini@redhat.com>,
"Daniel P . Berrangé" <berrange@redhat.com>
Cc: qemu-devel@nongnu.org, Xudong Hao <xudong.hao@intel.com>,
Zhao Liu <zhao1.liu@intel.com>
Subject: [PATCH v2 03/11] i386/cpu: Add support for AVX10_VNNI_INT in CPUID enumeration
Date: Mon, 15 Dec 2025 15:37:35 +0800 [thread overview]
Message-ID: <20251215073743.4055227-4-zhao1.liu@intel.com> (raw)
In-Reply-To: <20251215073743.4055227-1-zhao1.liu@intel.com>
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 7cff00a1b160..068e00a8d466 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_APXF },
.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 {
@@ -8456,8 +8474,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 dd18a33c6275..749ac8455e18 100644
--- a/target/i386/cpu.h
+++ b/target/i386/cpu.h
@@ -714,6 +714,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;
@@ -1115,6 +1116,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
next prev parent reply other threads:[~2025-12-15 7:14 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-15 7:37 [PATCH v2 00/11] i386/cpu: Add new instructions & CPU model for Intel Diamond Rapids Zhao Liu
2025-12-15 7:37 ` [PATCH v2 01/11] i386/cpu: Add support for MOVRS in CPUID enumeration Zhao Liu
2025-12-15 7:37 ` [PATCH v2 02/11] i386/cpu: Add CPUID.0x1E.0x1 subleaf for AMX instructions Zhao Liu
2025-12-15 7:37 ` Zhao Liu [this message]
2025-12-15 7:37 ` [PATCH v2 04/11] i386/cpu: Support AVX10.2 with AVX10 feature models Zhao Liu
2025-12-15 7:37 ` [PATCH v2 05/11] i386/cpu: Add a helper to get host avx10 version Zhao Liu
2025-12-15 7:37 ` [PATCH v2 06/11] i386/cpu: Allow unsupported avx10_version with x-force-features Zhao Liu
2025-12-15 7:37 ` [PATCH v2 07/11] i386/cpu: Allow cache to be shared at thread level Zhao Liu
2025-12-15 7:37 ` [PATCH v2 08/11] i386/cpu: Add an option in X86CPUDefinition to control CPUID 0x1f Zhao Liu
2025-12-15 7:37 ` [PATCH v2 09/11] i386/cpu: Define dependency for VMX_VM_ENTRY_LOAD_IA32_FRED Zhao Liu
2025-12-15 7:37 ` [PATCH v2 10/11] i386/cpu: Add CPU model for Diamond Rapids Zhao Liu
2025-12-15 7:37 ` [PATCH v2 11/11] dosc/cpu-models-x86: Add documentation for DiamondRapids Zhao Liu
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=20251215073743.4055227-4-zhao1.liu@intel.com \
--to=zhao1.liu@intel.com \
--cc=berrange@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=xudong.hao@intel.com \
/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).