* [GIT PULL 1/9] ARM: shmobile: Introduce shared SCU SMP boot code
2013-08-07 4:39 [GIT PULL 0/9] Renesas ARM based SoC SMP updates for v3.12 Simon Horman
@ 2013-08-07 4:39 ` Simon Horman
2013-08-07 4:39 ` [GIT PULL 2/9] ARM: shmobile: Use shared SCU SMP boot code on sh73a0 Simon Horman
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Simon Horman @ 2013-08-07 4:39 UTC (permalink / raw)
To: linux-arm-kernel
From: Magnus Damm <damm@opensource.se>
Add SMP boot functions for SCU equipped mach-shmobile SoCs.
At this point shmobile_smp_scu_prepare_cpus() controls the SCU and
installs boot fn and arg, while shmobile_smp_scu_boot_secondary()
currently does nothing. In the future the boot function and arg
install code will be reworked, so the empty function is ground
work for that.
Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
arch/arm/mach-shmobile/include/mach/common.h | 3 +++
arch/arm/mach-shmobile/platsmp-scu.c | 31 ++++++++++++++++++++++++++++
2 files changed, 34 insertions(+)
create mode 100644 arch/arm/mach-shmobile/platsmp-scu.c
diff --git a/arch/arm/mach-shmobile/include/mach/common.h b/arch/arm/mach-shmobile/include/mach/common.h
index e818f02..42761f4 100644
--- a/arch/arm/mach-shmobile/include/mach/common.h
+++ b/arch/arm/mach-shmobile/include/mach/common.h
@@ -11,6 +11,9 @@ extern void shmobile_boot_vector(void);
extern unsigned long shmobile_boot_fn;
extern unsigned long shmobile_boot_arg;
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);
struct clk;
extern int shmobile_clk_init(void);
extern void shmobile_handle_irq_intc(struct pt_regs *);
diff --git a/arch/arm/mach-shmobile/platsmp-scu.c b/arch/arm/mach-shmobile/platsmp-scu.c
new file mode 100644
index 0000000..8f478e4
--- /dev/null
+++ b/arch/arm/mach-shmobile/platsmp-scu.c
@@ -0,0 +1,31 @@
+/*
+ * SMP support for SoCs with SCU covered by mach-shmobile
+ *
+ * Copyright (C) 2013 Magnus Damm
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include <linux/init.h>
+#include <linux/io.h>
+#include <linux/smp.h>
+#include <asm/smp_plat.h>
+#include <asm/smp_scu.h>
+#include <mach/common.h>
+
+void __init shmobile_smp_scu_prepare_cpus(unsigned int max_cpus)
+{
+ shmobile_boot_fn = virt_to_phys(shmobile_boot_scu);
+ shmobile_boot_arg = (unsigned long)shmobile_scu_base;
+
+ /* enable SCU and cache coherency on booting CPU */
+ scu_enable(shmobile_scu_base);
+ scu_power_mode(shmobile_scu_base, SCU_PM_NORMAL);
+}
+
+int shmobile_smp_scu_boot_secondary(unsigned int cpu, struct task_struct *idle)
+{
+ /* do nothing for now */
+ return 0;
+}
--
1.8.3.2
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [GIT PULL 0/9] Renesas ARM based SoC SMP updates for v3.12
@ 2013-08-07 4:39 Simon Horman
2013-08-07 4:39 ` [GIT PULL 1/9] ARM: shmobile: Introduce shared SCU SMP boot code Simon Horman
` (9 more replies)
0 siblings, 10 replies; 11+ messages in thread
From: Simon Horman @ 2013-08-07 4:39 UTC (permalink / raw)
To: linux-arm-kernel
Hi Olof, Hi Arnd,
please consider these Renesas ARM based SoC SMP updates for v3.12.
This pull-request is based on renesas-dt2-for-v3.12, which I have
previously sent a pull-request for.
The following changes since commit 8b3e32c1fe5dce55e28e76b20361841dc863ec17:
ARM: shmobile: r8a7740: Add TPU node to the device tree (2013-08-06 18:06:23 +0900)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas.git tags/renesas-smp-for-v3.12
for you to fetch changes up to 1d33a354bbb618ba578bb372ebc18fe58457f6f3:
ARM: shmobile: Per-CPU SMP boot / sleep code for SCU SoCs (2013-08-06 18:07:26 +0900)
----------------------------------------------------------------
Renesas ARM based SoC SMP updates for v3.12
* Per-CPU SMP boot and sleep code on SoCs that use SCU
* Shared SCU CPU Hotplug code on r8a7779 and sh73a0 SoCs
* Shared SCU CPU boot code on emev2, r8a7779 and sh73a0 SoCs
----------------------------------------------------------------
Magnus Damm (9):
ARM: shmobile: Introduce shared SCU SMP boot code
ARM: shmobile: Use shared SCU SMP boot code on sh73a0
ARM: shmobile: Use shared SCU SMP boot code on r8a7779
ARM: shmobile: Use shared SCU SMP boot code on emev2
ARM: shmobile: Add shared SCU CPU Hotplug code
ARM: shmobile: Use shared SCU CPU Hotplug code on sh73a0
ARM: shmobile: Use shared SCU CPU Hotplug code on r8a7779
ARM: shmobile: Introduce per-CPU SMP boot / sleep code
ARM: shmobile: Per-CPU SMP boot / sleep code for SCU SoCs
arch/arm/mach-shmobile/Makefile | 6 +--
arch/arm/mach-shmobile/headsmp.S | 49 +++++++++++++++++
arch/arm/mach-shmobile/include/mach/common.h | 9 ++++
arch/arm/mach-shmobile/platsmp-scu.c | 81 ++++++++++++++++++++++++++++
arch/arm/mach-shmobile/platsmp.c | 18 +++++++
arch/arm/mach-shmobile/smp-emev2.c | 19 +++----
arch/arm/mach-shmobile/smp-r8a7779.c | 64 ++++++----------------
arch/arm/mach-shmobile/smp-sh73a0.c | 67 ++++++-----------------
8 files changed, 202 insertions(+), 111 deletions(-)
create mode 100644 arch/arm/mach-shmobile/platsmp-scu.c
^ permalink raw reply [flat|nested] 11+ messages in thread
* [GIT PULL 2/9] ARM: shmobile: Use shared SCU SMP boot code on sh73a0
2013-08-07 4:39 [GIT PULL 0/9] Renesas ARM based SoC SMP updates for v3.12 Simon Horman
2013-08-07 4:39 ` [GIT PULL 1/9] ARM: shmobile: Introduce shared SCU SMP boot code Simon Horman
@ 2013-08-07 4:39 ` Simon Horman
2013-08-07 4:39 ` [GIT PULL 3/9] ARM: shmobile: Use shared SCU SMP boot code on r8a7779 Simon Horman
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Simon Horman @ 2013-08-07 4:39 UTC (permalink / raw)
To: linux-arm-kernel
From: Magnus Damm <damm@opensource.se>
Use shared SCU code on sh73a0 for SMP boot.
Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
arch/arm/mach-shmobile/Makefile | 2 +-
arch/arm/mach-shmobile/smp-sh73a0.c | 26 +++++++++++++-------------
2 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile
index e401c73..a32dc15 100644
--- a/arch/arm/mach-shmobile/Makefile
+++ b/arch/arm/mach-shmobile/Makefile
@@ -17,7 +17,7 @@ obj-$(CONFIG_ARCH_EMEV2) += setup-emev2.o clock-emev2.o
# SMP objects
smp-y := platsmp.o headsmp.o
-smp-$(CONFIG_ARCH_SH73A0) += smp-sh73a0.o headsmp-scu.o
+smp-$(CONFIG_ARCH_SH73A0) += smp-sh73a0.o headsmp-scu.o platsmp-scu.o
smp-$(CONFIG_ARCH_R8A7779) += smp-r8a7779.o headsmp-scu.o
smp-$(CONFIG_ARCH_EMEV2) += smp-emev2.o headsmp-scu.o
diff --git a/arch/arm/mach-shmobile/smp-sh73a0.c b/arch/arm/mach-shmobile/smp-sh73a0.c
index 1b3dc7c..1096b0e 100644
--- a/arch/arm/mach-shmobile/smp-sh73a0.c
+++ b/arch/arm/mach-shmobile/smp-sh73a0.c
@@ -50,30 +50,30 @@ void __init sh73a0_register_twd(void)
static int __cpuinit sh73a0_boot_secondary(unsigned int cpu, struct task_struct *idle)
{
- cpu = cpu_logical_map(cpu);
+ unsigned int lcpu = cpu_logical_map(cpu);
+ int ret;
- if (((__raw_readl(PSTR) >> (4 * cpu)) & 3) = 3)
- __raw_writel(1 << cpu, WUPCR); /* wake up */
+ 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 */
else
- __raw_writel(1 << cpu, SRESCR); /* reset */
+ __raw_writel(1 << lcpu, SRESCR); /* reset */
return 0;
}
static void __init sh73a0_smp_prepare_cpus(unsigned int max_cpus)
{
- /* setup sh73a0 specific SCU base */
- shmobile_scu_base = IOMEM(SH73A0_SCU_BASE);
- scu_enable(shmobile_scu_base);
-
- /* Map the reset vector (in headsmp-scu.S, headsmp.S) */
+ /* Map the reset vector (in headsmp.S) */
__raw_writel(0, APARMBAREA); /* 4k */
__raw_writel(__pa(shmobile_boot_vector), SBAR);
- shmobile_boot_fn = virt_to_phys(shmobile_boot_scu);
- shmobile_boot_arg = (unsigned long)shmobile_scu_base;
- /* enable cache coherency on booting CPU */
- scu_power_mode(shmobile_scu_base, SCU_PM_NORMAL);
+ /* setup sh73a0 specific SCU bits */
+ shmobile_scu_base = IOMEM(SH73A0_SCU_BASE);
+ shmobile_smp_scu_prepare_cpus(max_cpus);
}
#ifdef CONFIG_HOTPLUG_CPU
--
1.8.3.2
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [GIT PULL 3/9] ARM: shmobile: Use shared SCU SMP boot code on r8a7779
2013-08-07 4:39 [GIT PULL 0/9] Renesas ARM based SoC SMP updates for v3.12 Simon Horman
2013-08-07 4:39 ` [GIT PULL 1/9] ARM: shmobile: Introduce shared SCU SMP boot code Simon Horman
2013-08-07 4:39 ` [GIT PULL 2/9] ARM: shmobile: Use shared SCU SMP boot code on sh73a0 Simon Horman
@ 2013-08-07 4:39 ` Simon Horman
2013-08-07 4:39 ` [GIT PULL 4/9] ARM: shmobile: Use shared SCU SMP boot code on emev2 Simon Horman
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Simon Horman @ 2013-08-07 4:39 UTC (permalink / raw)
To: linux-arm-kernel
From: Magnus Damm <damm@opensource.se>
Use shared SCU code on r8a7779 for SMP boot.
Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
arch/arm/mach-shmobile/Makefile | 2 +-
arch/arm/mach-shmobile/smp-r8a7779.c | 23 ++++++++++++-----------
2 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile
index a32dc15..42bbf45 100644
--- a/arch/arm/mach-shmobile/Makefile
+++ b/arch/arm/mach-shmobile/Makefile
@@ -18,7 +18,7 @@ obj-$(CONFIG_ARCH_EMEV2) += setup-emev2.o clock-emev2.o
# SMP objects
smp-y := platsmp.o headsmp.o
smp-$(CONFIG_ARCH_SH73A0) += smp-sh73a0.o headsmp-scu.o platsmp-scu.o
-smp-$(CONFIG_ARCH_R8A7779) += smp-r8a7779.o headsmp-scu.o
+smp-$(CONFIG_ARCH_R8A7779) += smp-r8a7779.o headsmp-scu.o platsmp-scu.o
smp-$(CONFIG_ARCH_EMEV2) += smp-emev2.o headsmp-scu.o
# IRQ objects
diff --git a/arch/arm/mach-shmobile/smp-r8a7779.c b/arch/arm/mach-shmobile/smp-r8a7779.c
index bb3adae..1963d0d 100644
--- a/arch/arm/mach-shmobile/smp-r8a7779.c
+++ b/arch/arm/mach-shmobile/smp-r8a7779.c
@@ -84,33 +84,34 @@ static int r8a7779_platform_cpu_kill(unsigned int cpu)
static int __cpuinit r8a7779_boot_secondary(unsigned int cpu, struct task_struct *idle)
{
struct r8a7779_pm_ch *ch = NULL;
- int ret = -EIO;
+ unsigned int lcpu = cpu_logical_map(cpu);
+ int ret;
- cpu = cpu_logical_map(cpu);
+ ret = shmobile_smp_scu_boot_secondary(cpu, idle);
+ if (ret)
+ return ret;
- if (cpu < ARRAY_SIZE(r8a7779_ch_cpu))
- ch = r8a7779_ch_cpu[cpu];
+ if (lcpu < ARRAY_SIZE(r8a7779_ch_cpu))
+ ch = r8a7779_ch_cpu[lcpu];
if (ch)
ret = r8a7779_sysc_power_up(ch);
+ else
+ ret = -EIO;
return ret;
}
static void __init r8a7779_smp_prepare_cpus(unsigned int max_cpus)
{
-
- /* setup r8a7779 specific SCU base */
- shmobile_scu_base = IOMEM(R8A7779_SCU_BASE);
- scu_enable(shmobile_scu_base);
-
/* Map the reset vector (in headsmp-scu.S, headsmp.S) */
__raw_writel(__pa(shmobile_boot_vector), AVECR);
shmobile_boot_fn = virt_to_phys(shmobile_boot_scu);
shmobile_boot_arg = (unsigned long)shmobile_scu_base;
- /* enable cache coherency on booting CPU */
- scu_power_mode(shmobile_scu_base, SCU_PM_NORMAL);
+ /* setup r8a7779 specific SCU bits */
+ shmobile_scu_base = IOMEM(R8A7779_SCU_BASE);
+ shmobile_smp_scu_prepare_cpus(max_cpus);
r8a7779_pm_init();
--
1.8.3.2
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [GIT PULL 4/9] ARM: shmobile: Use shared SCU SMP boot code on emev2
2013-08-07 4:39 [GIT PULL 0/9] Renesas ARM based SoC SMP updates for v3.12 Simon Horman
` (2 preceding siblings ...)
2013-08-07 4:39 ` [GIT PULL 3/9] ARM: shmobile: Use shared SCU SMP boot code on r8a7779 Simon Horman
@ 2013-08-07 4:39 ` Simon Horman
2013-08-07 4:39 ` [GIT PULL 5/9] ARM: shmobile: Add shared SCU CPU Hotplug code Simon Horman
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Simon Horman @ 2013-08-07 4:39 UTC (permalink / raw)
To: linux-arm-kernel
From: Magnus Damm <damm@opensource.se>
Use shared SCU code on emev2 for SMP boot.
Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
arch/arm/mach-shmobile/Makefile | 2 +-
arch/arm/mach-shmobile/smp-emev2.c | 19 ++++++++++---------
2 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile
index 42bbf45..d7b1c71 100644
--- a/arch/arm/mach-shmobile/Makefile
+++ b/arch/arm/mach-shmobile/Makefile
@@ -19,7 +19,7 @@ obj-$(CONFIG_ARCH_EMEV2) += setup-emev2.o clock-emev2.o
smp-y := platsmp.o headsmp.o
smp-$(CONFIG_ARCH_SH73A0) += smp-sh73a0.o headsmp-scu.o platsmp-scu.o
smp-$(CONFIG_ARCH_R8A7779) += smp-r8a7779.o headsmp-scu.o platsmp-scu.o
-smp-$(CONFIG_ARCH_EMEV2) += smp-emev2.o headsmp-scu.o
+smp-$(CONFIG_ARCH_EMEV2) += smp-emev2.o headsmp-scu.o platsmp-scu.o
# IRQ objects
obj-$(CONFIG_ARCH_SH7372) += entry-intc.o
diff --git a/arch/arm/mach-shmobile/smp-emev2.c b/arch/arm/mach-shmobile/smp-emev2.c
index 1bf8bc7..d1c101d 100644
--- a/arch/arm/mach-shmobile/smp-emev2.c
+++ b/arch/arm/mach-shmobile/smp-emev2.c
@@ -34,6 +34,12 @@
static int __cpuinit 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;
}
@@ -42,21 +48,16 @@ static void __init emev2_smp_prepare_cpus(unsigned int max_cpus)
{
void __iomem *smu;
- /* setup EMEV2 specific SCU base, enable */
- shmobile_scu_base = ioremap(EMEV2_SCU_BASE, PAGE_SIZE);
- scu_enable(shmobile_scu_base);
-
- /* Tell ROM loader about our vector (in headsmp-scu.S, headsmp.S) */
+ /* Tell ROM loader about our vector (in headsmp.S) */
smu = ioremap(EMEV2_SMU_BASE, PAGE_SIZE);
if (smu) {
iowrite32(__pa(shmobile_boot_vector), smu + SMU_GENERAL_REG0);
iounmap(smu);
}
- shmobile_boot_fn = virt_to_phys(shmobile_boot_scu);
- shmobile_boot_arg = (unsigned long)shmobile_scu_base;
- /* enable cache coherency on booting CPU */
- scu_power_mode(shmobile_scu_base, SCU_PM_NORMAL);
+ /* setup EMEV2 specific SCU bits */
+ shmobile_scu_base = ioremap(EMEV2_SCU_BASE, PAGE_SIZE);
+ shmobile_smp_scu_prepare_cpus(max_cpus);
}
struct smp_operations emev2_smp_ops __initdata = {
--
1.8.3.2
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [GIT PULL 5/9] ARM: shmobile: Add shared SCU CPU Hotplug code
2013-08-07 4:39 [GIT PULL 0/9] Renesas ARM based SoC SMP updates for v3.12 Simon Horman
` (3 preceding siblings ...)
2013-08-07 4:39 ` [GIT PULL 4/9] ARM: shmobile: Use shared SCU SMP boot code on emev2 Simon Horman
@ 2013-08-07 4:39 ` Simon Horman
2013-08-07 4:39 ` [GIT PULL 6/9] ARM: shmobile: Use shared SCU CPU Hotplug code on sh73a0 Simon Horman
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Simon Horman @ 2013-08-07 4:39 UTC (permalink / raw)
To: linux-arm-kernel
From: Magnus Damm <damm@opensource.se>
Add CPU Hotplug functions for SCU equipped mach-shmobile SoCs.
The functions shmobile_smp_scu_cpu_die() together with
shmobile_smp_scu_cpu_kill() perform basic shutdown and
allows checking of shutdown status. These are written
to work together with SMP boot code in headsmp-scu.S.
Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
arch/arm/mach-shmobile/include/mach/common.h | 2 ++
arch/arm/mach-shmobile/platsmp-scu.c | 45 ++++++++++++++++++++++++++++
2 files changed, 47 insertions(+)
diff --git a/arch/arm/mach-shmobile/include/mach/common.h b/arch/arm/mach-shmobile/include/mach/common.h
index 42761f4..04209d5 100644
--- a/arch/arm/mach-shmobile/include/mach/common.h
+++ b/arch/arm/mach-shmobile/include/mach/common.h
@@ -14,6 +14,8 @@ 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);
struct clk;
extern int shmobile_clk_init(void);
extern void shmobile_handle_irq_intc(struct pt_regs *);
diff --git a/arch/arm/mach-shmobile/platsmp-scu.c b/arch/arm/mach-shmobile/platsmp-scu.c
index 8f478e4..7a0c066 100644
--- a/arch/arm/mach-shmobile/platsmp-scu.c
+++ b/arch/arm/mach-shmobile/platsmp-scu.c
@@ -7,9 +7,11 @@
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
+#include <linux/delay.h>
#include <linux/init.h>
#include <linux/io.h>
#include <linux/smp.h>
+#include <asm/cacheflush.h>
#include <asm/smp_plat.h>
#include <asm/smp_scu.h>
#include <mach/common.h>
@@ -29,3 +31,46 @@ int shmobile_smp_scu_boot_secondary(unsigned int cpu, struct task_struct *idle)
/* do nothing for now */
return 0;
}
+
+#ifdef CONFIG_HOTPLUG_CPU
+void shmobile_smp_scu_cpu_die(unsigned int cpu)
+{
+ dsb();
+ flush_cache_all();
+
+ /* disable cache coherency */
+ scu_power_mode(shmobile_scu_base, SCU_PM_POWEROFF);
+
+ /* Endless loop until reset */
+ while (1)
+ cpu_do_idle();
+}
+
+static int shmobile_smp_scu_psr_core_disabled(int cpu)
+{
+ unsigned long mask = SCU_PM_POWEROFF << (cpu * 8);
+
+ if ((__raw_readl(shmobile_scu_base + 8) & mask) = mask)
+ return 1;
+
+ return 0;
+}
+
+int shmobile_smp_scu_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_smp_scu_psr_core_disabled(cpu))
+ return 1;
+
+ mdelay(1);
+ }
+
+ return 0;
+}
+#endif
--
1.8.3.2
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [GIT PULL 6/9] ARM: shmobile: Use shared SCU CPU Hotplug code on sh73a0
2013-08-07 4:39 [GIT PULL 0/9] Renesas ARM based SoC SMP updates for v3.12 Simon Horman
` (4 preceding siblings ...)
2013-08-07 4:39 ` [GIT PULL 5/9] ARM: shmobile: Add shared SCU CPU Hotplug code Simon Horman
@ 2013-08-07 4:39 ` Simon Horman
2013-08-07 4:39 ` [GIT PULL 7/9] ARM: shmobile: Use shared SCU CPU Hotplug code on r8a7779 Simon Horman
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Simon Horman @ 2013-08-07 4:39 UTC (permalink / raw)
To: linux-arm-kernel
From: Magnus Damm <damm@opensource.se>
Update the sh73a0 specific CPU Hotplug code to make use of
the recently introduced shared SCU functions. The sh73a0
power control hardware relies on SCU_PM_POWEROFF with WFI
so the shared SCU code will as-is power down the hardware
as expected.
Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
arch/arm/mach-shmobile/smp-sh73a0.c | 41 +++----------------------------------
1 file changed, 3 insertions(+), 38 deletions(-)
diff --git a/arch/arm/mach-shmobile/smp-sh73a0.c b/arch/arm/mach-shmobile/smp-sh73a0.c
index 1096b0e..8b3b977 100644
--- a/arch/arm/mach-shmobile/smp-sh73a0.c
+++ b/arch/arm/mach-shmobile/smp-sh73a0.c
@@ -20,14 +20,11 @@
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/smp.h>
-#include <linux/spinlock.h>
#include <linux/io.h>
#include <linux/delay.h>
#include <mach/common.h>
-#include <asm/cacheflush.h>
-#include <asm/smp_plat.h>
#include <mach/sh73a0.h>
-#include <asm/smp_scu.h>
+#include <asm/smp_plat.h>
#include <asm/smp_twd.h>
#define WUPCR IOMEM(0xe6151010)
@@ -36,8 +33,6 @@
#define SBAR IOMEM(0xe6180020)
#define APARMBAREA IOMEM(0xe6f10020)
-#define PSTR_SHUTDOWN_MODE 3
-
#define SH73A0_SCU_BASE 0xf0000000
#ifdef CONFIG_HAVE_ARM_TWD
@@ -77,36 +72,6 @@ static void __init sh73a0_smp_prepare_cpus(unsigned int max_cpus)
}
#ifdef CONFIG_HOTPLUG_CPU
-static int sh73a0_cpu_kill(unsigned int cpu)
-{
-
- int k;
- u32 pstr;
-
- /*
- * wait until the power status register confirms the shutdown of the
- * offline target
- */
- for (k = 0; k < 1000; k++) {
- pstr = (__raw_readl(PSTR) >> (4 * cpu)) & 3;
- if (pstr = PSTR_SHUTDOWN_MODE)
- return 1;
-
- mdelay(1);
- }
-
- return 0;
-}
-
-static void sh73a0_cpu_die(unsigned int cpu)
-{
- /* Set power off mode. This takes the CPU out of the MP cluster */
- scu_power_mode(shmobile_scu_base, SCU_PM_POWEROFF);
-
- /* Enter shutdown mode */
- cpu_do_idle();
-}
-
static int sh73a0_cpu_disable(unsigned int cpu)
{
return 0; /* CPU0 and CPU1 supported */
@@ -117,8 +82,8 @@ struct smp_operations sh73a0_smp_ops __initdata = {
.smp_prepare_cpus = sh73a0_smp_prepare_cpus,
.smp_boot_secondary = sh73a0_boot_secondary,
#ifdef CONFIG_HOTPLUG_CPU
- .cpu_kill = sh73a0_cpu_kill,
- .cpu_die = sh73a0_cpu_die,
.cpu_disable = sh73a0_cpu_disable,
+ .cpu_die = shmobile_smp_scu_cpu_die,
+ .cpu_kill = shmobile_smp_scu_cpu_kill,
#endif
};
--
1.8.3.2
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [GIT PULL 7/9] ARM: shmobile: Use shared SCU CPU Hotplug code on r8a7779
2013-08-07 4:39 [GIT PULL 0/9] Renesas ARM based SoC SMP updates for v3.12 Simon Horman
` (5 preceding siblings ...)
2013-08-07 4:39 ` [GIT PULL 6/9] ARM: shmobile: Use shared SCU CPU Hotplug code on sh73a0 Simon Horman
@ 2013-08-07 4:39 ` Simon Horman
2013-08-07 4:39 ` [GIT PULL 8/9] ARM: shmobile: Introduce per-CPU SMP boot / sleep code Simon Horman
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Simon Horman @ 2013-08-07 4:39 UTC (permalink / raw)
To: linux-arm-kernel
From: Magnus Damm <damm@opensource.se>
Update the r8a7779 specific CPU Hotplug code to make use of
the recently introduced shared SCU functions. The r8a7779
power domain hardware requires special power down handling
at ->kill() time.
Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
arch/arm/mach-shmobile/smp-r8a7779.c | 41 ++++--------------------------------
1 file changed, 4 insertions(+), 37 deletions(-)
diff --git a/arch/arm/mach-shmobile/smp-r8a7779.c b/arch/arm/mach-shmobile/smp-r8a7779.c
index 1963d0d..c159964 100644
--- a/arch/arm/mach-shmobile/smp-r8a7779.c
+++ b/arch/arm/mach-shmobile/smp-r8a7779.c
@@ -122,47 +122,14 @@ static void __init r8a7779_smp_prepare_cpus(unsigned int max_cpus)
}
#ifdef CONFIG_HOTPLUG_CPU
-static int r8a7779_scu_psr_core_disabled(int cpu)
-{
- unsigned long mask = 3 << (cpu * 8);
-
- if ((__raw_readl(shmobile_scu_base + 8) & mask) = mask)
- return 1;
-
- return 0;
-}
-
static int r8a7779_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 (r8a7779_scu_psr_core_disabled(cpu))
- return r8a7779_platform_cpu_kill(cpu);
-
- mdelay(1);
- }
+ if (shmobile_smp_scu_cpu_kill(cpu))
+ return r8a7779_platform_cpu_kill(cpu);
return 0;
}
-static void r8a7779_cpu_die(unsigned int cpu)
-{
- dsb();
- flush_cache_all();
-
- /* disable cache coherency */
- scu_power_mode(shmobile_scu_base, SCU_PM_POWEROFF);
-
- /* Endless loop until power off from r8a7779_cpu_kill() */
- while (1)
- cpu_do_idle();
-}
-
static int r8a7779_cpu_disable(unsigned int cpu)
{
/* only CPU1->3 have power domains, do not allow hotplug of CPU0 */
@@ -174,8 +141,8 @@ struct smp_operations r8a7779_smp_ops __initdata = {
.smp_prepare_cpus = r8a7779_smp_prepare_cpus,
.smp_boot_secondary = r8a7779_boot_secondary,
#ifdef CONFIG_HOTPLUG_CPU
- .cpu_kill = r8a7779_cpu_kill,
- .cpu_die = r8a7779_cpu_die,
.cpu_disable = r8a7779_cpu_disable,
+ .cpu_die = shmobile_smp_scu_cpu_die,
+ .cpu_kill = r8a7779_cpu_kill,
#endif
};
--
1.8.3.2
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [GIT PULL 8/9] ARM: shmobile: Introduce per-CPU SMP boot / sleep code
2013-08-07 4:39 [GIT PULL 0/9] Renesas ARM based SoC SMP updates for v3.12 Simon Horman
` (6 preceding siblings ...)
2013-08-07 4:39 ` [GIT PULL 7/9] ARM: shmobile: Use shared SCU CPU Hotplug code on r8a7779 Simon Horman
@ 2013-08-07 4:39 ` Simon Horman
2013-08-07 4:39 ` [GIT PULL 9/9] ARM: shmobile: Per-CPU SMP boot / sleep code for SCU SoCs Simon Horman
2013-08-28 17:06 ` [GIT PULL 0/9] Renesas ARM based SoC SMP updates for v3.12 Olof Johansson
9 siblings, 0 replies; 11+ messages in thread
From: Simon Horman @ 2013-08-07 4:39 UTC (permalink / raw)
To: linux-arm-kernel
From: Magnus Damm <damm@opensource.se>
Add per-CPU SMP boot / sleep code that can be used by all
SoCs included in mach-shmobile.
The boot code reads out the per-CPU MPIDR id value and
matches it with the value stored for any CPU number, and
if there is a match and the boot function is set as well
then the boot function will be executed.
The sleep code simply uses WFI and then jumps back to the
boot code to see if anyone has asked to wake up that CPU,
if not it will sleep again.
Signed-off-by: Magnus Damm <damm@opensource.se>
[horms+renesas@verge.net.au: Remove trailing whitespace]
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
arch/arm/mach-shmobile/headsmp.S | 49 ++++++++++++++++++++++++++++
arch/arm/mach-shmobile/include/mach/common.h | 4 +++
arch/arm/mach-shmobile/platsmp.c | 18 ++++++++++
3 files changed, 71 insertions(+)
diff --git a/arch/arm/mach-shmobile/headsmp.S b/arch/arm/mach-shmobile/headsmp.S
index 559d1ce..2940fc9 100644
--- a/arch/arm/mach-shmobile/headsmp.S
+++ b/arch/arm/mach-shmobile/headsmp.S
@@ -38,3 +38,52 @@ shmobile_boot_fn:
.globl shmobile_boot_arg
shmobile_boot_arg:
2: .space 4
+
+/*
+ * Per-CPU SMP boot function/argument selection code based on MPIDR
+ */
+
+ENTRY(shmobile_smp_boot)
+ @ r0 = MPIDR_HWID_BITMASK
+ mrc p15, 0, r1, c0, c0, 5 @ r1 = MPIDR
+ and r0, r1, r0 @ r0 = cpu_logical_map() value
+ mov r1, #0 @ r1 = CPU index
+ adr r5, 1f @ array of per-cpu mpidr values
+ adr r6, 2f @ array of per-cpu functions
+ adr r7, 3f @ array of per-cpu arguments
+
+shmobile_smp_boot_find_mpidr:
+ ldr r8, [r5, r1, lsl #2]
+ cmp r8, r0
+ bne shmobile_smp_boot_next
+
+ ldr r9, [r6, r1, lsl #2]
+ cmp r9, #0
+ bne shmobile_smp_boot_found
+
+shmobile_smp_boot_next:
+ add r1, r1, #1
+ cmp r1, #CONFIG_NR_CPUS
+ blo shmobile_smp_boot_find_mpidr
+
+ b shmobile_smp_sleep
+
+shmobile_smp_boot_found:
+ ldr r0, [r7, r1, lsl #2]
+ mov pc, r9
+ENDPROC(shmobile_smp_boot)
+
+ENTRY(shmobile_smp_sleep)
+ wfi
+ b shmobile_smp_boot
+ENDPROC(shmobile_smp_sleep)
+
+ .globl shmobile_smp_mpidr
+shmobile_smp_mpidr:
+1: .space CONFIG_NR_CPUS * 4
+ .globl shmobile_smp_fn
+shmobile_smp_fn:
+2: .space CONFIG_NR_CPUS * 4
+ .globl shmobile_smp_arg
+shmobile_smp_arg:
+3: .space CONFIG_NR_CPUS * 4
diff --git a/arch/arm/mach-shmobile/include/mach/common.h b/arch/arm/mach-shmobile/include/mach/common.h
index 04209d5..3880cf5 100644
--- a/arch/arm/mach-shmobile/include/mach/common.h
+++ b/arch/arm/mach-shmobile/include/mach/common.h
@@ -10,6 +10,10 @@ extern void shmobile_setup_console(void);
extern void shmobile_boot_vector(void);
extern unsigned long shmobile_boot_fn;
extern unsigned long shmobile_boot_arg;
+extern void shmobile_smp_boot(void);
+extern void shmobile_smp_sleep(void);
+extern void shmobile_smp_hook(unsigned int cpu, unsigned long fn,
+ unsigned long arg);
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,
diff --git a/arch/arm/mach-shmobile/platsmp.c b/arch/arm/mach-shmobile/platsmp.c
index 1f958d7..d4ae616 100644
--- a/arch/arm/mach-shmobile/platsmp.c
+++ b/arch/arm/mach-shmobile/platsmp.c
@@ -12,6 +12,9 @@
*/
#include <linux/init.h>
#include <linux/smp.h>
+#include <asm/cacheflush.h>
+#include <asm/smp_plat.h>
+#include <mach/common.h>
void __init shmobile_smp_init_cpus(unsigned int ncores)
{
@@ -26,3 +29,18 @@ void __init shmobile_smp_init_cpus(unsigned int ncores)
for (i = 0; i < ncores; i++)
set_cpu_possible(i, true);
}
+
+extern unsigned long shmobile_smp_fn[];
+extern unsigned long shmobile_smp_arg[];
+extern unsigned long shmobile_smp_mpidr[];
+
+void shmobile_smp_hook(unsigned int cpu, unsigned long fn, unsigned long arg)
+{
+ shmobile_smp_fn[cpu] = 0;
+ flush_cache_all();
+
+ shmobile_smp_mpidr[cpu] = cpu_logical_map(cpu);
+ shmobile_smp_fn[cpu] = fn;
+ shmobile_smp_arg[cpu] = arg;
+ flush_cache_all();
+}
--
1.8.3.2
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [GIT PULL 9/9] ARM: shmobile: Per-CPU SMP boot / sleep code for SCU SoCs
2013-08-07 4:39 [GIT PULL 0/9] Renesas ARM based SoC SMP updates for v3.12 Simon Horman
` (7 preceding siblings ...)
2013-08-07 4:39 ` [GIT PULL 8/9] ARM: shmobile: Introduce per-CPU SMP boot / sleep code Simon Horman
@ 2013-08-07 4:39 ` Simon Horman
2013-08-28 17:06 ` [GIT PULL 0/9] Renesas ARM based SoC SMP updates for v3.12 Olof Johansson
9 siblings, 0 replies; 11+ messages in thread
From: Simon Horman @ 2013-08-07 4:39 UTC (permalink / raw)
To: linux-arm-kernel
From: Magnus Damm <damm@opensource.se>
Hook in the per-CPU boot and sleep code in the shared
mach-shmobile SCU code. CPUs may be kept in the asm
routine until ->boot_secondary() when the per-CPU
boot vector is installed. At the end of ->die() the
asm sleep routine is invoked.
Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
arch/arm/mach-shmobile/platsmp-scu.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/arch/arm/mach-shmobile/platsmp-scu.c b/arch/arm/mach-shmobile/platsmp-scu.c
index 7a0c066..c96f501 100644
--- a/arch/arm/mach-shmobile/platsmp-scu.c
+++ b/arch/arm/mach-shmobile/platsmp-scu.c
@@ -18,8 +18,9 @@
void __init shmobile_smp_scu_prepare_cpus(unsigned int max_cpus)
{
- shmobile_boot_fn = virt_to_phys(shmobile_boot_scu);
- shmobile_boot_arg = (unsigned long)shmobile_scu_base;
+ /* install boot code shared by all CPUs */
+ shmobile_boot_fn = virt_to_phys(shmobile_smp_boot);
+ shmobile_boot_arg = MPIDR_HWID_BITMASK;
/* enable SCU and cache coherency on booting CPU */
scu_enable(shmobile_scu_base);
@@ -28,22 +29,26 @@ void __init shmobile_smp_scu_prepare_cpus(unsigned int max_cpus)
int shmobile_smp_scu_boot_secondary(unsigned int cpu, struct task_struct *idle)
{
- /* do nothing for now */
+ /* 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)
{
+ /* For this particular CPU deregister boot vector */
+ shmobile_smp_hook(cpu, 0, 0);
+
dsb();
flush_cache_all();
/* disable cache coherency */
scu_power_mode(shmobile_scu_base, SCU_PM_POWEROFF);
- /* Endless loop until reset */
- while (1)
- cpu_do_idle();
+ /* jump to shared mach-shmobile sleep / reset code */
+ shmobile_smp_sleep();
}
static int shmobile_smp_scu_psr_core_disabled(int cpu)
--
1.8.3.2
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [GIT PULL 0/9] Renesas ARM based SoC SMP updates for v3.12
2013-08-07 4:39 [GIT PULL 0/9] Renesas ARM based SoC SMP updates for v3.12 Simon Horman
` (8 preceding siblings ...)
2013-08-07 4:39 ` [GIT PULL 9/9] ARM: shmobile: Per-CPU SMP boot / sleep code for SCU SoCs Simon Horman
@ 2013-08-28 17:06 ` Olof Johansson
9 siblings, 0 replies; 11+ messages in thread
From: Olof Johansson @ 2013-08-28 17:06 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, Aug 07, 2013 at 01:39:28PM +0900, Simon Horman wrote:
> Hi Olof, Hi Arnd,
>
> please consider these Renesas ARM based SoC SMP updates for v3.12.
>
> This pull-request is based on renesas-dt2-for-v3.12, which I have
> previously sent a pull-request for.
>
>
> The following changes since commit 8b3e32c1fe5dce55e28e76b20361841dc863ec17:
>
> ARM: shmobile: r8a7740: Add TPU node to the device tree (2013-08-06 18:06:23 +0900)
>
> are available in the git repository at:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas.git tags/renesas-smp-for-v3.12
>
> for you to fetch changes up to 1d33a354bbb618ba578bb372ebc18fe58457f6f3:
>
> ARM: shmobile: Per-CPU SMP boot / sleep code for SCU SoCs (2013-08-06 18:07:26 +0900)
Pulled, thanks.
-Olof
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2013-08-28 17:06 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-07 4:39 [GIT PULL 0/9] Renesas ARM based SoC SMP updates for v3.12 Simon Horman
2013-08-07 4:39 ` [GIT PULL 1/9] ARM: shmobile: Introduce shared SCU SMP boot code Simon Horman
2013-08-07 4:39 ` [GIT PULL 2/9] ARM: shmobile: Use shared SCU SMP boot code on sh73a0 Simon Horman
2013-08-07 4:39 ` [GIT PULL 3/9] ARM: shmobile: Use shared SCU SMP boot code on r8a7779 Simon Horman
2013-08-07 4:39 ` [GIT PULL 4/9] ARM: shmobile: Use shared SCU SMP boot code on emev2 Simon Horman
2013-08-07 4:39 ` [GIT PULL 5/9] ARM: shmobile: Add shared SCU CPU Hotplug code Simon Horman
2013-08-07 4:39 ` [GIT PULL 6/9] ARM: shmobile: Use shared SCU CPU Hotplug code on sh73a0 Simon Horman
2013-08-07 4:39 ` [GIT PULL 7/9] ARM: shmobile: Use shared SCU CPU Hotplug code on r8a7779 Simon Horman
2013-08-07 4:39 ` [GIT PULL 8/9] ARM: shmobile: Introduce per-CPU SMP boot / sleep code Simon Horman
2013-08-07 4:39 ` [GIT PULL 9/9] ARM: shmobile: Per-CPU SMP boot / sleep code for SCU SoCs Simon Horman
2013-08-28 17:06 ` [GIT PULL 0/9] Renesas ARM based SoC SMP updates for v3.12 Olof Johansson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).