Skip to contentSkip to conversation

ARM: shmobile: Trivial SMP cleanups

PATCH New Magnus Damm 2 participants 9 messages Feb 12, 2013 – Feb 13, 2013

Subsystems (4)
lore
Share & tools
lore

Magnus Damm

author maintainer
#0 lore raw

cover ARM: shmobile: Trivial SMP cleanups

ARM: shmobile: Trivial SMP cleanups

[PATCH 01/06] ARM: shmobile: Remove unused headers from hotplug.c [PATCH 02/06] ARM: shmobile: Remove partial CPU Hotplug from EMEV2 [PATCH 03/06] ARM: shmobile: Move EMEV2 CPU boot vector setup code [PATCH 04/06] ARM: shmobile: Remove sh73a0_get_core_count() [PATCH 05/06] ARM: shmobile: Remove r8a7779_get_core_count() [PATCH 06/06] ARM: shmobile: Remove emev2_get_core_count()

This series contains random trivial SMP cleanups for mach-shmobile.

The patches are known to build for sh73a0, r8a7779 and EMEV2, and on top of that they also work well on the KZM9D/EMEV2 board.

---

No known dependencies, simply written against -next in renesas.git.

 arch/arm/mach-shmobile/hotplug.c     |    4 --
 arch/arm/mach-shmobile/smp-emev2.c   |   55 ++++++----------------------------
 arch/arm/mach-shmobile/smp-r8a7779.c |    9 -----
 arch/arm/mach-shmobile/smp-sh73a0.c  |    9 -----
 4 files changed, 13 insertions(+), 64 deletions(-)
author maintainer
#1 lore raw

PATCH 1/6 ARM: shmobile: Remove unused headers from hotplug.c

From: Magnus Damm <[email protected]>

This file has no SoC-specific references in it, and fortunately it is still independent of OF so there is no real reason to drag in these headers.

---

 arch/arm/mach-shmobile/hotplug.c |    4 ----
 1 file changed, 4 deletions(-)
arch/arm/mach-shmobile/hotplug.c +0 -4
@@ -14,12 +14,8 @@
 #include <linux/smp.h>
 #include <linux/cpumask.h>
 #include <linux/delay.h>
-#include <linux/of.h>
 #include <mach/common.h>
-#include <mach/r8a7779.h>
-#include <mach/emev2.h>
 #include <asm/cacheflush.h>
-#include <asm/mach-types.h>
 
 static cpumask_t dead_cpus;
 
author maintainer
#2 lore raw

PATCH 2/6 ARM: shmobile: Remove partial CPU Hotplug from EMEV2

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

Remove partial CPU hotplug support from EMEV2 SMP code.

The upstream EMEV2 SMP support code has no CPU shutdown or reset ability so we cannot reboot the secondary CPU cores.

Regular SMP operation is however still working as expected.

---

Tested on KZM9D hardware.

 arch/arm/mach-shmobile/smp-emev2.c |   28 ----------------------------
 1 file changed, 28 deletions(-)
arch/arm/mach-shmobile/smp-emev2.c +0 -28
@@ -62,29 +62,6 @@ static unsigned int __init emev2_get_cor
 	return scu_base ? scu_get_core_count(scu_base) : 1;
 }
 
-static int emev2_platform_cpu_kill(unsigned int cpu)
-{
-	return 0; /* not supported yet */
-}
-
-static int __maybe_unused emev2_cpu_kill(unsigned int cpu)
-{
-	int k;
-
-	/* this function is running on another CPU than the offline target,
-	 * here we need wait for shutdown code in platform_cpu_die() to
-	 * finish before asking SoC-specific code to power off the CPU core.
-	 */
-	for (k = 0; k < 1000; k++) {
-		if (shmobile_cpu_is_dead(cpu))
-			return emev2_platform_cpu_kill(cpu);
-		mdelay(1);
-	}
-
-	return 0;
-}
-
-
 static void __cpuinit emev2_secondary_init(unsigned int cpu)
 {
 	gic_secondary_init(0);
@@ -126,9 +103,4 @@ struct smp_operations emev2_smp_ops __in
 	.smp_prepare_cpus	= emev2_smp_prepare_cpus,
 	.smp_secondary_init	= emev2_secondary_init,
 	.smp_boot_secondary	= emev2_boot_secondary,
-#ifdef CONFIG_HOTPLUG_CPU
-	.cpu_kill		= emev2_cpu_kill,
-	.cpu_die		= shmobile_cpu_die,
-	.cpu_disable		= shmobile_cpu_disable,
-#endif
 };
