Skip to contentSkip to conversation

ARM: always store CPU ID early into percpu data

PATCH In review Russell King 1 participant 1 message Nov 14, 2016 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 ARM: always store CPU ID early into percpu data

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.

---
 arch/arm/include/asm/smp_plat.h | 5 +----
 arch/arm/kernel/setup.c         | 5 ++++-
 2 files changed, 5 insertions(+), 5 deletions(-)
arch/arm/include/asm/smp_plat.h +1 -4
index f9080717fc88..43f246b73ce7 100644
@@ -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 */
arch/arm/kernel/setup.c +4 -1
index 34e3f3c45634..80f45b01fbaa 100644
@@ -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);
 
Signature · 1 line
2.7.4