x86/cpu: Add platform ID to CPU info structure
Quoted 39 lines · Dave Hansen
From: Dave Hansen <[email protected]>
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->microcodeis 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 <[email protected]>Cc Thomas Gleixner <[email protected]>Cc Ingo Molnar <[email protected]>Cc Borislav Petkov <[email protected]>Cc Dave Hansen <[email protected]>Cc "H. Peter Anvin" <[email protected]>Cc Tony Luck <[email protected]>Cc Pawan Gupta <[email protected]>Cc "Peter Zijlstra (Intel)" <[email protected]>Cc Jon Kohler <[email protected]>---
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_steppingarch/x86/include/asm/processor.h
arch/x86/include/asm/processor.h struct cpuinfo_x86 { · line 143
Quoted 4 lines
arch/x86/include/asm/processor.h renamed from arch/x86/include/asm/processor.h~cpu-x86_stepping +1
-0@@ -140,6 +140,7 @@ struct cpuinfo_x86 {__u32 x86_vfm; };__u8 x86_stepping; +__u8 x86_platform_id;/* Intel-only. 3 bits */
Should platform ID be added to print_cpu_info()?
So it's printed alongside (family: 0xN model: 0xN, stepping: 0xN)
Signature · 2 lines
Kind regards Maciej Wieczór-Retman
Quoted 5 lines · Maciej Wieczor-Retman
Review
Quoted 2 lines
__u8 x86_stepping;(quoted diff) +1
-0+ __u8 x86_platform_id; /* Intel-only. 3 bits */Should platform ID be added to
print_cpu_info()?So it's printed alongside (family: 0xN model: 0xN, stepping: 0xN)
It's not a horrible idea, but it's also relatively worthless compared to the other three. I'd certainly take a look at it if someone sent a patch, but I'm not really looking to add more to this series that doesn't _need_ to be here.
Quoted 11 lines · Dave Hansen
Quoted 5 lines · Maciej Wieczor-Retman
Review
Quoted 2 lines
__u8 x86_stepping;(quoted diff) +1
-0+ __u8 x86_platform_id; /* Intel-only. 3 bits */Should platform ID be added to
print_cpu_info()?So it's printed alongside (family: 0xN model: 0xN, stepping: 0xN)
It's not a horrible idea, but it's also relatively worthless compared to the other three. I'd certainly take a look at it if someone sent a patch, but I'm not really looking to add more to this series that doesn't _need_ to be here.
Fair enough, and I suppose if someone really needs this information they can just read the MSR themselves.
Signature · 2 lines
Kind regards Maciej Wieczór-Retman
Quoted 6 lines · Maciej Wieczor-Retman
Quoted 5 lines · Dave Hansen
Quoted 4 lines · Maciej Wieczor-Retman
Review
Quoted 2 lines
__u8 x86_stepping;(quoted diff) +1
-0+ __u8 x86_platform_id; /* Intel-only. 3 bits */Should platform ID be added to
print_cpu_info()?
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
So it's printed alongside (family: 0xN model: 0xN, stepping: 0xN)
It's not a horrible idea, but it's also relatively worthless compared to the other three. I'd certainly take a look at it if someone sent a patch, but I'm not really looking to add more to this series that doesn't _need_ to be here.
Fair enough, and I suppose if someone really needs this information they can just read the MSR themselves.
Right. If they get some weird "old_microcode" output, they can go use rdmsr(1) to debug it if they're root. It might make debugging issues a _wee_ bit easier to have the platform_id in dmesg, but it's only used in two places in the kernel, so the value is *MUCH* lower than family/model/stepping which are used all over.
Also, despite being 6 patches, this series is _just_ about as small as I can make it to fix the bug at hand. Even if we decided a pr_whatever() would be really nice, it's not a bug fix and would (IMNHO) need to be in a separate series.