author maintainer
#3 lore raw

PATCH 3/6 ARM: shmobile: Move EMEV2 CPU boot vector setup code

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

Move the boot vector setup code for the EMEV2 SoC to match the sh73a0 and r8a7779 implementations. With this in place all SoC specific SMP implementations for mach-shmobile uses the ->smp_prepare_cpus() callback to setup the boot vector.

---

Tested on KZM9D hardware.

 arch/arm/mach-shmobile/smp-emev2.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm/mach-shmobile/smp-emev2.c +3 -3
@@ -74,9 +74,6 @@ static int __cpuinit emev2_boot_secondar
 	/* enable cache coherency */
 	modify_scu_cpu_psr(0, 3 << (cpu * 8));
 
-	/* Tell ROM loader about our vector (in headsmp.S) */
-	emev2_set_boot_vector(__pa(shmobile_secondary_vector));
-
 	arch_send_wakeup_ipi_mask(cpumask_of(cpu));
 	return 0;
 }
@@ -87,6 +84,9 @@ static void __init emev2_smp_prepare_cpu
 
 	scu_enable(scu_base);
 
+	/* Tell ROM loader about our vector (in headsmp.S) */
+	emev2_set_boot_vector(__pa(shmobile_secondary_vector));
+
 	/* enable cache coherency on CPU0 */
 	modify_scu_cpu_psr(0, 3 << (cpu * 8));
 }
author maintainer
#4 lore raw

PATCH 4/6 ARM: shmobile: Remove sh73a0_get_core_count()

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

Reduce the number of lines of code in smp-sh73a0.c by getting rid of the sh73a0_get_core_count() function.

---

 arch/arm/mach-shmobile/smp-sh73a0.c |    9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)
arch/arm/mach-shmobile/smp-sh73a0.c +1 -8
@@ -52,13 +52,6 @@ void __init sh73a0_register_twd(void)
 }
 #endif
 
-static unsigned int __init sh73a0_get_core_count(void)
-{
-	void __iomem *scu_base = scu_base_addr();
-
-	return scu_get_core_count(scu_base);
-}
-
 static void __cpuinit sh73a0_secondary_init(unsigned int cpu)
 {
 	gic_secondary_init(0);
@@ -90,7 +83,7 @@ static void __init sh73a0_smp_prepare_cp
 
 static void __init sh73a0_smp_init_cpus(void)
 {
-	unsigned int ncores = sh73a0_get_core_count();
+	unsigned int ncores = scu_get_core_count(scu_base_addr());
 
 	shmobile_smp_init_cpus(ncores);
 }
author maintainer
#5 lore raw

PATCH 5/6 ARM: shmobile: Remove r8a7779_get_core_count()

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

Reduce the number of lines of code in smp-r8a7779.c by getting rid of the r8a7779_get_core_count() function.

---

 arch/arm/mach-shmobile/smp-r8a7779.c |    9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)
arch/arm/mach-shmobile/smp-r8a7779.c +1 -8
@@ -87,13 +87,6 @@ static void modify_scu_cpu_psr(unsigned
 	__raw_writel(tmp, scu_base + 8);
 }
 
-static unsigned int __init r8a7779_get_core_count(void)
-{
-	void __iomem *scu_base = scu_base_addr();
-
-	return scu_get_core_count(scu_base);
-}
-
 static int r8a7779_platform_cpu_kill(unsigned int cpu)
 {
 	struct r8a7779_pm_ch *ch = NULL;
@@ -178,7 +171,7 @@ static void __init r8a7779_smp_prepare_c
 
 static void __init r8a7779_smp_init_cpus(void)
 {
-	unsigned int ncores = r8a7779_get_core_count();
+	unsigned int ncores = scu_get_core_count(scu_base_addr());
 
 	shmobile_smp_init_cpus(ncores);
 }
author maintainer
#6 lore raw

PATCH 6/6 ARM: shmobile: Remove emev2_get_core_count()

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

Reduce the number of lines of code in smp-emev2.c by getting rid of the emev2_get_core_count() function.

---

 arch/arm/mach-shmobile/smp-emev2.c |   21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)
