Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp1180188imj; Thu, 14 Feb 2019 02:31:40 -0800 (PST) X-Google-Smtp-Source: AHgI3IZE1Vsg/TVo3v1AZrzOE6zqC7YRm50cvbHT9zaQeGcBO5ggAn9B+JaDGswPHCwNvzIkQoWm X-Received: by 2002:a63:2141:: with SMTP id s1mr2954514pgm.363.1550140300460; Thu, 14 Feb 2019 02:31:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550140300; cv=none; d=google.com; s=arc-20160816; b=Dxbj/GhTWlygzpdkJW0Xx5ZnPXoQ/jFK+BsR5wfs6YCEAhWL0cmEXGASvwwvVKNGlG AUzINUkjOH5eV5cJya5YRiQwXw4u/yOLjipxfC8fHkqbtV7AtZxq8nFXvav7uVet9ooA xDaoOQEFnyWp3NrlfhJ69wmziLEDeLBGIJz27EOGVBFnjWwTL9nwoo6JcpVN/FpC5i1p 9xvItKObnQc29x9woEP728iK7lG4M0QXIbMp0eVTD7+B1b9aEFEJRilvZsY5TPuXJtBk N6WYB+iOF7u63auTDcxO7+uIVa8WshbWcpIM7TcuTUcDBIdgO0qyUNKzjrMXQanRt1N3 IXkQ== 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=yvoFdkch7Gd4/MbRPm6+HJonlCHu2OWfPFxCbumCzMk=; b=hshtv11S+bR451fanNdOapv00sk7mvKHdBR2uHq5sbzYKeCXMYUh0+GaS8CbIQwWsl ngQP544qvP+Fl4ER8di18t5J6mpFhfoN2A5X678fl/mqLpViNL7MX61X3Ia8F9o1JZHi DjtA1MM5q73A+EWFkmmFzQhe8qv4ceifqsH0bDJT57CLTIYNC5tcJk+Jvw2dXKGluS9v 0EEWLNHO+M6TqCTdHGWnzmCHRQM4nQn1dow/yHNyG1JxSucsT94szBVDSGdQJ57BeT7M vhdAcDyNzALx7DWOyYH6jieqaSWxb4D0KKtpa0PcQwEFEkyrGHQz6Uu9xdyHOXdz8yuP 8dyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ysqTniWx; 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 t75si2030297pfi.193.2019.02.14.02.31.23; Thu, 14 Feb 2019 02:31:40 -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=ysqTniWx; 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 S2404440AbfBNCKn (ORCPT + 99 others); Wed, 13 Feb 2019 21:10:43 -0500 Received: from mail-qk1-f196.google.com ([209.85.222.196]:43698 "EHLO mail-qk1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404202AbfBNCKm (ORCPT ); Wed, 13 Feb 2019 21:10:42 -0500 Received: by mail-qk1-f196.google.com with SMTP id f196so2695144qke.10 for ; Wed, 13 Feb 2019 18:10:41 -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=yvoFdkch7Gd4/MbRPm6+HJonlCHu2OWfPFxCbumCzMk=; b=ysqTniWxOkEN223i3ZqWK3+2Xx1kjnpb4gHRW2xyYDchldG5zL+5a7Q45TMllbqhik UMkxm3LHpdFxxbq6PxHFEf0+SBDVl2Xu8qSZDx3G3Mz3fWBKF+WyDb1kkr3+VxCWv4Pd k1j0NvkzzmIvTB63xRZU9nTgReJRTN40s0dNxlf1e2t20U6XEqi+Y47J6xrizZKowm53 z13xmgLXYXfKsA8zfiN8Wyu3LUa3daVdekpZ6dgt6RGt/4Ioxo99mQ+vAfIrLwmvtNbN j3cOHDiedKf01Bf28npHWE8pKictERK9jStB1KOLoTqgPk/y1sL3E7fNMqtdHlb05Ugj bO2g== 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=R3CUYbc4axNGssxK86iTvxf7vF5OlvA8kSArmTAlJC15lf6UAUYgz04fGdWQtof/lW WmfNMnuPw114yPEmJiAu9LuaTmwJ+D9N6SEzEytUHlYvhuohbjTVBVxQ/5hLw1o+t/mu co7IvMEGODhMHKLW6ZtAoCH7363iT+dOBHENfE8HdCME6cbfMD8H2L/e1AaQIK0lHJbi dTNcs0rlzdMkoISvrLslM1l8XHBR1Ou8OmCDwCUeugrdBLqo2yq4YqXKmhhSkm1LAldM +3ohnwFdJrD2+3W56sfXXKT9Jwm4TSG6FZq/KkuDvNZOKStmcNIrnAlWWEmcwspls2aj 0aug== X-Gm-Message-State: AHQUAuZqfuuNZT0lLBiiIn1Nu4ALI6l8PLvb68olrxpFtJl9m/Qw8Q21 3J1CU45CB/cePpx9KVAI6a1A8g== X-Received: by 2002:a37:8e81:: with SMTP id q123mr998935qkd.34.1550110241233; Wed, 13 Feb 2019 18:10:41 -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 d63sm1091575qka.22.2019.02.13.18.10.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Feb 2019 18:10:40 -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.14 V2 12/17] ARM: split out processor lookup Date: Wed, 13 Feb 2019 21:10:17 -0500 Message-Id: <20190214021022.5313-13-dave.long@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190214021022.5313-1-dave.long@linaro.org> References: <20190214021022.5313-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 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", -- 2.17.1