Skip to contentSkip to conversation

ARM: shmobile: Use CPU notifiers for SCU boot vector code

PATCH New Magnus Damm 2 participants 7 messages Sep 14, 2013 – Sep 18, 2013

Subsystems (4)
lore
Share & tools
lore

Magnus Damm

author maintainer
#0 lore raw

cover ARM: shmobile: Use CPU notifiers for SCU boot vector code

ARM: shmobile: Use CPU notifiers for SCU boot vector code

[PATCH 01/05] ARM: shmobile: Add CPU notifier based SCU boot vector code [PATCH 02/05] ARM: shmobile: Let sh73a0 rely on SCU CPU notifier [PATCH 03/05] ARM: shmobile: Let EMEV2 rely on SCU CPU notifier [PATCH 04/05] ARM: shmobile: Let r8a7779 rely on SCU CPU notifier [PATCH 05/05] ARM: shmobile: Remove shmobile_smp_scu_boot_secondary()

This series converts mach-shmobile to use CPU notifiers for boot vector setup for SCU based SoCs such as sh73a0, EMEV2 and r8a7779. This allows us to remove the shmobile_smp_scu_boot_secondary() function, and it is also ground work for the CPUIdle resume path.

---

Written against renesas.git tag renesas-devel-20130906

 arch/arm/mach-shmobile/include/mach/common.h |    2 -
 arch/arm/mach-shmobile/platsmp-scu.c         |   32 +++++++++++++++++++-------
 arch/arm/mach-shmobile/smp-emev2.c           |    6 ----
 arch/arm/mach-shmobile/smp-r8a7779.c         |    4 ---
 arch/arm/mach-shmobile/smp-sh73a0.c          |    5 ----
 5 files changed, 24 insertions(+), 25 deletions(-)
author maintainer
#1 lore raw

PATCH 1/5 ARM: shmobile: Add CPU notifier based SCU boot vector code

From: Magnus Damm <[email protected]>

Add CPU notifiers for the shared mach-shmobile SCU code to allow removal of the shared SCU boot_secondary code.

Regarding notifiers, at CPU_UP_PREPARE time the SMP boot vector is initialized so secondary CPU cores can boot.

---

 arch/arm/mach-shmobile/platsmp-scu.c |   24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
arch/arm/mach-shmobile/platsmp-scu.c +24 -0
@@ -7,6 +7,7 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
+#include <linux/cpu.h>
 #include <linux/delay.h>
 #include <linux/init.h>
 #include <linux/io.h>
@@ -16,6 +17,26 @@
 #include <asm/smp_scu.h>
 #include <mach/common.h>
 
+static int shmobile_smp_scu_notifier_call(struct notifier_block *nfb,
+					  unsigned long action, void *hcpu)
+{
+	unsigned int cpu = (long)hcpu;
+
+	switch (action) {
+	case CPU_UP_PREPARE:
+		/* For this particular CPU register SCU SMP boot vector */
+		shmobile_smp_hook(cpu, virt_to_phys(shmobile_boot_scu),
+				  (unsigned long)shmobile_scu_base);
+		break;
+	};
+
+	return NOTIFY_OK;
+}
+
+static struct notifier_block shmobile_smp_scu_notifier = {
+	.notifier_call = shmobile_smp_scu_notifier_call,
+};
+
 void __init shmobile_smp_scu_prepare_cpus(unsigned int max_cpus)
 {
 	/* install boot code shared by all CPUs */
@@ -25,6 +46,9 @@ void __init shmobile_smp_scu_prepare_cpu
 	/* enable SCU and cache coherency on booting CPU */
 	scu_enable(shmobile_scu_base);
 	scu_power_mode(shmobile_scu_base, SCU_PM_NORMAL);
+
+	/* Use CPU notifier for reset vector control */
+	register_cpu_notifier(&shmobile_smp_scu_notifier);
 }
 
 int shmobile_smp_scu_boot_secondary(unsigned int cpu, struct task_struct *idle)
author maintainer
#2 lore raw

PATCH 2/5 ARM: shmobile: Let sh73a0 rely on SCU CPU notifier

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

Now when CPU notifiers are used for SCU boot vector setup shmobile_smp_scu_boot_secondary() is no longer needed.

---

 arch/arm/mach-shmobile/smp-sh73a0.c |    5 -----
 1 file changed, 5 deletions(-)
