Skip to content

Commit b8e10c8

Browse files
committed
x86/cpu: Introduce new microcode matching helper
The 'x86_cpu_id' and 'x86_cpu_desc' structures are very similar and need to be consolidated. There is a microcode version matching function for 'x86_cpu_desc' but not 'x86_cpu_id'. Create one for 'x86_cpu_id'. This essentially just leverages the x86_cpu_id->driver_data field to replace the less generic x86_cpu_desc->x86_microcode_rev field. Signed-off-by: Dave Hansen <[email protected]> Link: https://lore.kernel.org/all/20241213185128.8F24EEFC%40davehans-spike.ostc.intel.com
1 parent 4bf6104 commit b8e10c8

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

arch/x86/include/asm/cpu_device_id.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,5 +278,6 @@ struct x86_cpu_desc {
278278

279279
extern const struct x86_cpu_id *x86_match_cpu(const struct x86_cpu_id *match);
280280
extern bool x86_cpu_has_min_microcode_rev(const struct x86_cpu_desc *table);
281+
extern bool x86_match_min_microcode_rev(const struct x86_cpu_id *table);
281282

282283
#endif /* _ASM_X86_CPU_DEVICE_ID */

arch/x86/kernel/cpu/match.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,14 @@ bool x86_cpu_has_min_microcode_rev(const struct x86_cpu_desc *table)
8686
return true;
8787
}
8888
EXPORT_SYMBOL_GPL(x86_cpu_has_min_microcode_rev);
89+
90+
bool x86_match_min_microcode_rev(const struct x86_cpu_id *table)
91+
{
92+
const struct x86_cpu_id *res = x86_match_cpu(table);
93+
94+
if (!res || res->driver_data > boot_cpu_data.microcode)
95+
return false;
96+
97+
return true;
98+
}
99+
EXPORT_SYMBOL_GPL(x86_match_min_microcode_rev);

0 commit comments

Comments
 (0)