Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp96921imj; Thu, 14 Feb 2019 16:08:58 -0800 (PST) X-Google-Smtp-Source: AHgI3IbicMEGnh/B9BEqGLXakZQ9dA/IorikuiBvayPcbQ1UWaVANdh0blw/gEcTyp45yx7901c9 X-Received: by 2002:a63:bd51:: with SMTP id d17mr2594039pgp.443.1550189338774; Thu, 14 Feb 2019 16:08:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550189338; cv=none; d=google.com; s=arc-20160816; b=QMu/+eOTaL1y92NyJ28TQ86Env2Lan9hnpVy0BpDWKuAUsMZ/OxLS/fkxpTfIEpf0q 8MIcwOQXD5WzBkNmP+OKi8uHcRU0VUDAy/whhfmX1mNO8tibjPUCLYZfZxQXxGd3npmr 95rQU5/2wugCxw5VfhvrwStH68sk44CZMhoFDnFd17ReTTcpUxLNVzuLKHemawzuxprO QjUoExux1bSE5qR/UXE299goWtnyuDQhvpoJNcR5WA7scsw3aehdhQFdVyuyg5Y72eic 6LrokN5FERnJs1usALQNw9zpYLaiog0PoMtjZglbPlxfW0/rOUyeD9uQLCVgwRvEsHpO 7C+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=VL5Y6vm9NuZCG1g7W3hxrDkMxlPp0J/npa1K1+DSsiA=; b=iYckDdiSfR19d2j74Ksqgz3oq75uauy8YC343J4nE+0OFv9OwLd/+1PtHBfUpwAlcN 8JTbh641owxLxu0GndcxFoBoEFNou7qKQROB/pdI8+IBB+iAqW3WyEfmwuPzXM7iBqgJ vkk7q8A/7U4bA4dsdl9Qpuxd7Z20Y5HYrj9lgT/7n2jkvOZFx5qmVYRd4ogSR4JjpOtN a3jjYjdpoyFV59h+sHck6ex44uWx3db5dyrUgrw4NnQhZnTW3Eljg1knOa7i8TeamxFe FiVTaVd1Id2hNGyR4ALkLUzQkda3/sUaqseobRc0bu7EIaaKKUxfo1kx9htDEGDIQmAt MV/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DjeCDkyV; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p12si1569596plk.77.2019.02.14.16.08.42; Thu, 14 Feb 2019 16:08:58 -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=@linaro.org header.s=google header.b=DjeCDkyV; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2439339AbfBNOu3 (ORCPT + 99 others); Thu, 14 Feb 2019 09:50:29 -0500 Received: from mail-qt1-f196.google.com ([209.85.160.196]:42840 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2439338AbfBNOtt (ORCPT ); Thu, 14 Feb 2019 09:49:49 -0500 Received: by mail-qt1-f196.google.com with SMTP id b8so7058592qtr.9 for ; Thu, 14 Feb 2019 06:49:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=VL5Y6vm9NuZCG1g7W3hxrDkMxlPp0J/npa1K1+DSsiA=; b=DjeCDkyV03p1MH23SfbryccfoXky+ZfeRQgVk59WH61M3aiQFNuoTqEtnSd18iHNvz jNbVyzFcF/kLYL5g1hgCcz/ZFhr1ONI3akJbnPFHJ9JWg7SSqiqjy4xSEGYcMrK33XAH RFtFyVjp6H2T3psO58C5eLTbzsvOi8U3juSoTmm0jdYHZFF8avbc5gTgSPx23/r1Th5O vwS0Htt/7JZgffxa+wg/Ii9eWKpuQmE5HLBqLaeCEDkqvsHBuCZ7iZsdCWXwbAtmTLm1 3dazqrRVXEDpDMY67zjdO1PTI5vm5fylBbd6lP1TtohRWOmJSP/yQkluTwsNz5pbi7TL 0XIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=VL5Y6vm9NuZCG1g7W3hxrDkMxlPp0J/npa1K1+DSsiA=; b=gI0FPuwKszvQVjtW/KYtsg6butEGU47bXPJnHgafMmm/lGmH2yKAwOpwWM1tKcVU7c Zp5kq03T9rQa96cX4udK5hg/1dTLkJQpk0kUE9Bo3UWmw3mUdY/c9y6ncghIHWbmMXgd Rubz7TsXGFG1TUAhoE6H4M24AU132BPEQbvCicgu/ayH2tA6dKC7t4Fk+Yx/GsyCzh6f Sy+fVxTSd+StRo5WJh6T4AC2gff27deJqIwS7a4D13P/XVeqy4aKPVqk1ZA+89d9bzgD jNuy619cOFE7bE+SwocBE6CUUyUjlowoxISVPyW2Rj1o4XlKIddhde/4WfjkUxBm1Z7y YfXg== X-Gm-Message-State: AHQUAuYmg4F/XVf/SXWLko0mNiL0XMMBxEkbpWVhIvQNK/Vm8FlBYEBM 2f/2QKar7m9bO0R30bkumA8mAQ== X-Received: by 2002:a0c:d80f:: with SMTP id h15mr3241724qvj.228.1550155787910; Thu, 14 Feb 2019 06:49:47 -0800 (PST) Received: from localhost.localdomain (pool-72-71-243-63.cncdnh.fast00.myfairpoint.net. [72.71.243.63]) by smtp.googlemail.com with ESMTPSA id k66sm1498919qkc.25.2019.02.14.06.49.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Feb 2019 06:49:47 -0800 (PST) From: David Long To: stable@vger.kernel.org, Russell King - ARM Linux , Florian Fainelli , Julien Thierry , Tony Lindgren , Marc Zyngier , Greg KH , Mark Rutland Cc: Will Deacon , Mark Brown , linux-kernel@vger.kernel.org Subject: [PATCH 4.9 11/16] ARM: split out processor lookup Date: Thu, 14 Feb 2019 09:49:25 -0500 Message-Id: <20190214144930.27539-12-dave.long@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190214144930.27539-1-dave.long@linaro.org> References: <20190214144930.27539-1-dave.long@linaro.org> 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 --- 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 c55db1e22f0c..b9356dbfded0 100644 --- a/arch/arm/include/asm/cputype.h +++ b/arch/arm/include/asm/cputype.h @@ -106,6 +106,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