Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ARM: versatile: rename and comment SMP implementation

Rename pen_release and boot_lock in the Versatile specific SMP
implementation, describe why these exist and state clearly that they
should not be used in production implementations.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>

+38 -16
+1 -1
arch/arm/plat-versatile/headsmp.S
··· 37 37 38 38 .align 39 39 1: .long . 40 - .long pen_release 40 + .long versatile_cpu_release 41 41 ENDPROC(versatile_secondary_startup)
+3 -1
arch/arm/plat-versatile/hotplug.c
··· 18 18 #include <asm/smp_plat.h> 19 19 #include <asm/cp15.h> 20 20 21 + #include <plat/platsmp.h> 22 + 21 23 static inline void versatile_immitation_enter_lowpower(unsigned int actrl_mask) 22 24 { 23 25 unsigned int v; ··· 69 67 for (;;) { 70 68 wfi(); 71 69 72 - if (pen_release == cpu_logical_map(cpu)) { 70 + if (versatile_cpu_release == cpu_logical_map(cpu)) { 73 71 /* 74 72 * OK, proper wakeup, we're done 75 73 */
+1
arch/arm/plat-versatile/include/plat/platsmp.h
··· 8 8 * it under the terms of the GNU General Public License version 2 as 9 9 * published by the Free Software Foundation. 10 10 */ 11 + extern volatile int versatile_cpu_release; 11 12 12 13 extern void versatile_secondary_startup(void); 13 14 extern void versatile_secondary_init(unsigned int cpu);
+33 -14
arch/arm/plat-versatile/platsmp.c
··· 7 7 * This program is free software; you can redistribute it and/or modify 8 8 * it under the terms of the GNU General Public License version 2 as 9 9 * published by the Free Software Foundation. 10 + * 11 + * This code is specific to the hardware found on ARM Realview and 12 + * Versatile Express platforms where the CPUs are unable to be individually 13 + * woken, and where there is no way to hot-unplug CPUs. Real platforms 14 + * should not copy this code. 10 15 */ 11 16 #include <linux/init.h> 12 17 #include <linux/errno.h> ··· 26 21 #include <plat/platsmp.h> 27 22 28 23 /* 29 - * Write pen_release in a way that is guaranteed to be visible to all 30 - * observers, irrespective of whether they're taking part in coherency 24 + * versatile_cpu_release controls the release of CPUs from the holding 25 + * pen in headsmp.S, which exists because we are not always able to 26 + * control the release of individual CPUs from the board firmware. 27 + * Production platforms do not need this. 28 + */ 29 + volatile int versatile_cpu_release = -1; 30 + 31 + /* 32 + * Write versatile_cpu_release in a way that is guaranteed to be visible to 33 + * all observers, irrespective of whether they're taking part in coherency 31 34 * or not. This is necessary for the hotplug code to work reliably. 32 35 */ 33 - static void write_pen_release(int val) 36 + static void versatile_write_cpu_release(int val) 34 37 { 35 - pen_release = val; 38 + versatile_cpu_release = val; 36 39 smp_wmb(); 37 - sync_cache_w(&pen_release); 40 + sync_cache_w(&versatile_cpu_release); 38 41 } 39 42 40 - static DEFINE_RAW_SPINLOCK(boot_lock); 43 + /* 44 + * versatile_lock exists to avoid running the loops_per_jiffy delay loop 45 + * calibrations on the secondary CPU while the requesting CPU is using 46 + * the limited-bandwidth bus - which affects the calibration value. 47 + * Production platforms do not need this. 48 + */ 49 + static DEFINE_RAW_SPINLOCK(versatile_lock); 41 50 42 51 void versatile_secondary_init(unsigned int cpu) 43 52 { ··· 59 40 * let the primary processor know we're out of the 60 41 * pen, then head off into the C entry point 61 42 */ 62 - write_pen_release(-1); 43 + versatile_write_cpu_release(-1); 63 44 64 45 /* 65 46 * Synchronise with the boot thread. 66 47 */ 67 - raw_spin_lock(&boot_lock); 68 - raw_spin_unlock(&boot_lock); 48 + raw_spin_lock(&versatile_lock); 49 + raw_spin_unlock(&versatile_lock); 69 50 } 70 51 71 52 int versatile_boot_secondary(unsigned int cpu, struct task_struct *idle) ··· 76 57 * Set synchronisation state between this boot processor 77 58 * and the secondary one 78 59 */ 79 - raw_spin_lock(&boot_lock); 60 + raw_spin_lock(&versatile_lock); 80 61 81 62 /* 82 63 * This is really belt and braces; we hold unintended secondary ··· 84 65 * since we haven't sent them a soft interrupt, they shouldn't 85 66 * be there. 86 67 */ 87 - write_pen_release(cpu_logical_map(cpu)); 68 + versatile_write_cpu_release(cpu_logical_map(cpu)); 88 69 89 70 /* 90 71 * Send the secondary CPU a soft interrupt, thereby causing ··· 96 77 timeout = jiffies + (1 * HZ); 97 78 while (time_before(jiffies, timeout)) { 98 79 smp_rmb(); 99 - if (pen_release == -1) 80 + if (versatile_cpu_release == -1) 100 81 break; 101 82 102 83 udelay(10); ··· 106 87 * now the secondary core is starting up let it run its 107 88 * calibrations, then wait for it to finish 108 89 */ 109 - raw_spin_unlock(&boot_lock); 90 + raw_spin_unlock(&versatile_lock); 110 91 111 - return pen_release != -1 ? -ENOSYS : 0; 92 + return versatile_cpu_release != -1 ? -ENOSYS : 0; 112 93 }