From patchwork Thu Jan 10 17:51:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Long X-Patchwork-Id: 155257 Delivered-To: patches@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp2176309jaa; Thu, 10 Jan 2019 09:52:11 -0800 (PST) X-Received: by 2002:a0c:878d:: with SMTP id 13mr10730936qvj.8.1547142731134; Thu, 10 Jan 2019 09:52:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547142731; cv=none; d=google.com; s=arc-20160816; b=g15Q9XKco32Y9nBVbWxqkq1Gm7A9Cxv6pe0HfscdIy3iCadoMdfFWHnjFsJ7Xfgt3e E4aNN/IzWBwyuqFKQ2EiRKEVU5983cBU4PLln9fT+UxdvJpe0TSvS964rx49iP31LMBj snzOzSURQRBJNcpjPNfWa+e74NnOxFgEMj5YLVbyNmKvK14NAUbVZugtv0dVi32hx93d /exaDgCuMLemViJZ3xgIbnFQPRvcddMBWpDZaziH8mib1hUwdX979jwHxRc1j8zEegrq SOlU7Ez9seYLWgrilnY3M64QZminpYG/yyWwTpVBYr7D6tonMua5Cv2nmnqd0Kyga3xX MaxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=yvoFdkch7Gd4/MbRPm6+HJonlCHu2OWfPFxCbumCzMk=; b=aqyWD7ScimSqPqYH3nzKxN00oesdODHOv51N7sh6j1TkKfpStVQhxFuf0gO++YzHNW lRNeGWQEL7ZzJ/WhF16JrPfbW7Qx4cvJOiA2d+FCrHHUFi9f2d/56yTDFgS9CN9LBcKh 8MFfSkMDaWuE83WzZ4vcLHus5aT257unOJXbrh8nFloo136rW8/aQQ76M5icGgQRBFAG DRWwYOrOeLk1e4H9/JkSnY9JnGQbONVybdDxPzVnUzJC7AfVwrLtQ5xX9PvU0O3ErU9o OWDlA9SEgzI8wiffh4NSr7o2hl/orD6sU5INUGmymbdATO7ysryw74GlCMwWBXtN1b5U uUfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BRuExwPb; spf=pass (google.com: domain of dave.long@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=dave.long@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id 4sor72574690qtn.67.2019.01.10.09.52.11 for (Google Transport Security); Thu, 10 Jan 2019 09:52:11 -0800 (PST) Received-SPF: pass (google.com: domain of dave.long@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BRuExwPb; spf=pass (google.com: domain of dave.long@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=dave.long@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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=yvoFdkch7Gd4/MbRPm6+HJonlCHu2OWfPFxCbumCzMk=; b=BRuExwPb0a34jVDT0hKrNMf6pr+Qy62GGt2DcOyB/mU5RXUzZSjXItw/F09c/a+ooL X/BYlcmWGltbv62a+YfC0OJLHrH8sFNuMn9vTjorhAPvOcnl1b97qgKrTEHcNbf3Jya9 TxcpyXQwU0mCqQktlvIL1x70SxwgRq9ersgKs= 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=yvoFdkch7Gd4/MbRPm6+HJonlCHu2OWfPFxCbumCzMk=; b=HtHFdssbrpPQ2uDfnZ/LkYnG7Zg5kNwVfDVNHPBZdxh81YovYe/9JnSWpfgvIoZVQl EDIEvJVmIl47sSoH0BI/qnlysHC8fLjKfGq6wC/RMSuaEr9N4BIQ9FdzD2VBMEQTlooY PHfc+vvOdEAPmqsTZ2TUrtD2AcuEct1uLI8Eu8svI/hYYzWpb4vLbRsudwB69O3uAwEN Z+YdPb6WvTP8n0CAVXAtq9t1HuBHa7s7W2eif9dlIVLzmiCXhu+AQnsh7D8RVrKfk1eM MqMWpy2hRFW7gFH7g15rBev31THDQvDPgBXM75YlVBZU6nmXOP3DxShtELenpjd9UxZN DWMA== X-Gm-Message-State: AJcUukfNbzZoumPzG4PPq00pICtibIDRr27+tyZUX6DU6m3adXXFREV8 9nOl/3f7VOzezxfSU4U4NcVsN19y X-Google-Smtp-Source: ALg8bN5WcYzSGWfy4mD2GrkPZtCkd+mT9zG7Bc3B1rp0KugbuBTV7VjOQyOtWWB+WlMOKnxpn97Ecg== X-Received: by 2002:ac8:72c1:: with SMTP id o1mr10578018qtp.220.1547142730878; Thu, 10 Jan 2019 09:52:10 -0800 (PST) Return-Path: Received: from localhost.localdomain (pool-72-71-243-63.cncdnh.fast00.myfairpoint.net. [72.71.243.63]) by smtp.googlemail.com with ESMTPSA id b8sm41815904qka.79.2019.01.10.09.52.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 10 Jan 2019 09:52:09 -0800 (PST) From: David Long To: stable@vger.kernel.org, Russell King - ARM Linux , Florian Fainelli , Julien Thierry , Tony Lindgren , Marc Zyngier , Mark Rutland Cc: Greg KH , Mark Brown Subject: [PATCH 4.14 12/17] ARM: split out processor lookup Date: Thu, 10 Jan 2019 12:51:45 -0500 Message-Id: <20190110175150.5239-13-dave.long@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190110175150.5239-1-dave.long@linaro.org> References: <20190110175150.5239-1-dave.long@linaro.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(-) -- 2.17.1 diff --git a/arch/arm/include/asm/cputype.h b/arch/arm/include/asm/cputype.h index 3379c2c684c2..25d523185c6a 100644 --- a/arch/arm/include/asm/cputype.h +++ b/arch/arm/include/asm/cputype.h @@ -107,6 +107,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 8e9a3e40d949..1a041ad4881e 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",