Skip to content

Commit cb3491e

Browse files
aeglgregkh
authored andcommitted
x86/cpu/vfm: Add/initialize x86_vfm field to struct cpuinfo_x86
[ Upstream commit a9d0adc ] Refactor struct cpuinfo_x86 so that the vendor, family, and model fields are overlaid in a union with a 32-bit field that combines all three (together with a one byte reserved field in the upper byte). This will make it easy, cheap, and reliable to check all three values at once. See https://lore.kernel.org/r/Zgr6kT8oULbnmEXx@agluck-desk3 for why the ordering is (low-to-high bits): (vendor, family, model) [ bp: Move comments over the line, add the backstory about the particular order of the fields. ] Signed-off-by: Tony Luck <[email protected]> Signed-off-by: Borislav Petkov (AMD) <[email protected]> Reviewed-by: Thomas Gleixner <[email protected]> Link: https://lore.kernel.org/r/[email protected] Stable-dep-of: c9a4b55 ("x86/cpu: Add Lunar Lake to list of CPUs with a broken MONITOR implementation") Signed-off-by: Sasha Levin <[email protected]>
1 parent f3a3192 commit cb3491e

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

arch/x86/include/asm/processor.h

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,23 @@ extern u16 __read_mostly tlb_lld_1g[NR_INFO];
8181
*/
8282

8383
struct cpuinfo_x86 {
84-
__u8 x86; /* CPU family */
85-
__u8 x86_vendor; /* CPU vendor */
86-
__u8 x86_model;
84+
union {
85+
/*
86+
* The particular ordering (low-to-high) of (vendor,
87+
* family, model) is done in case range of models, like
88+
* it is usually done on AMD, need to be compared.
89+
*/
90+
struct {
91+
__u8 x86_model;
92+
/* CPU family */
93+
__u8 x86;
94+
/* CPU vendor */
95+
__u8 x86_vendor;
96+
__u8 x86_reserved;
97+
};
98+
/* combined vendor, family, model */
99+
__u32 x86_vfm;
100+
};
87101
__u8 x86_stepping;
88102
#ifdef CONFIG_X86_64
89103
/* Number of 4K pages in DTLB/ITLB combined(in pages): */

0 commit comments

Comments
 (0)