[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/3] x86/cpuid: replace more cpufeat_word() uses


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 23 Feb 2022 11:12:51 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Xh7f+LBqpvIMNCjCDOJiXb25hwsGdct++TnJN1+j8lY=; b=aQuZMXX/VId8N2/9y14DSvJd8W7wDHGzE2rB2PZEXSYrQaGWS/NSQZszSDgAqCkrYwhAw1PxkUvqw6VnKNX5X1Z1vxvXhuq/eAD9EUmVTjbexXz58ekbCxkldQTg8siMi0SsA1dmtNrqkMDAPcvsqC1tI8Urif8GKKTt28tiTlqHoU9BBjVjzXsic6R3tqKHeHWcdQ1XlHiiOBxYB4RFHX6rNwjZ3nlNk++ySsQWXtug4F4YMUhKDH/fZCABcO3QWplZN2E2tRV8J5DoktIPpBV/i8wTUDWApc+KgQmGuBrUg2II3fuLkpbA/Qj1NJCOtzJC+qo74+0kZnD9dmX4rQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VYSWRom+mbYbqITaeiPawAaNs1fYsxB3aeWUas25CSyX/GlE4q8cMY4MAxpXz4vfBCQZvOyZZET99KwR5cGUzAtf8/nzZXqnEv5mviAXjnuAAtl+DnhsdAVrrPL0UADUjAwwt8gPbhQHXhi0IRej1DWWTzbMJ4svjyqqS3B4q8UfiHitO+nk4e4veF2116zFJq61HXHUxEMb2B+BEQW3qr5tFd/avw/Rrxz7JQasrEo66ESObEn62LKYRcUxkb1brP9Lwwiim7pMiZLfvVh4WEeGua98DAn6wokTo8RcCwD4p2pRUmQpz/LHnkccMVyhlDqiy39DPjr7bLKTAuigCg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Wed, 23 Feb 2022 10:12:58 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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@xxxxxxxx>

--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -332,23 +332,22 @@ 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;
-       }
+       if (c->cpuid_level >= 7)
+               cpuid_count(7, 0, &eax, &ebx,
+                            &c->x86_capability[FEATURESET_7c0], &edx);
 
        eax = cpuid_eax(0x80000000);
        if ((eax >> 16) == 0x8000 && eax >= 0x80000008) {
--- a/xen/arch/x86/efi/efi-boot.h
+++ b/xen/arch/x86/efi/efi-boot.h
@@ -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;
--- a/xen/arch/x86/mpparse.c
+++ b/xen/arch/x86/mpparse.c
@@ -516,7 +516,7 @@ static inline void __init construct_defa
                                   (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++) {
--- a/xen/arch/x86/tsx.c
+++ b/xen/arch/x86/tsx.c
@@ -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 )




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.