Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2474369imj; Mon, 18 Feb 2019 06:39:09 -0800 (PST) X-Google-Smtp-Source: AHgI3IYcw/B4E345kA/KFZIFr6dwsLvLHhXAYYL7IklxkGCNpUF0AdmS9aXCP+bvjdSrxmOgWVmk X-Received: by 2002:a63:1960:: with SMTP id 32mr19046781pgz.171.1550500749533; Mon, 18 Feb 2019 06:39:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550500749; cv=none; d=google.com; s=arc-20160816; b=ZQRPL6UY/h77CSNO87iainn1yhJV3WjNbqCoxPD3QAFRW6f2MV7PXKV3o3PHmnx8fN O1xCxbgUB7qqoczzEx1mUJJ+DKvHIVK2O421oNWJKTKdm06yU3EXy9XcQK1RoiD+6J9+ AYpZKLiO4j+M6gSiKLzeusd0uNWq1lor49Ebmg/Phw7icIbGHOmUKOdAWdMLfiPDyuN+ jAUG+k10MDLQN+Tg8gRYCpP7Lo73ef5C8WVq8q45C84/lUIU40Jea+pIP3A8eDFcRwBB zlsBphlZ5LqeIh/aJFSOCeelM8mKCCZzHJEPOW9MdCZPgjW2lpCsad7vTXTfOSm4xNLU +H6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=raYpD0+yT9aJfeVn2FgGpopplwPIweVOtkDL/PpPPyw=; b=x/offtS4UXJ+cle5yeLKrU1z5YTJI1Yc0Fdg9gnv9J36wB5925X7bbI25+4lg3Ai6n E7ibYEKeotrLCxWdhTmKfVZlJm3ziWhGib7ttyZAiPVGmNhRAerJhOadLD9AZuckZSDn 2TDaNw44XN/e771XSDnWBxHwZaiKfdY9J/D1/p2AGZc+210EFxaJASb+Q/m8dvoZHyw7 8068ZD0RRwbxP5yZyHeSNLoLalNJlgQ7TEtaQN1ZuNK2opXgpwu+15kVMvcIyFAPXe4o toqgbleXasVsXou0suaX/C/So6wA95AdUWcBUZ6Q04eSSaHS6xuupR4CPDc8Vw+o/jts 25lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Lvs0+OC2; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y185si3216498pgd.117.2019.02.18.06.38.53; Mon, 18 Feb 2019 06:39:09 -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=@kernel.org header.s=default header.b=Lvs0+OC2; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389127AbfBROiI (ORCPT + 99 others); Mon, 18 Feb 2019 09:38:08 -0500 Received: from mail.kernel.org ([198.145.29.99]:34560 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732799AbfBRNyi (ORCPT ); Mon, 18 Feb 2019 08:54:38 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7E9BC21900; Mon, 18 Feb 2019 13:54:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1550498077; bh=Gwokh3fJVOQrKBBwDwHBFmkofxkNWeYXKGi52H1B1J4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Lvs0+OC2XNuFYpfaX6PN4rlkBGRhOIB+r/KNoN1HNqOUYpUxoo0cD45yZb9HpNUOx /+XgJhFS9Z3ZDPfqUYjyaVJlFT5bXpadidBtZFQsOECpHlVerZVg+aA02TD34H6ZSC TvDdW3X7PQB+niCaFKsYdXWC9OXAFAPCItTfeNGg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Julien Thierry , Russell King , "David A. Long" , Sasha Levin Subject: [PATCH 4.14 16/62] ARM: split out processor lookup Date: Mon, 18 Feb 2019 14:43:22 +0100 Message-Id: <20190218133507.229374606@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218133505.801423074@linuxfoundation.org> References: <20190218133505.801423074@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ 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 Reviewed-by: Julien Thierry Tested-by: Julien Thierry Signed-off-by: Sasha Levin --- 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.19.1