Commit 61181166d0 for qemu.org

commit 61181166d0a2637c6edb6332c94e9d2b015559e4
Author: Zhao Liu <zhao1.liu@intel.com>
Date:   Mon Dec 15 15:37:37 2025 +0800

    i386/cpu: Add a helper to get host avx10 version

    Factor out a helper to get host avx10 version, to reduce duplicate
    codes.

    Tested-by: Xudong Hao <xudong.hao@intel.com>
    Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
    Link: https://lore.kernel.org/r/20251215073743.4055227-6-zhao1.liu@intel.com
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 9c81e4e1f5..c460e3bec7 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -7757,6 +7757,13 @@ CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)

 #endif /* !CONFIG_USER_ONLY */

+static uint8_t x86_cpu_get_host_avx10_version(void)
+{
+    uint32_t eax, ebx, ecx, edx;
+    x86_cpu_get_supported_cpuid(0x24, 0, &eax, &ebx, &ecx, &edx);
+    return ebx & 0xff;
+}
+
 uint64_t x86_cpu_get_supported_feature_word(X86CPU *cpu, FeatureWord w)
 {
     FeatureWordInfo *wi = &feature_word_info[w];
@@ -9255,11 +9262,10 @@ void x86_cpu_expand_features(X86CPU *cpu, Error **errp)
         }

         if ((env->features[FEAT_7_1_EDX] & CPUID_7_1_EDX_AVX10) && !env->avx10_version) {
-            uint32_t eax, ebx, ecx, edx;
-            x86_cpu_get_supported_cpuid(0x24, 0, &eax, &ebx, &ecx, &edx);
+            uint8_t version = x86_cpu_get_host_avx10_version();

             if (!object_property_set_uint(OBJECT(cpu), "avx10-version",
-                                          ebx & 0xff, errp)) {
+                                          version, errp)) {
                 return;
             }
         }
@@ -9481,9 +9487,7 @@ static bool x86_cpu_filter_features(X86CPU *cpu, bool verbose)
     have_filtered_features = x86_cpu_have_filtered_features(cpu);

     if (env->features[FEAT_7_1_EDX] & CPUID_7_1_EDX_AVX10) {
-        x86_cpu_get_supported_cpuid(0x24, 0,
-                                    &eax_0, &ebx_0, &ecx_0, &edx_0);
-        uint8_t version = ebx_0 & 0xff;
+        uint8_t version = x86_cpu_get_host_avx10_version();

         if (version < env->avx10_version) {
             if (prefix) {