From patchwork Mon Nov 14 12:57:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 9427473 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6EE2660471 for ; Mon, 14 Nov 2016 13:01:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6A80728921 for ; Mon, 14 Nov 2016 13:01:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5F88F2892D; Mon, 14 Nov 2016 13:01:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1759928921 for ; Mon, 14 Nov 2016 13:01:59 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1c6Gs4-0008Bd-8o; Mon, 14 Nov 2016 13:00:24 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:3201:214:fdff:fe10:1be6]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1c6Gry-0006Y8-BV for linux-arm-kernel@lists.infradead.org; Mon, 14 Nov 2016 13:00:19 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2014; h=Date:Sender:Message-Id:Content-Type:Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From; bh=yn7zz44LZNtLUhkUn9kR6mz73WZl8HcTY3cNFAbPA2w=; b=DnSCIudTrok17bpFnt56oxUj4F5KnmwCX7vfJ4LOtd2HXQzrI3NXV3B0nk3plX8mA2LmaBMmFcInG8GDUHIPoC3Rgz0JN0m7XKb0fqxCjtpjhwJn4XVlDlg/pU6fSlpS9X2bMzoyhHL0VcuSXZzgZo8ox5OwHPA5ful9BjnGo4M=; Received: from e0022681537dd.dyn.armlinux.org.uk ([2001:4d48:ad52:3201:222:68ff:fe15:37dd]:44556 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1c6GpS-0005NU-6B; Mon, 14 Nov 2016 12:57:42 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1c6GpR-0008DI-5B; Mon, 14 Nov 2016 12:57:41 +0000 From: Russell King To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 1/2] ARM: always store CPU ID early into percpu data MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Mon, 14 Nov 2016 12:57:41 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161114_050019_321596_589A3F27 X-CRM114-Status: GOOD ( 11.66 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gregory Clement , Andrew Lunn , Jason Cooper , Sebastian Hesselbarth Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Always store the CPU ID into the percpu data so that it is available early on. This allows us to eliminate various is_smp() tests that select between reading the hardware CPU ID directly and reading from the percpu data. Signed-off-by: Russell King --- arch/arm/include/asm/smp_plat.h | 5 +---- arch/arm/kernel/setup.c | 5 ++++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/arm/include/asm/smp_plat.h b/arch/arm/include/asm/smp_plat.h index f9080717fc88..43f246b73ce7 100644 --- a/arch/arm/include/asm/smp_plat.h +++ b/arch/arm/include/asm/smp_plat.h @@ -34,10 +34,7 @@ static inline bool is_smp(void) */ static inline unsigned int smp_cpuid_part(int cpu) { - struct cpuinfo_arm *cpu_info = &per_cpu(cpu_data, cpu); - - return is_smp() ? cpu_info->cpuid & ARM_CPU_PART_MASK : - read_cpuid_part(); + return per_cpu(cpu_data, cpu).cpuid; } /* all SMP configurations have the extended CPUID registers */ diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index 34e3f3c45634..80f45b01fbaa 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c @@ -724,6 +724,9 @@ static void __init setup_processor(void) cacheid_init(); cpu_init(); + + /* Always setup the boot CPU ID in the per-cpu data */ + per_cpu(cpu_data, smp_processor_id()).cpuid = read_cpuid_id(); } void __init dump_machine_table(void) @@ -1217,7 +1220,7 @@ static int c_show(struct seq_file *m, void *v) * "processor". Give glibc what it expects. */ seq_printf(m, "processor\t: %d\n", i); - cpuid = is_smp() ? per_cpu(cpu_data, i).cpuid : read_cpuid_id(); + cpuid = per_cpu(cpu_data, i).cpuid; seq_printf(m, "model name\t: %s rev %d (%s)\n", cpu_name, cpuid & 15, elf_platform);