tools/x86/kcpuid: Refactor CPUID range handling for future expansion
authorAhmed S. Darwish <darwi@linutronix.de>
Mon, 24 Mar 2025 14:20:32 +0000 (15:20 +0100)
committerIngo Molnar <mingo@kernel.org>
Tue, 25 Mar 2025 08:53:46 +0000 (09:53 +0100)
commit3151ec059dd1e71761f3beccc1e5f5c18fac4afa
treec53e1a4f1a5c54a418a10af77b87fdedfe782a42
parentc479a84488d10b3d4259186d80839f99e26b1706
tools/x86/kcpuid: Refactor CPUID range handling for future expansion

The kcpuid code assumes only two CPUID index ranges, standard (0x0...)
and extended (0x80000000...).

Since additional CPUID index ranges will be added in further commits,
replace the "is_ext" boolean with enumeration-based range classification.

Collect all CPUID ranges in a structured array and introduce helper
macros to iterate over it.  Use such helpers throughout the code.

Signed-off-by: Ahmed S. Darwish <darwi@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Link: https://lore.kernel.org/r/20250324142042.29010-12-darwi@linutronix.de
tools/arch/x86/kcpuid/kcpuid.c