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

[Xen-devel] [PATCH] tools/misc: Tweak reserved bit handling for xen-cpuid



Instead of printing REZ, use NULL pointers to indicate missing information,
and have dump_leaf() print out the bit which is unknown.

E.g.

....
Dynamic sets:
Raw                       
178bfbff:fed8320b:2fd3fbff:35c233ff:0000000f:209c01a9:00000000:00006799:00001007:00000000
  [00] 0x00000001.edx     fpu vme de pse tsc msr pae mce cx8 apic sysenter mtrr 
pge  ...
  [01] 0x00000001.ecx     sse3 pclmulqdq monitor ssse3 fma cx16 sse41 sse42 
movebe   ...
  [02] 0x80000001.edx     fpu vme de pse tsc msr pae mce cx8 apic syscall mtrr 
pge   ...
  [03] 0x80000001.ecx     lahf_lm cmp svm extapic cr8d lzcnt sse4a msse 3dnowpf 
osvw ...
  [04] 0x0000000d:1.eax   xsaveopt xsavec xgetbv1 xsaves
  [05] 0x00000007:0.ebx   fsgsbase bmi1 avx2 smep bmi2 rdseed adx smap 
clflushopt sha
  [06] 0x00000007:0.ecx
  [07] 0x80000007.edx     <BIT0> <BIT3> <BIT4> <BIT7> itsc <BIT9> efro <BIT13> 
<BIT14>
  [08] 0x80000008.ebx     clzero <BIT1> <BIT2> ibpb
  [09] 0x00000007:0.edx
...

which is the output on an AMD EPYC system, where Xen doesn't know about, and
has therefore masked, most of the more advanced thermal/perf features.

Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
CC: Jan Beulich <JBeulich@xxxxxxxx>
CC: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
CC: Wei Liu <wei.liu2@xxxxxxxxxx>

Hey look - I've finally got back to some CPUID work...
---
 tools/misc/xen-cpuid.c | 55 +++++++++++++++++---------------------------------
 1 file changed, 18 insertions(+), 37 deletions(-)

diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
index 8c3dac0..d56a8c4 100644
--- a/tools/misc/xen-cpuid.c
+++ b/tools/misc/xen-cpuid.c
@@ -16,12 +16,12 @@ static const char *str_1d[32] =
     [ 4] = "tsc",  [ 5] = "msr",
     [ 6] = "pae",  [ 7] = "mce",
     [ 8] = "cx8",  [ 9] = "apic",
-    [10] = "REZ",  [11] = "sysenter",
+    /* [10] */     [11] = "sysenter",
     [12] = "mtrr", [13] = "pge",
     [14] = "mca",  [15] = "cmov",
     [16] = "pat",  [17] = "pse36",
     [18] = "psn",  [19] = "clflush",
-    [20] = "REZ",  [21] = "ds",
+    /* [20] */     [21] = "ds",
     [22] = "acpi", [23] = "mmx",
     [24] = "fxsr", [25] = "sse",
     [26] = "sse2", [27] = "ss",
@@ -39,7 +39,7 @@ static const char *str_1c[32] =
     [10] = "cntx-id", [11] = "sdgb",
     [12] = "fma",     [13] = "cx16",
     [14] = "xtpr",    [15] = "pdcm",
-    [16] = "REZ",     [17] = "pcid",
+    /* [16] */        [17] = "pcid",
     [18] = "dca",     [19] = "sse41",
     [20] = "sse42",   [21] = "x2apic",
     [22] = "movebe",  [23] = "popcnt",
@@ -56,16 +56,16 @@ static const char *str_e1d[32] =
     [ 4] = "tsc",    [ 5] = "msr",
     [ 6] = "pae",    [ 7] = "mce",
     [ 8] = "cx8",    [ 9] = "apic",
-    [10] = "REZ",    [11] = "syscall",
+    /* [10] */       [11] = "syscall",
     [12] = "mtrr",   [13] = "pge",
     [14] = "mca",    [15] = "cmov",
     [16] = "fcmov",  [17] = "pse36",
-    [18] = "REZ",    [19] = "mp",
-    [20] = "nx",     [21] = "REZ",
+    /* [18] */       [19] = "mp",
+    [20] = "nx",     /* [21] */
     [22] = "mmx+",   [23] = "mmx",
     [24] = "fxsr",   [25] = "fxsr+",
     [26] = "pg1g",   [27] = "rdtscp",
-    [28] = "REZ",    [29] = "lm",
+    /* [28] */       [29] = "lm",
     [30] = "3dnow+", [31] = "3dnow",
 };
 
@@ -78,16 +78,14 @@ static const char *str_e1c[32] =
     [ 8] = "3dnowpf",    [ 9] = "osvw",
     [10] = "ibs",        [11] = "xop",
     [12] = "skinit",     [13] = "wdt",
-    [14] = "REZ",        [15] = "lwp",
+    /* [14] */           [15] = "lwp",
     [16] = "fma4",       [17] = "tce",
-    [18] = "REZ",        [19] = "nodeid",
-    [20] = "REZ",        [21] = "tbm",
+    /* [18] */           [19] = "nodeid",
+    /* [20] */           [21] = "tbm",
     [22] = "topoext",    [23] = "perfctr_core",
-    [24] = "perfctr_nb", [25] = "REZ",
+    [24] = "perfctr_nb", /* [25] */
     [26] = "dbx",        [27] = "perftsc",
     [28] = "pcx_l2i",    [29] = "monitorx",
-
-    [30 ... 31] = "REZ",
 };
 
 static const char *str_7b0[32] =
@@ -114,8 +112,6 @@ static const char *str_Da1[32] =
 {
     [ 0] = "xsaveopt", [ 1] = "xsavec",
     [ 2] = "xgetbv1",  [ 3] = "xsaves",
-
-    [4 ... 31] = "REZ",
 };
 
 static const char *str_7c0[32] =
@@ -124,49 +120,29 @@ static const char *str_7c0[32] =
     [ 2] = "umip",     [ 3] = "pku",
     [ 4] = "ospke",
 
-    [5 ... 13] = "REZ",
-
     [14] = "avx512_vpopcntdq",
 
-    [15 ... 21] = "REZ",
-
     [22] = "rdpid",
-
-    [23 ... 31] = "REZ",
 };
 
 static const char *str_e7d[32] =
 {
-    [0 ... 7] = "REZ",
-
-    [ 8] = "itsc",     [ 9] = "REZ",
+    [ 8] = "itsc",
     [10] = "efro",
-
-    [11 ... 31] = "REZ",
 };
 
 static const char *str_e8b[32] =
 {
     [ 0] = "clzero",
 
-    [1 ... 11] = "REZ",
-
     [12] = "ibpb",
-
-    [13 ... 31] = "REZ",
 };
 
 static const char *str_7d0[32] =
 {
-    [0 ... 1] = "REZ",
-
     [ 2] = "avx512_4vnniw", [ 3] = "avx512_4fmaps",
 
-    [4 ... 25] = "REZ",
-
     [26] = "ibrsb",         [27] = "stibp",
-
-    [28 ... 31] = "REZ",
 };
 
 static struct {
@@ -213,7 +189,12 @@ static void dump_leaf(uint32_t leaf, const char **strs)
 
     for ( i = 0; i < 32; ++i )
         if ( leaf & (1u << i) )
-            printf(" %s", strs[i] ?: "???" );
+        {
+            if ( strs[i] )
+                printf(" %s", strs[i]);
+            else
+                printf(" <BIT%u>", i);
+        }
 }
 
 static void decode_featureset(const uint32_t *features,
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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