Re: [PATCH 4/6] x86/cpu: Add platform ID to CPU info structure
From: Chao Gao
Date: Mon Jan 19 2026 - 22:14:40 EST
On Mon, Jan 19, 2026 at 11:50:55AM -0800, Dave Hansen wrote:
>
>From: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>
>
>The end goal here is to be able to do x86_match_cpu() and match on a
>specific platform ID. While it would be possible to stash this ID
>off somewhere or read it dynamically, that approaches would not be
>consistent with the other fields which can be matched.
>
>Read the platform ID and store it in cpuinfo_x86->x86_platform_id.
>
>There are lots of sites to set this new field. Place it near
>the place c->microcode is established since the platform ID is
>so closely intertwined with microcode updates.
>
>Note: This should not grow the size of 'struct cpuinfo_x86' in
>practice since the u8 fits next to another u8 in the structure.
>
>Signed-off-by: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>
>Cc: Thomas Gleixner <tglx@xxxxxxxxxx>
>Cc: Ingo Molnar <mingo@xxxxxxxxxx>
>Cc: Borislav Petkov <bp@xxxxxxxxx>
>Cc: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>
>Cc: "H. Peter Anvin" <hpa@xxxxxxxxx>
>Cc: Tony Luck <tony.luck@xxxxxxxxx>
>Cc: Pawan Gupta <pawan.kumar.gupta@xxxxxxxxxxxxxxx>
>Cc: "Peter Zijlstra (Intel)" <peterz@xxxxxxxxxxxxx>
>Cc: x86@xxxxxxxxxx
>Cc: Jon Kohler <jon@xxxxxxxxxxx>
>---
>
> b/arch/x86/include/asm/processor.h | 1 +
> b/arch/x86/kernel/cpu/common.c | 4 +++-
> b/arch/x86/kernel/cpu/intel.c | 1 +
> 3 files changed, 5 insertions(+), 1 deletion(-)
>
>diff -puN arch/x86/include/asm/processor.h~cpu-x86_stepping arch/x86/include/asm/processor.h
>--- a/arch/x86/include/asm/processor.h~cpu-x86_stepping 2026-01-19 11:38:09.341914025 -0800
>+++ b/arch/x86/include/asm/processor.h 2026-01-19 11:38:09.444917962 -0800
>@@ -140,6 +140,7 @@ struct cpuinfo_x86 {
> __u32 x86_vfm;
> };
> __u8 x86_stepping;
>+ __u8 x86_platform_id; /* Intel-only. 3 bits */
Tail comments are not preferred. I've seen tglx complain about them a few times.
Also, "3 bits" is misleading since x86_platform_id actually stores a bit mask.