ARM: split out processor lookup
Commit 65987a8553061515b5851b472081aedb9837a391 upstream. Split out the lookup of the processor type and associated error handling from the rest of setup_processor() - we will need to use this in the secondary CPU bringup path for big.Little Spectre variant 2 mitigation. Reviewed-by: Julien Thierry <julien.thierry@arm.com> Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Signed-off-by: David A. Long <dave.long@linaro.org> Reviewed-by: Julien Thierry <julien.thierry@arm.com> Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
14899ca00b
commit
0350343ee6
2 changed files with 22 additions and 14 deletions
|
@ -93,6 +93,7 @@
|
||||||
#define ARM_CPU_PART_SCORPION 0x510002d0
|
#define ARM_CPU_PART_SCORPION 0x510002d0
|
||||||
|
|
||||||
extern unsigned int processor_id;
|
extern unsigned int processor_id;
|
||||||
|
struct proc_info_list *lookup_processor(u32 midr);
|
||||||
|
|
||||||
#ifdef CONFIG_CPU_CP15
|
#ifdef CONFIG_CPU_CP15
|
||||||
#define read_cpuid(reg) \
|
#define read_cpuid(reg) \
|
||||||
|
|
|
@ -599,21 +599,28 @@ static void __init smp_build_mpidr_hash(void)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* locate processor in the list of supported processor types. The linker
|
||||||
|
* builds this table for us from the entries in arch/arm/mm/proc-*.S
|
||||||
|
*/
|
||||||
|
struct proc_info_list *lookup_processor(u32 midr)
|
||||||
|
{
|
||||||
|
struct proc_info_list *list = lookup_processor_type(midr);
|
||||||
|
|
||||||
|
if (!list) {
|
||||||
|
pr_err("CPU%u: configuration botched (ID %08x), CPU halted\n",
|
||||||
|
smp_processor_id(), midr);
|
||||||
|
while (1)
|
||||||
|
/* can't use cpu_relax() here as it may require MMU setup */;
|
||||||
|
}
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
static void __init setup_processor(void)
|
static void __init setup_processor(void)
|
||||||
{
|
{
|
||||||
struct proc_info_list *list;
|
unsigned int midr = read_cpuid_id();
|
||||||
|
struct proc_info_list *list = lookup_processor(midr);
|
||||||
/*
|
|
||||||
* locate processor in the list of supported processor
|
|
||||||
* types. The linker builds this table for us from the
|
|
||||||
* entries in arch/arm/mm/proc-*.S
|
|
||||||
*/
|
|
||||||
list = lookup_processor_type(read_cpuid_id());
|
|
||||||
if (!list) {
|
|
||||||
pr_err("CPU configuration botched (ID %08x), unable to continue.\n",
|
|
||||||
read_cpuid_id());
|
|
||||||
while (1);
|
|
||||||
}
|
|
||||||
|
|
||||||
cpu_name = list->cpu_name;
|
cpu_name = list->cpu_name;
|
||||||
__cpu_architecture = __get_cpu_architecture();
|
__cpu_architecture = __get_cpu_architecture();
|
||||||
|
@ -632,7 +639,7 @@ static void __init setup_processor(void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
pr_info("CPU: %s [%08x] revision %d (ARMv%s), cr=%08lx\n",
|
pr_info("CPU: %s [%08x] revision %d (ARMv%s), cr=%08lx\n",
|
||||||
cpu_name, read_cpuid_id(), read_cpuid_id() & 15,
|
list->cpu_name, midr, midr & 15,
|
||||||
proc_arch[cpu_architecture()], get_cr());
|
proc_arch[cpu_architecture()], get_cr());
|
||||||
|
|
||||||
snprintf(init_utsname()->machine, __NEW_UTS_LEN + 1, "%s%c",
|
snprintf(init_utsname()->machine, __NEW_UTS_LEN + 1, "%s%c",
|
||||||
|
|
Loading…
Add table
Reference in a new issue