Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: rmk+kernel@armlinux.org.uk (Russell King)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/2] ARM: always store CPU ID early into percpu data
Date: Mon, 14 Nov 2016 12:57:41 +0000	[thread overview]
Message-ID: <E1c6GpR-0008DI-5B@rmk-PC.armlinux.org.uk> (raw)

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 <rmk+kernel@armlinux.org.uk>
---
 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);
 
-- 
2.7.4

                 reply	other threads:[~2016-11-14 12:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1c6GpR-0008DI-5B@rmk-PC.armlinux.org.uk \
    --to=rmk+kernel@armlinux.org.uk \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox