Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

x86/cpu: Add platform ID to CPU info structure

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.

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@linux.intel.com>
Reviewed-by: Sohil Mehta <sohil.mehta@intel.com>
Reviewed-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Link: https://patch.msgid.link/20260304181020.8D518228@davehans-spike.ostc.intel.com

+9 -1
+2
arch/x86/include/asm/microcode.h
··· 61 61 return hdr->datasize ? : DEFAULT_UCODE_DATASIZE; 62 62 } 63 63 64 + extern u32 intel_get_platform_id(void); 65 + 64 66 static inline u32 intel_get_microcode_revision(void) 65 67 { 66 68 u32 rev, dummy;
+5
arch/x86/include/asm/processor.h
··· 140 140 __u32 x86_vfm; 141 141 }; 142 142 __u8 x86_stepping; 143 + union { 144 + // MSR_IA32_PLATFORM_ID[52-50] 145 + __u8 intel_platform_id; 146 + __u8 amd_unused; 147 + }; 143 148 #ifdef CONFIG_X86_64 144 149 /* Number of 4K pages in DTLB/ITLB combined(in pages): */ 145 150 int x86_tlbsize;
+1
arch/x86/kernel/cpu/intel.c
··· 205 205 206 206 if (c->x86 >= 6 && !cpu_has(c, X86_FEATURE_IA64)) 207 207 c->microcode = intel_get_microcode_revision(); 208 + c->intel_platform_id = intel_get_platform_id(); 208 209 209 210 /* Now if any of them are set, check the blacklist and clear the lot */ 210 211 if ((cpu_has(c, X86_FEATURE_SPEC_CTRL) ||
+1 -1
arch/x86/kernel/cpu/microcode/intel.c
··· 134 134 return IFM(fam, model); 135 135 } 136 136 137 - static u32 intel_get_platform_id(void) 137 + u32 intel_get_platform_id(void) 138 138 { 139 139 unsigned int val[2]; 140 140