lkml.org 
[lkml]   [2018]   [Nov]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH AUTOSEL 4.9 10/15] ARM: split out processor lookup
Sorry, I meant this patch, not patch 11.

On Thu, Nov 22, 2018 at 02:56:16PM -0500, Sasha Levin wrote:
> From: Russell King <rmk+kernel@armlinux.org.uk>
>
> [ Upstream commit 65987a8553061515b5851b472081aedb9837a391 ]
>
> 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: Sasha Levin <sashal@kernel.org>
> ---
> arch/arm/include/asm/cputype.h | 1 +
> arch/arm/kernel/setup.c | 31 +++++++++++++++++++------------
> 2 files changed, 20 insertions(+), 12 deletions(-)
>
> diff --git a/arch/arm/include/asm/cputype.h b/arch/arm/include/asm/cputype.h
> index b62eaeb147aa..65db1376f09a 100644
> --- a/arch/arm/include/asm/cputype.h
> +++ b/arch/arm/include/asm/cputype.h
> @@ -98,6 +98,7 @@
> #define ARM_CPU_PART_SCORPION 0x510002d0
>
> extern unsigned int processor_id;
> +struct proc_info_list *lookup_processor(u32 midr);
>
> #ifdef CONFIG_CPU_CP15
> #define read_cpuid(reg) \
> diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
> index f4e54503afa9..8d5c3a118abe 100644
> --- a/arch/arm/kernel/setup.c
> +++ b/arch/arm/kernel/setup.c
> @@ -667,22 +667,29 @@ static void __init smp_build_mpidr_hash(void)
> }
> #endif
>
> -static void __init setup_processor(void)
> +/*
> + * 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;
> + struct proc_info_list *list = lookup_processor_type(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);
> + 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)
> +{
> + unsigned int midr = read_cpuid_id();
> + struct proc_info_list *list = lookup_processor(midr);
> +
> cpu_name = list->cpu_name;
> __cpu_architecture = __get_cpu_architecture();
>
> @@ -700,7 +707,7 @@ static void __init setup_processor(void)
> #endif
>
> 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());
>
> snprintf(init_utsname()->machine, __NEW_UTS_LEN + 1, "%s%c",
> --
> 2.17.1
>

--
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
According to speedtest.net: 11.9Mbps down 500kbps up

\
 
 \ /
  Last update: 2018-11-23 01:05    [W:0.091 / U:0.376 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site