]> xenbits.xensource.com Git - people/tklengyel/xen.git/commitdiff
x86/cpuid: replace more cpufeat_word() uses
authorJan Beulich <jbeulich@suse.com>
Thu, 24 Feb 2022 10:22:08 +0000 (11:22 +0100)
committerJan Beulich <jbeulich@suse.com>
Thu, 24 Feb 2022 10:22:08 +0000 (11:22 +0100)
Complete what e3662437eb43 ("x86/cpuid: Disentangle logic for new
feature leaves") has begun:

"Switch to using FEATURESET_* just like the policy/featureset helpers.  This
 breaks the cognitive complexity of needing to know which leaf a specifically
 named feature should reside in, and is shorter to write.  It is also far
 easier to identify as correct at a glance, given the correlation with the
 CPUID leaf being read."

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/cpu/common.c
xen/arch/x86/efi/efi-boot.h
xen/arch/x86/mpparse.c
xen/arch/x86/tsx.c

index bfedc99b9244e2a14307e0480bdf51a53b349569..bd2207163a35099a7f10813c2bf85bf97cda34aa 100644 (file)
@@ -332,24 +332,23 @@ void __init early_cpu_init(void)
        cpuid(0x00000001, &eax, &ebx, &ecx, &edx);
        c->x86 = get_cpu_family(eax, &c->x86_model, &c->x86_mask);
 
-       edx &= ~cleared_caps[cpufeat_word(X86_FEATURE_FPU)];
-       ecx &= ~cleared_caps[cpufeat_word(X86_FEATURE_SSE3)];
+       edx &= ~cleared_caps[FEATURESET_1d];
+       ecx &= ~cleared_caps[FEATURESET_1c];
        if (edx & cpufeat_mask(X86_FEATURE_CLFLUSH))
                c->x86_cache_alignment = ((ebx >> 8) & 0xff) * 8;
        /* Leaf 0x1 capabilities filled in early for Xen. */
-       c->x86_capability[cpufeat_word(X86_FEATURE_FPU)] = edx;
-       c->x86_capability[cpufeat_word(X86_FEATURE_SSE3)] = ecx;
+       c->x86_capability[FEATURESET_1d] = edx;
+       c->x86_capability[FEATURESET_1c] = ecx;
 
        printk(XENLOG_INFO
               "CPU Vendor: %s, Family %u (%#x), Model %u (%#x), Stepping %u (raw %08x)\n",
               x86_cpuid_vendor_to_str(c->x86_vendor), c->x86, c->x86,
               c->x86_model, c->x86_model, c->x86_mask, eax);
 
-       if (c->cpuid_level >= 7) {
-               cpuid_count(7, 0, &eax, &ebx, &ecx, &edx);
-               c->x86_capability[cpufeat_word(X86_FEATURE_CET_SS)] = ecx;
-               c->x86_capability[cpufeat_word(X86_FEATURE_CET_IBT)] = edx;
-       }
+       if (c->cpuid_level >= 7)
+               cpuid_count(7, 0, &eax, &ebx,
+                           &c->x86_capability[FEATURESET_7c0],
+                           &c->x86_capability[FEATURESET_7d0]);
 
        eax = cpuid_eax(0x80000000);
        if ((eax >> 16) == 0x8000 && eax >= 0x80000008) {
index f69509a2103ac2a58bb3bc4769967504115212c2..d91eb5a537f78f8e543985aeb3608b2f17e91fc7 100644 (file)
@@ -685,11 +685,11 @@ static void __init efi_arch_cpu(void)
 
     boot_tsc_stamp = rdtsc();
 
-    caps[cpufeat_word(X86_FEATURE_HYPERVISOR)] = cpuid_ecx(1);
+    caps[FEATURESET_1c] = cpuid_ecx(1);
 
     if ( (eax >> 16) == 0x8000 && eax > 0x80000000 )
     {
-        caps[cpufeat_word(X86_FEATURE_SYSCALL)] = cpuid_edx(0x80000001);
+        caps[FEATURESET_e1d] = cpuid_edx(0x80000001);
 
         if ( cpu_has_nx )
             trampoline_efer |= EFER_NXE;
index 8faac289ea9b11f30365b09b262892c1178cf23f..d8ccab2449c60d7bc00286b8bff70204ccbd7380 100644 (file)
@@ -516,7 +516,7 @@ static inline void __init construct_default_ISA_mptable(int mpc_default_type)
                                   (boot_cpu_data.x86_model << 4) |
                                   boot_cpu_data.x86_mask;
        processor.mpc_featureflag =
-            boot_cpu_data.x86_capability[cpufeat_word(X86_FEATURE_FPU)];
+            boot_cpu_data.x86_capability[FEATURESET_1d];
        processor.mpc_reserved[0] = 0;
        processor.mpc_reserved[1] = 0;
        for (i = 0; i < 2; i++) {
index b156844cdec19efd89fa36dd975bda171a3a6e65..41b6092cfe16ea502ea3f5e411e4cb848f54480d 100644 (file)
@@ -48,7 +48,7 @@ void tsx_init(void)
         bool has_rtm_always_abort;
 
         if ( boot_cpu_data.cpuid_level >= 7 )
-            boot_cpu_data.x86_capability[cpufeat_word(X86_FEATURE_ARCH_CAPS)]
+            boot_cpu_data.x86_capability[FEATURESET_7d0]
                 = cpuid_count_edx(7, 0);
 
         if ( cpu_has_arch_caps )