Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp2902408ybx; Fri, 8 Nov 2019 11:02:30 -0800 (PST) X-Google-Smtp-Source: APXvYqxxKw8fkcEmBWXQQYRGp7OEAlZCjfyBWiB2qAHDMw/QjdnwCdsaeJhZB+dy3jpWgliGqC/y X-Received: by 2002:a1c:9c82:: with SMTP id f124mr10318425wme.25.1573239750707; Fri, 08 Nov 2019 11:02:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573239750; cv=none; d=google.com; s=arc-20160816; b=q6ODseAanc1WsQjqiC5YBSlY1w4xYJftzwrpLpwftFwSB/d4mSyWz2kMTsWmJBz0xg 2HRZprbrSNNiGhr3ho4rmwODYU2h+ADy3fdmoMC5HP95vMyeYpYVOC/6mdWKyUpnLvIH 0DdWHSyus1VGIL8LYS/qBPjkDvB7ehljeYMx8KUVTbnMIokmGXzM4u4ABJV1/8iT4uUc eK/GHz2RcuTq2LLZcc5+IqmnIiG50rJ2vFokWLmYWlOsI+DeTSyP1MGyCVIyE+SWGeZX TDt2THkwcaLqutCkHFW9rgfD2chxyCNNYVIudfdrvKQ+9aeQp/Up8O5cDRL3JoIAzffs NkcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=AhOpkeZnRTia+HheyElL+1w7doT893XnYkHPYRu/xO0=; b=wFqON3SnouVPJLBwg8T5MfD/VZf3FTNs0c243tXsrfXaUg0A1Hi9PLrv731Xtj36xt 5d0zKcOvPU9W10OvAcP6vlWWw7I6Yi82vNcX8ND9nz1cAY846+fiEd5ASZGD4s7PXKaV dSvbtDcUP4kR3Q/ebP3RnFw6Iighz0ti2UDCD/HshOIN56hRhZsjs1lYy3CL43hPNKKW EVaa4JnuyC22nWV8Bx9Qs2uLnmKZRy1V1VzuMhd/29i9Jdx7Kb9dkbP3wcHdcadvcC3m 7dCJY66a6geElGtBvVkWc7fuTlBOm+Vroepk7IVBdNKFYOsLfKDj785eVOvpHf2KwRgC 4auQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=q6R3R2YS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o3si5288728edi.374.2019.11.08.11.02.06; Fri, 08 Nov 2019 11:02:30 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=q6R3R2YS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733233AbfKHSzI (ORCPT + 99 others); Fri, 8 Nov 2019 13:55:08 -0500 Received: from mail.kernel.org ([198.145.29.99]:52256 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731291AbfKHSzF (ORCPT ); Fri, 8 Nov 2019 13:55:05 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C47ED214DB; Fri, 8 Nov 2019 18:55:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573239304; bh=R+Td6S4dI+TenoqDGGPIUd7g1JBpVKmkh8jNH1/o1pk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q6R3R2YSLRCOHXTf2JM9F4hrUp8fGBaPNqR91+Z8eLHuD/pG1UP9pMIQo71rigesl VjPbrdVOEu7J9qZEZM7TSgJyJA1bC/k40SfkEviawDbswVllLcVPwYvHHFCleE80Nx 8L+ermw/+5FkR2k6hLjURr2D1Nmao8QJDISAGwKc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , "linus.walleij@linaro.org, rmk+kernel@armlinux.org.uk, Ard Biesheuvel" , Julien Thierry , Russell King , "David A. Long" , Sasha Levin , Ard Biesheuvel Subject: [PATCH 4.4 68/75] ARM: split out processor lookup Date: Fri, 8 Nov 2019 19:50:25 +0100 Message-Id: <20191108174810.091463197@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191108174708.135680837@linuxfoundation.org> References: <20191108174708.135680837@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Russell King 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 Signed-off-by: Russell King Signed-off-by: David A. Long Reviewed-by: Julien Thierry Signed-off-by: Sasha Levin Signed-off-by: Ard Biesheuvel Signed-off-by: Greg Kroah-Hartman --- arch/arm/include/asm/cputype.h | 1 + arch/arm/kernel/setup.c | 31 +++++++++++++++++++------------ 2 files changed, 20 insertions(+), 12 deletions(-) --- a/arch/arm/include/asm/cputype.h +++ b/arch/arm/include/asm/cputype.h @@ -93,6 +93,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) \ --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c @@ -599,22 +599,29 @@ static void __init smp_build_mpidr_hash( } #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(); @@ -632,7 +639,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",