From: Zhao Liu Date: Mon, 15 Dec 2025 07:37:35 +0000 (+0800) Subject: i386/cpu: Add support for AVX10_VNNI_INT in CPUID enumeration X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=24a9bc108840812dfb94edc65962c1998120f77b;p=thirdparty%2Fqemu.git i386/cpu: Add support for AVX10_VNNI_INT in CPUID enumeration 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 Signed-off-by: Zhao Liu Link: https://lore.kernel.org/r/20251215073743.4055227-4-zhao1.liu@intel.com Signed-off-by: Paolo Bonzini --- diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 1246a9af4a..e0d75d170f 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 { @@ -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 7b002962e2..653f14e516 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -712,6 +712,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; @@ -1113,6 +1114,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