Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp1087708imj; Thu, 14 Feb 2019 00:45:45 -0800 (PST) X-Google-Smtp-Source: AHgI3IasSTn5H2NQCZOLLXsJNXPyEmPMJXZwI/dWmGqXgaSZI3H90TSs2eUXVEP4rpxBdZV+gU+S X-Received: by 2002:a62:5287:: with SMTP id g129mr2935964pfb.22.1550133945698; Thu, 14 Feb 2019 00:45:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550133945; cv=none; d=google.com; s=arc-20160816; b=qdmAnJf93ey/Jo56TbF7kbPjELN28eKA0aB8PqLWFRXbSIuBwitQ0mQPyq9c17FtaX LlyPIgJSv1hUF9Rj/XpWDYFwdw+a8PmX15nis+iUzCc1/jN8HgsN9CAJ3vk9lwen2o0A fQVodEsHhzroWtLYIRsOfKmRNk/Xwy54N3RCUGv1CXXKFZo3Mjs6U9zqMhixybSeZjEc B2J+GR3WLDj3EF7W5sigBPMlhAvAQxXrHxJODHQDLH4248Q/I/KqS0cFTQF/B3W+KEXu SbFbYBOIuWFxqZfoy0u5yoQ0kGm/ErYT+++WWIws47xmVNZ2HPQbjrXp8blAaNnAhYoV lTwA== 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=yEcpOWz45DlZuRpoVIt2gmwCWgLldnvEJdiWLJe6SsM=; b=xFjzPq3jf0l0itEcIGTaJsXXceVJJEndU+9OvM5SEcQmgTFNhJypySwxMne5q0Ot7L dGRalvcrKrMPmnW0eE8Jkyyr/3zS4kT3rtHTFqOYJp/QdhqF32PZ647qg8WKsfoJxxrr Mg0/LsfF5Mve35CnGq0asq3ILHiN9HBTfg7ZOJ0Zpuc/wbU5NjauHkW09AzF7xM/HEmJ CG7dFSEX3kiuqpbsH9Dp3VCyEtAVLN89KZVU6zfeKqN1dDLOgTfwh1Yt20M2ORy4Y+B7 JdDaD81XZnHy4SIaRdwMTTPGD4jyv4BcG0a3FsCb3JEnTquqMEtYfm3vk4vXEakYQSgT xIZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xY92Dfor; 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 k1si1761810pgq.144.2019.02.14.00.45.29; Thu, 14 Feb 2019 00:45:45 -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=xY92Dfor; 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 S2436805AbfBMVcq (ORCPT + 99 others); Wed, 13 Feb 2019 16:32:46 -0500 Received: from mail-qt1-f194.google.com ([209.85.160.194]:34989 "EHLO mail-qt1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2436757AbfBMVcn (ORCPT ); Wed, 13 Feb 2019 16:32:43 -0500 Received: by mail-qt1-f194.google.com with SMTP id p48so4496144qtk.2 for ; Wed, 13 Feb 2019 13:32:42 -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=yEcpOWz45DlZuRpoVIt2gmwCWgLldnvEJdiWLJe6SsM=; b=xY92DforhFbv2cZWVFuA+wAEWISzJgcbN6lHdt7O1OIqMul7FpvwUY4dO3MIKKf/BW ZwKyf5Bd+OiyU2l9g5HX8FtPcTV8U9gx5CUlAVD4tdNesRc7WswCrkahrnXbPkYEmBJC wkcU2K8p5lNL/CjZQS7If8YheKGndJ8eMWrSJ2Vdx5Dlgw7LRcUWjR2AuU0YB5zp+dhZ vVj6l2hxFqC6pfU+8/Odg+708ZzJK1s+AYVFIqaJOItwRe99hBN9rTyoqxljJjvOZshk isJv095UXK19rzhdejQCouHBYXeTpeKpeZkUngSMmvlSEyVLShes3zM61p3n6vOQP3Rq PKTw== 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=yEcpOWz45DlZuRpoVIt2gmwCWgLldnvEJdiWLJe6SsM=; b=cCEy16bnVXZwJ9Klt5obz25VYSwglewdNC/+86FXSf9irv43hcBMNCX5ryVAwExuin G/dnEsAq0/w1YwWUrJGOb5FvF56LHYrKXWGL6vvmLatoXKsOvB7MbldPSTfMfls0Iu/J nj+KLgzDqaugfJaDSzN1Q9YCJ4/pWCaZY91xMaXn+vVJTRjEhJ3ZK1vZVcbPSVyrqrIH pQOrEtNdCdLTdHLASeAFbDjjaL+SYsxq007T+iyDiT9bZY9/n+rapuP7wdtaxWqAxJnw Lmq5dQKAKoBnPcdcFv3lI8XHYU3PUAFPJrZ48XIAorecSiB7NnpnDTIcRQeMkRwrLPPe f6YA== X-Gm-Message-State: AHQUAuYSzANUHp4NzSbqRTuf0vCHuNp2krbfenzHxLB7XJ0dduOdvlce 7wjQ/DoHTvVowvkewdCOl/nXYA== X-Received: by 2002:a0c:b90d:: with SMTP id u13mr247321qvf.66.1550093562264; Wed, 13 Feb 2019 13:32:42 -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 8sm382675qtr.7.2019.02.13.13.32.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Feb 2019 13:32:41 -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.19 12/17] ARM: split out processor lookup Date: Wed, 13 Feb 2019 16:32:18 -0500 Message-Id: <20190213213223.916-13-dave.long@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190213213223.916-1-dave.long@linaro.org> References: <20190213213223.916-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 0d289240b6ca..775cac3c02bb 100644 --- a/arch/arm/include/asm/cputype.h +++ b/arch/arm/include/asm/cputype.h @@ -111,6 +111,7 @@ #include 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 4c249cb261f3..8fd7baa158a4 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