Skip to content

Commit a9d0adc

Browse files
aeglbp3tk0v
authored andcommitted
x86/cpu/vfm: Add/initialize x86_vfm field to struct cpuinfo_x86
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]
1 parent 90167e9 commit a9d0adc

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
@@ -108,9 +108,23 @@ struct cpuinfo_topology {
108108
};
109109

110110
struct cpuinfo_x86 {
111-
__u8 x86; /* CPU family */
112-
__u8 x86_vendor; /* CPU vendor */
113-
__u8 x86_model;
111+
union {
112+
/*
113+
* The particular ordering (low-to-high) of (vendor,
114+
* family, model) is done in case range of models, like
115+
* it is usually done on AMD, need to be compared.
116+
*/
117+
struct {
118+
__u8 x86_model;
119+
/* CPU family */
120+
__u8 x86;
121+
/* CPU vendor */
122+
__u8 x86_vendor;
123+
__u8 x86_reserved;
124+
};
125+
/* combined vendor, family, model */
126+
__u32 x86_vfm;
127+
};
114128
__u8 x86_stepping;
115129
#ifdef CONFIG_X86_64
116130
/* Number of 4K pages in DTLB/ITLB combined(in pages): */

0 commit comments

Comments
 (0)