mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 12:44:03 +02:00
x86/cpu: Move intel_get_platform_id() to cpu/intel.c
It is not only used in the microcode loader anymore and the platform ID is cached in the cpuinfo_x86 structure so move the getter to Intel CPU-specific code. No functional changes. Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Reviewed-by: Binbin Wu <binbin.wu@linux.intel.com> Reviewed-by: Xiaoyao Li <xiaoyao.li@intel.com> Link: https://lore.kernel.org/all/20260430020953.1405535-1-binbin.wu@linux.intel.com
This commit is contained in:
parent
324549c06e
commit
77d34d3950
|
|
@ -62,8 +62,6 @@ static inline int intel_microcode_get_datasize(struct microcode_header_intel *hd
|
|||
return hdr->datasize ? : DEFAULT_UCODE_DATASIZE;
|
||||
}
|
||||
|
||||
extern u32 intel_get_platform_id(void);
|
||||
|
||||
static inline u32 intel_get_microcode_revision(void)
|
||||
{
|
||||
u32 rev, dummy;
|
||||
|
|
|
|||
|
|
@ -238,6 +238,7 @@ extern void early_cpu_init(void);
|
|||
extern void identify_secondary_cpu(unsigned int cpu);
|
||||
extern void print_cpu_info(struct cpuinfo_x86 *);
|
||||
void print_cpu_msr(struct cpuinfo_x86 *);
|
||||
extern u32 intel_get_platform_id(void);
|
||||
|
||||
/*
|
||||
* Friendlier CR3 helpers.
|
||||
|
|
|
|||
|
|
@ -199,6 +199,41 @@ void intel_unlock_cpuid_leafs(struct cpuinfo_x86 *c)
|
|||
c->cpuid_level = cpuid_eax(0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Use CPUID to generate a "vfm" value. Useful before cpuinfo_x86
|
||||
* structures are populated.
|
||||
*/
|
||||
static u32 intel_cpuid_vfm(void)
|
||||
{
|
||||
u32 eax = cpuid_eax(1);
|
||||
u32 fam = x86_family(eax);
|
||||
u32 model = x86_model(eax);
|
||||
|
||||
return IFM(fam, model);
|
||||
}
|
||||
|
||||
u32 intel_get_platform_id(void)
|
||||
{
|
||||
unsigned int val[2];
|
||||
|
||||
if (x86_hypervisor_present)
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* This can be called early. Use CPUID directly instead of
|
||||
* relying on cpuinfo_x86 which may not be fully initialized.
|
||||
* The PII does not have MSR_IA32_PLATFORM_ID. Everything
|
||||
* before _it_ has no microcode (for Linux at least).
|
||||
*/
|
||||
if (intel_cpuid_vfm() <= INTEL_PENTIUM_II_KLAMATH)
|
||||
return 0;
|
||||
|
||||
/* get processor flags from MSR 0x17 */
|
||||
native_rdmsr(MSR_IA32_PLATFORM_ID, val[0], val[1]);
|
||||
|
||||
return (val[1] >> 18) & 7;
|
||||
}
|
||||
|
||||
static void early_init_intel(struct cpuinfo_x86 *c)
|
||||
{
|
||||
u64 misc_enable;
|
||||
|
|
|
|||
|
|
@ -121,42 +121,6 @@ static inline unsigned int exttable_size(struct extended_sigtable *et)
|
|||
return et->count * EXT_SIGNATURE_SIZE + EXT_HEADER_SIZE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Use CPUID to generate a "vfm" value. Useful before cpuinfo_x86
|
||||
* structures are populated.
|
||||
*/
|
||||
static u32 intel_cpuid_vfm(void)
|
||||
{
|
||||
u32 eax = cpuid_eax(1);
|
||||
u32 fam = x86_family(eax);
|
||||
u32 model = x86_model(eax);
|
||||
|
||||
return IFM(fam, model);
|
||||
}
|
||||
|
||||
u32 intel_get_platform_id(void)
|
||||
{
|
||||
unsigned int val[2];
|
||||
|
||||
if (x86_hypervisor_present)
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* This can be called early. Use CPUID directly instead of
|
||||
* relying on cpuinfo_x86 which may not be fully initialized.
|
||||
* The PII does not have MSR_IA32_PLATFORM_ID. Everything
|
||||
* before _it_ has no microcode (for Linux at least).
|
||||
*/
|
||||
if (intel_cpuid_vfm() <= INTEL_PENTIUM_II_KLAMATH)
|
||||
return 0;
|
||||
|
||||
/* get processor flags from MSR 0x17 */
|
||||
native_rdmsr(MSR_IA32_PLATFORM_ID, val[0], val[1]);
|
||||
|
||||
return (val[1] >> 18) & 7;
|
||||
}
|
||||
|
||||
void intel_collect_cpu_info(struct cpu_signature *sig)
|
||||
{
|
||||
sig->sig = cpuid_eax(1);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user