lkml.org 
[lkml]   [2023]   [Feb]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 3/3] tools/x86/kcpuid: Dump the CPUID function in detailed view
Date
From: "Borislav Petkov (AMD)" <bp@alien8.de>

Sometimes it is useful to know which CPUID leaf contains the fields so
add it to -d output so that it looks like this:

CPUID_0x8000001e_ECX[0x0]:
extended_apic_id : 0x8 - Extended APIC ID
core_id : 0x4 - Identifies the logical core ID
threads_per_core : 0x1 - The number of threads per core is threads_per_core + 1
node_id : 0x0 - Node ID
nodes_per_processor : 0x0 - Nodes per processor { 0: 1 node, else reserved }

CPUID_0x8000001f_ECX[0x0]:
sme - Secure Memory Encryption

...

Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Signed-off-by: Terry Bowman <terry.bowman@amd.com>
---
tools/arch/x86/kcpuid/kcpuid.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/tools/arch/x86/kcpuid/kcpuid.c b/tools/arch/x86/kcpuid/kcpuid.c
index dae75511fef7..3bab3398cec3 100644
--- a/tools/arch/x86/kcpuid/kcpuid.c
+++ b/tools/arch/x86/kcpuid/kcpuid.c
@@ -468,13 +468,21 @@ static void show_leaf(struct subleaf *leaf)
if (!leaf)
return;

- if (show_raw)
+ if (show_raw) {
leaf_print_raw(leaf);
+ } else {
+ if (show_details)
+ printf("CPUID_0x%x_ECX[0x%x]:\n",
+ leaf->index, leaf->sub);
+ }

decode_bits(leaf->eax, &leaf->info[R_EAX]);
decode_bits(leaf->ebx, &leaf->info[R_EBX]);
decode_bits(leaf->ecx, &leaf->info[R_ECX]);
decode_bits(leaf->edx, &leaf->info[R_EDX]);
+
+ if (!show_raw && show_details)
+ printf("\n");
}

static void show_func(struct cpuid_func *func)
--
2.34.1
\
 
 \ /
  Last update: 2023-03-27 00:11    [W:1.188 / U:0.200 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site