arch/arm/mach-shmobile/smp-sh73a0.c +0 -5
@@ -46,11 +46,6 @@ void __init sh73a0_register_twd(void)
 static int sh73a0_boot_secondary(unsigned int cpu, struct task_struct *idle)
 {
 	unsigned int lcpu = cpu_logical_map(cpu);
-	int ret;
-
-	ret = shmobile_smp_scu_boot_secondary(cpu, idle);
-	if (ret)
-		return ret;
 
 	if (((__raw_readl(PSTR) >> (4 * lcpu)) & 3) == 3)
 		__raw_writel(1 << lcpu, WUPCR);	/* wake up */
author maintainer
#3 lore raw

PATCH 3/5 ARM: shmobile: Let EMEV2 rely on SCU CPU notifier

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

Now when CPU notifiers are used for SCU boot vector setup shmobile_smp_scu_boot_secondary() is no longer needed.

---

 arch/arm/mach-shmobile/smp-emev2.c |    6 ------
 1 file changed, 6 deletions(-)
arch/arm/mach-shmobile/smp-emev2.c +0 -6
@@ -34,12 +34,6 @@
 
 static int emev2_boot_secondary(unsigned int cpu, struct task_struct *idle)
 {
-	int ret;
-
-	ret = shmobile_smp_scu_boot_secondary(cpu, idle);
-	if (ret)
-		return ret;
-
 	arch_send_wakeup_ipi_mask(cpumask_of(cpu_logical_map(cpu)));
 	return 0;
 }
author maintainer
#4 lore raw

PATCH 4/5 ARM: shmobile: Let r8a7779 rely on SCU CPU notifier

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

Now when CPU notifiers are used for SCU boot vector setup shmobile_smp_scu_boot_secondary() is no longer needed.

---

 arch/arm/mach-shmobile/smp-r8a7779.c |    4 ----
 1 file changed, 4 deletions(-)
arch/arm/mach-shmobile/smp-r8a7779.c +0 -4
@@ -87,10 +87,6 @@ static int r8a7779_boot_secondary(unsign
 	unsigned int lcpu = cpu_logical_map(cpu);
 	int ret;
 
-	ret = shmobile_smp_scu_boot_secondary(cpu, idle);
-	if (ret)
-		return ret;
-
 	if (lcpu < ARRAY_SIZE(r8a7779_ch_cpu))
 		ch = r8a7779_ch_cpu[lcpu];
 
author maintainer
#5 lore raw

PATCH 5/5 ARM: shmobile: Remove shmobile_smp_scu_boot_secondary()

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

Remove shmobile_smp_scu_boot_secondary() since
it is no longer used. CPU boot vector setup is
instead handled by CPU notifiers.

---

 arch/arm/mach-shmobile/include/mach/common.h |    2 --
 arch/arm/mach-shmobile/platsmp-scu.c         |    8 --------
 2 files changed, 10 deletions(-)
arch/arm/mach-shmobile/include/mach/common.h +0 -2
@@ -18,8 +18,6 @@ extern int shmobile_smp_cpu_disable(unsi
 extern void shmobile_invalidate_start(void);
 extern void shmobile_boot_scu(void);
 extern void shmobile_smp_scu_prepare_cpus(unsigned int max_cpus);
-extern int shmobile_smp_scu_boot_secondary(unsigned int cpu,
-					   struct task_struct *idle);
 extern void shmobile_smp_scu_cpu_die(unsigned int cpu);
 extern int shmobile_smp_scu_cpu_kill(unsigned int cpu);
 extern void shmobile_smp_apmu_prepare_cpus(unsigned int max_cpus);
arch/arm/mach-shmobile/platsmp-scu.c +0 -8
@@ -59,14 +59,6 @@ void __init shmobile_smp_scu_prepare_cpu
 	register_cpu_notifier(&shmobile_smp_scu_notifier);
 }
 
-int shmobile_smp_scu_boot_secondary(unsigned int cpu, struct task_struct *idle)
-{
-	/* For this particular CPU register SCU boot vector */
-	shmobile_smp_hook(cpu, virt_to_phys(shmobile_boot_scu),
-			  (unsigned long)shmobile_scu_base);
-	return 0;
-}
-
 #ifdef CONFIG_HOTPLUG_CPU
 void shmobile_smp_scu_cpu_die(unsigned int cpu)
 {
#6 lore raw

cover ARM: shmobile: Use CPU notifiers for SCU boot vector code

In reply to Magnus Damm
Quoted 8 lines · Magnus Damm

ARM: shmobile: Use CPU notifiers for SCU boot vector code

[PATCH 01/05] ARM: shmobile: Add CPU notifier based SCU boot vector code [PATCH 02/05] ARM: shmobile: Let sh73a0 rely on SCU CPU notifier [PATCH 03/05] ARM: shmobile: Let EMEV2 rely on SCU CPU notifier [PATCH 04/05] ARM: shmobile: Let r8a7779 rely on SCU CPU notifier [PATCH 05/05] ARM: shmobile: Remove shmobile_smp_scu_boot_secondary()

Quoted 4 lines

This series converts mach-shmobile to use CPU notifiers for boot vector setup for SCU based SoCs such as sh73a0, EMEV2 and r8a7779. This allows us to remove the shmobile_smp_scu_boot_secondary() function, and it is also ground work for the CPUIdle resume path.

Thanks Magnus, I have queued these up for v3.12.