Re: [RFC PATCH v2] tools/x86: add kcpuid tool to show raw CPU features
From: Borislav Petkov
Date: Fri Sep 25 2020 - 13:24:42 EST
On Tue, Sep 22, 2020 at 01:27:50PM +0800, Feng Tang wrote:
> +++ b/tools/arch/x86/kcpuid/cpuid.txt
> @@ -0,0 +1,58 @@
> +# Leaf 00H
> +
> +LEAF[00000000],SUBLEAF[00],EAX[ 31:0],max_basic_leafs, Max input value for supported subleafs
> +
> +
> +# Leaf 01H
> +
> +LEAF[00000001],SUBLEAF[00],EAX[ 3:0],stepping, Stepping ID
> +LEAF[00000001],SUBLEAF[00],EAX[ 7:4],model, Model
> +LEAF[00000001],SUBLEAF[00],EAX[ 11:8],family, Family ID
> +LEAF[00000001],SUBLEAF[00],EAX[13:12],processor, Processor Type
> +LEAF[00000001],SUBLEAF[00],EAX[19:16],model_ext, Extended Model ID
> +LEAF[00000001],SUBLEAF[00],EAX[27:20],family_ext, Extended Family ID
Yeah, this looks good but how about we simplify and ease the parsing
even more? I.e., make it a real csv:
# Table row names:
# LEAF,SUBLEAF,register_name,bits,short name, long name
0x1,0,EBX,7:0,brand,Brand Index
0x1,0,EBX,15:8,clflush_size,CLFLUSH line size (value * 8) in bytes
0x1,0,EBX,23:16,max_cpu_id,Maxim number of addressable logic cpu ID in this package
...
Yeah, this way it might not be as readable but the format is pretty simple and
everybody knows .csv so....
We can even do vertical alignment for better readability:
# LEAF,SUBLEAF,register, bits,short name, long name
1, 0, EBX, 7:0,brand,Brand Index
1, 0, EBX, 15:8,clflush_size,CLFLUSH line size (value * 8) in bytes
1, 0, EBX, 23:16,max_cpu_id,Maxim number of addressable logic cpu ID in this package
0x80000000, 12, EAX, 3,eee, EEE
and can keep it in tabellary form this way. The parsing code should
asimply split on ',' and ignore whitespace.
Thoughts?
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette