Commit b8e10c86 authored by Dave Hansen's avatar Dave Hansen
Browse files

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: default avatarDave Hansen <dave.hansen@linux.intel.com>
Link: https://lore.kernel.org/all/20241213185128.8F24EEFC%40davehans-spike.ostc.intel.com
parent 4bf61049
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -278,5 +278,6 @@ struct x86_cpu_desc {

extern const struct x86_cpu_id *x86_match_cpu(const struct x86_cpu_id *match);
extern bool x86_cpu_has_min_microcode_rev(const struct x86_cpu_desc *table);
extern bool x86_match_min_microcode_rev(const struct x86_cpu_id *table);

#endif /* _ASM_X86_CPU_DEVICE_ID */
+11 −0
Original line number Diff line number Diff line
@@ -86,3 +86,14 @@ bool x86_cpu_has_min_microcode_rev(const struct x86_cpu_desc *table)
	return true;
}
EXPORT_SYMBOL_GPL(x86_cpu_has_min_microcode_rev);

bool x86_match_min_microcode_rev(const struct x86_cpu_id *table)
{
	const struct x86_cpu_id *res = x86_match_cpu(table);

	if (!res || res->driver_data > boot_cpu_data.microcode)
		return false;

	return true;
}
EXPORT_SYMBOL_GPL(x86_match_min_microcode_rev);