From patchwork Thu Feb 14 14:49:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Long X-Patchwork-Id: 158405 Delivered-To: patches@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1462329jaa; Thu, 14 Feb 2019 06:49:48 -0800 (PST) X-Received: by 2002:a37:370c:: with SMTP id e12mr3076173qka.64.1550155788167; Thu, 14 Feb 2019 06:49:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550155788; cv=none; d=google.com; s=arc-20160816; b=fCsQwJVysw7CO4j17FMUcW0nwhDNZTHNjS3d/f06ZEvk7m24iMCBNUkTCnmro4GIiz +F4Qt0FzSszHVSlEO+3waDb+fDYKB2W0tRbl5KRHL+whp7oWKBGEgkF9tW/ruASvkVdp xQdnCexRsJQU4l3SJTM/7sA+3IomeRfhuvsdaNIildH0Of27MIpC+U8y3VddnBb/gfOp bbmvzien7KTYZBcuP5pLITjVkDcGLor9Riupxr06cZWwZl3B0nHv10b9LRiTnk9DFzVn tYusITylR1Z8MzVEbJLrwJ6GomHVrLrbBfRpOt/cmhg46kq+YNAOfIpIc7hmpahkOblv jnog== 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=VL5Y6vm9NuZCG1g7W3hxrDkMxlPp0J/npa1K1+DSsiA=; b=y4ToSECB7EqMN65eL1Y10bSO2t9k06+oW2TSewiWCRntllCE4L2ejk0lnW429fpIsS ReZT0vaWYCzaG0vRPpy6k4uo7TK1p+krZEq9yiUQTWGYa06Uf84N9LTN+myaOq55kriS OGb9eNuArRlRkUgz+sMJDwgsUvpVy89emnGSze3dBLgaudMRxfXUx1kCdu0BdTByKnIC tZ6BGVrL6n7FdoiwElGIuGyG3jz8eDdMLwdabL5vsrNdmtArQS+5F79LjTUkYeI9WqcK RtLvuGxsWR2Vm2525+UiZrdfx1i6bgvsndeqtxseVwvo31aqMwxbaFafic4kc4PG8eKv X5tQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DjeCDkyV; 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 i31sor2883292qvd.73.2019.02.14.06.49.48 for (Google Transport Security); Thu, 14 Feb 2019 06:49:48 -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=DjeCDkyV; 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=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=Osc7uWS8KP7D3cnkyTgXXanQ40AqFcckOTsbxiv7WK/Y51cTHCXC99VZOSjV2N2jCl sV0AoEGwzUnFWJ/+CZKME2WNCSZU3ErtXrIJXMAd2c1PhOi7aaIqhz1Xm7gcXUIsTbc8 xMIc0Y7tg/9+kiu73kqvDa4wvaOHRhbhV6fUA6bLiO89R0Wbujth/LlhyzjR+42lVuxv xEWxMOuWw+P0ncAJ5lrOkoDDzrMRNWLg1ZXSGzlG4OVc4/9M19v8tf24uq9nyEFADtSE MMSxDcqO3jfvqEF/yHyTOSnW3q29FtfDO8nE04dbDaXgCLZz/l6AGhpc7Eoq3lumAk5/ acnQ== X-Gm-Message-State: AHQUAub23yyfeaXUOY8ug2cIVXxiQ8D2ksLMXbvS1avf+j4r0uiB5ZKd oRF76Gzy3Ror7buHmlPglpry7JX/ X-Google-Smtp-Source: AHgI3IbB0ZSFfIrhdjj4XKHl5dxzwGQFiY0GI+HzN6q1flYBcTqnMA61qDFeacUeSNmw+iMsy6qDwg== X-Received: by 2002:a0c:d80f:: with SMTP id h15mr3241724qvj.228.1550155787910; Thu, 14 Feb 2019 06:49:47 -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 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> 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 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",