arch/arm/mach-shmobile/smp-emev2.c +8 -13
@@ -50,18 +50,6 @@ static void modify_scu_cpu_psr(unsigned
 
 }
 
-static unsigned int __init emev2_get_core_count(void)
-{
-	if (!scu_base) {
-		scu_base = ioremap(EMEV2_SCU_BASE, PAGE_SIZE);
-		emev2_clock_init(); /* need ioremapped SMU */
-	}
-
-	WARN_ON_ONCE(!scu_base);
-
-	return scu_base ? scu_get_core_count(scu_base) : 1;
-}
-
 static void __cpuinit emev2_secondary_init(unsigned int cpu)
 {
 	gic_secondary_init(0);
@@ -93,7 +81,14 @@ static void __init emev2_smp_prepare_cpu
 
 static void __init emev2_smp_init_cpus(void)
 {
-	unsigned int ncores = emev2_get_core_count();
+	unsigned int ncores;
+
+	if (!scu_base) {
+		scu_base = ioremap(EMEV2_SCU_BASE, PAGE_SIZE);
+		emev2_clock_init(); /* need ioremapped SMU */
+	}
+
+	ncores = scu_base ? scu_get_core_count(scu_base) : 1;
 
 	shmobile_smp_init_cpus(ncores);
 }
#7 lore raw

cover ARM: shmobile: Trivial SMP cleanups

In reply to Magnus Damm
Quoted 9 lines · Magnus Damm

ARM: shmobile: Trivial SMP cleanups

[PATCH 01/06] ARM: shmobile: Remove unused headers from hotplug.c [PATCH 02/06] ARM: shmobile: Remove partial CPU Hotplug from EMEV2 [PATCH 03/06] ARM: shmobile: Move EMEV2 CPU boot vector setup code [PATCH 04/06] ARM: shmobile: Remove sh73a0_get_core_count() [PATCH 05/06] ARM: shmobile: Remove r8a7779_get_core_count() [PATCH 06/06] ARM: shmobile: Remove emev2_get_core_count()

Quoted 4 lines

This series contains random trivial SMP cleanups for mach-shmobile.

The patches are known to build for sh73a0, r8a7779 and EMEV2, and on top of that they also work well on the KZM9D/EMEV2 board.

Thanks, I have applied these to a new soc5 branch, based on the soc4 branch which has been merged into arm-soc.

I have also updated next and topic/all+next with these changes.

I anticipate these changes will appear upstream in 3.10.

author maintainer
#8 lore raw

cover ARM: shmobile: Trivial SMP cleanups

Hi Simon,

Quoted 15 lines · Simon Horman
Quoted 9 lines · Magnus Damm

ARM: shmobile: Trivial SMP cleanups

[PATCH 01/06] ARM: shmobile: Remove unused headers from hotplug.c [PATCH 02/06] ARM: shmobile: Remove partial CPU Hotplug from EMEV2 [PATCH 03/06] ARM: shmobile: Move EMEV2 CPU boot vector setup code [PATCH 04/06] ARM: shmobile: Remove sh73a0_get_core_count() [PATCH 05/06] ARM: shmobile: Remove r8a7779_get_core_count() [PATCH 06/06] ARM: shmobile: Remove emev2_get_core_count()

Quoted 4 lines

This series contains random trivial SMP cleanups for mach-shmobile.

The patches are known to build for sh73a0, r8a7779 and EMEV2, and on top of that they also work well on the KZM9D/EMEV2 board.

Quoted 6 lines

Thanks, I have applied these to a new soc5 branch, based on the soc4 branch which has been merged into arm-soc.

I have also updated next and topic/all+next with these changes.

I anticipate these changes will appear upstream in 3.10.

Thanks, that is of course fine with me. I will prepare my second batch of SMP updates then.

Cheers,

/ magnus