tools/x86/kcpuid: Parse subleaf ranges if provided
authorAhmed S. Darwish <darwi@linutronix.de>
Thu, 18 Jul 2024 13:47:47 +0000 (15:47 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Fri, 2 Aug 2024 07:17:19 +0000 (09:17 +0200)
commit58921443e9b04bbb1866070ed14ea39578302cea
tree7bd6dc36c28032d58635a77c400ac5683c3b3fab
parentb0a59d14966dbfe0d544b2595dcb29728d41daf3
tools/x86/kcpuid: Parse subleaf ranges if provided

It's a common pattern in cpuid leaves to have the same bitfields format
repeated across a number of subleaves.  Typically, this is used for
enumerating hierarchial structures like cache and TLB levels, CPU
topology levels, etc.

Modify kcpuid.c to handle subleaf ranges in the CSV file subleaves
column.  For example, make it able to parse lines in the form:

 # LEAF, SUBLEAVES,  reg,    bits,    short_name             , ...
    0xb,       1:0,  eax,     4:0,    x2apic_id_shift        , ...
    0xb,       1:0,  ebx,    15:0,    domain_lcpus_count     , ...
    0xb,       1:0,  ecx,     7:0,    domain_nr              , ...

This way, full output can be printed to the user.

Signed-off-by: Ahmed S. Darwish <darwi@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20240718134755.378115-8-darwi@linutronix.de
tools/arch/x86/kcpuid/kcpuid.c