linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 01/14] ARM: shmobile: Introduce shmobile_smp_cpu_disable()
  2013-10-01  2:35 [GIT PULL 00/14] Renesas ARM based SoC SMP updates for v3.13 Simon Horman
@ 2013-10-01  2:35 ` Simon Horman
  2013-10-01  2:35 ` [PATCH 02/14] ARM: shmobile: Use shmobile_smp_cpu_disable() on sh73a0 Simon Horman
                   ` (13 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Simon Horman @ 2013-10-01  2:35 UTC (permalink / raw)
  To: linux-arm-kernel

From: Magnus Damm <damm@opensource.se>

Introduce the shared CPU Hotplug function shmobile_smp_cpu_disable()
for mach-shmobile. It is useful for the case when all CPUs may be
hotplugged, including CPU 0.

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 | 1 +
 arch/arm/mach-shmobile/platsmp.c             | 7 +++++++
 2 files changed, 8 insertions(+)

diff --git a/arch/arm/mach-shmobile/include/mach/common.h b/arch/arm/mach-shmobile/include/mach/common.h
index 7b93868..1ed155e 100644
--- a/arch/arm/mach-shmobile/include/mach/common.h
+++ b/arch/arm/mach-shmobile/include/mach/common.h
@@ -13,6 +13,7 @@ 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 int shmobile_smp_cpu_disable(unsigned int cpu);
 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 d4ae616..3741562 100644
--- a/arch/arm/mach-shmobile/platsmp.c
+++ b/arch/arm/mach-shmobile/platsmp.c
@@ -44,3 +44,10 @@ void shmobile_smp_hook(unsigned int cpu, unsigned long fn, unsigned long arg)
 	shmobile_smp_arg[cpu] = arg;
 	flush_cache_all();
 }
+
+#ifdef CONFIG_HOTPLUG_CPU
+int shmobile_smp_cpu_disable(unsigned int cpu)
+{
+	return 0; /* Hotplug of any CPU is supported */
+}
+#endif
-- 
1.8.4


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 02/14] ARM: shmobile: Use shmobile_smp_cpu_disable() on sh73a0
  2013-10-01  2:35 [GIT PULL 00/14] Renesas ARM based SoC SMP updates for v3.13 Simon Horman
  2013-10-01  2:35 ` [PATCH 01/14] ARM: shmobile: Introduce shmobile_smp_cpu_disable() Simon Horman
@ 2013-10-01  2:35 ` Simon Horman
  2013-10-01  2:35 ` [PATCH 03/14] ARM: shmobile: Remove unused shmobile_smp_init_cpus() Simon Horman
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Simon Horman @ 2013-10-01  2:35 UTC (permalink / raw)
  To: linux-arm-kernel

From: Magnus Damm <damm@opensource.se>

Use shmobile_smp_cpu_disable() on sh73a0 since it
allows CPU Hotplug of any CPU.

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 | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/arch/arm/mach-shmobile/smp-sh73a0.c b/arch/arm/mach-shmobile/smp-sh73a0.c
index 0baa244..9a30a3f 100644
--- a/arch/arm/mach-shmobile/smp-sh73a0.c
+++ b/arch/arm/mach-shmobile/smp-sh73a0.c
@@ -71,18 +71,11 @@ static void __init sh73a0_smp_prepare_cpus(unsigned int max_cpus)
 	shmobile_smp_scu_prepare_cpus(max_cpus);
 }
 
-#ifdef CONFIG_HOTPLUG_CPU
-static int sh73a0_cpu_disable(unsigned int cpu)
-{
-	return 0; /* CPU0 and CPU1 supported */
-}
-#endif /* CONFIG_HOTPLUG_CPU */
-
 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_disable		= sh73a0_cpu_disable,
+	.cpu_disable		= shmobile_smp_cpu_disable,
 	.cpu_die		= shmobile_smp_scu_cpu_die,
 	.cpu_kill		= shmobile_smp_scu_cpu_kill,
 #endif
-- 
1.8.4


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [GIT PULL 00/14] Renesas ARM based SoC SMP updates for v3.13
@ 2013-10-01  2:35 Simon Horman
  2013-10-01  2:35 ` [PATCH 01/14] ARM: shmobile: Introduce shmobile_smp_cpu_disable() Simon Horman
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: Simon Horman @ 2013-10-01  2:35 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Kevin, Olof and Arnd,

please consider these Renesas ARM based SoC SMP updates for v3.13.

This pull-request is based on renesas-cleanups-v3.13 which
I has also sent a pull-request for today. The reason for choosing
that base is to reduce conflicts.


The following changes since commit cde214a890f81797a5eee94fffc89c1de21ed991:

  ARM: shmobile: r8a7790: Constify platform data and resources (2013-09-19 14:33:44 -0700)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas.git tags/renesas-smp-for-v3.13

for you to fetch changes up to 43651b15de94d6a5e188ea032311e9661ec708d2:

  ARM: shmobile: Include CA7 cores in APMU table (2013-09-30 17:56:11 +0900)

----------------------------------------------------------------
Renesas ARM based SoC SMP updates for v3.13

* Add CPU notifier based SCU boot vector code
  - Use on emev2, r8a7779 and sh73a0 SoCs
  - Remove now unused shmobile_smp_scu_boot_secondary()
* Add shared APMU SMP support code
  - Use to add SMP support for r8a7790 SoC
* Introduce shmobile_boot_size
* Expose shmobile_invalidate_start()
* Introduce shmobile_smp_cpu_disable()
  - Use on sh73a0 SoC
  - Remove now unused shmobile_smp_init_cpus()

----------------------------------------------------------------
Magnus Damm (14):
      ARM: shmobile: Introduce shmobile_smp_cpu_disable()
      ARM: shmobile: Use shmobile_smp_cpu_disable() on sh73a0
      ARM: shmobile: Remove unused shmobile_smp_init_cpus()
      ARM: shmobile: Expose shmobile_invalidate_start()
      ARM: shmobile: Introduce shmobile_boot_size
      ARM: shmobile: Shared APMU SMP support code without DT
      ARM: shmobile: Add r8a7790 SMP support using APMU code
      ARM: shmobile: Add CPU notifier based SCU boot vector code
      ARM: shmobile: Let sh73a0 rely on SCU CPU notifier
      ARM: shmobile: Let EMEV2 rely on SCU CPU notifier
      ARM: shmobile: Let r8a7779 rely on SCU CPU notifier
      ARM: shmobile: Remove shmobile_smp_scu_boot_secondary()
      ARM: shmobile: Extend APMU code to allow single cluster only
      ARM: shmobile: Include CA7 cores in APMU table

 arch/arm/mach-shmobile/Makefile                |   1 +
 arch/arm/mach-shmobile/board-lager-reference.c |   1 +
 arch/arm/mach-shmobile/board-lager.c           |   1 +
 arch/arm/mach-shmobile/headsmp.S               |   3 +
 arch/arm/mach-shmobile/include/mach/common.h   |  12 +-
 arch/arm/mach-shmobile/include/mach/r8a7790.h  |   1 +
 arch/arm/mach-shmobile/platsmp-apmu.c          | 195 +++++++++++++++++++++++++
 arch/arm/mach-shmobile/platsmp-scu.c           |  30 +++-
 arch/arm/mach-shmobile/platsmp.c               |  22 +--
 arch/arm/mach-shmobile/setup-r8a7790.c         |   1 +
 arch/arm/mach-shmobile/smp-emev2.c             |   6 -
 arch/arm/mach-shmobile/smp-r8a7779.c           |   4 -
 arch/arm/mach-shmobile/smp-r8a7790.c           |  67 +++++++++
 arch/arm/mach-shmobile/smp-sh73a0.c            |  14 +-
 14 files changed, 310 insertions(+), 48 deletions(-)
 create mode 100644 arch/arm/mach-shmobile/platsmp-apmu.c
 create mode 100644 arch/arm/mach-shmobile/smp-r8a7790.c

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 03/14] ARM: shmobile: Remove unused shmobile_smp_init_cpus()
  2013-10-01  2:35 [GIT PULL 00/14] Renesas ARM based SoC SMP updates for v3.13 Simon Horman
  2013-10-01  2:35 ` [PATCH 01/14] ARM: shmobile: Introduce shmobile_smp_cpu_disable() Simon Horman
  2013-10-01  2:35 ` [PATCH 02/14] ARM: shmobile: Use shmobile_smp_cpu_disable() on sh73a0 Simon Horman
@ 2013-10-01  2:35 ` Simon Horman
  2013-10-01  2:35 ` [PATCH 04/14] ARM: shmobile: Expose shmobile_invalidate_start() Simon Horman
                   ` (11 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Simon Horman @ 2013-10-01  2:35 UTC (permalink / raw)
  To: linux-arm-kernel

From: Magnus Damm <damm@opensource.se>

Remove shmobile_smp_init_cpus() since all SMP platforms in
mach-shmobile now rely on DT for CPU core description instead
of for instance determining number of cores from the SCU.

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 |  1 -
 arch/arm/mach-shmobile/platsmp.c             | 15 ---------------
 2 files changed, 16 deletions(-)

diff --git a/arch/arm/mach-shmobile/include/mach/common.h b/arch/arm/mach-shmobile/include/mach/common.h
index 1ed155e..26eaff1 100644
--- a/arch/arm/mach-shmobile/include/mach/common.h
+++ b/arch/arm/mach-shmobile/include/mach/common.h
@@ -40,7 +40,6 @@ static inline int shmobile_cpuidle_init(void) { return 0; }
 #endif
 
 extern void __iomem *shmobile_scu_base;
-extern void shmobile_smp_init_cpus(unsigned int ncores);
 
 static inline void __init shmobile_init_late(void)
 {
diff --git a/arch/arm/mach-shmobile/platsmp.c b/arch/arm/mach-shmobile/platsmp.c
index 3741562..9ebc246 100644
--- a/arch/arm/mach-shmobile/platsmp.c
+++ b/arch/arm/mach-shmobile/platsmp.c
@@ -11,25 +11,10 @@
  * published by the Free Software Foundation.
  */
 #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)
-{
-	unsigned int i;
-
-	if (ncores > nr_cpu_ids) {
-		pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
-			ncores, nr_cpu_ids);
-		ncores = nr_cpu_ids;
-	}
-
-	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[];
-- 
1.8.4


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 04/14] ARM: shmobile: Expose shmobile_invalidate_start()
  2013-10-01  2:35 [GIT PULL 00/14] Renesas ARM based SoC SMP updates for v3.13 Simon Horman
                   ` (2 preceding siblings ...)
  2013-10-01  2:35 ` [PATCH 03/14] ARM: shmobile: Remove unused shmobile_smp_init_cpus() Simon Horman
@ 2013-10-01  2:35 ` Simon Horman
  2013-10-01  2:35 ` [PATCH 05/14] ARM: shmobile: Introduce shmobile_boot_size Simon Horman
                   ` (10 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Simon Horman @ 2013-10-01  2:35 UTC (permalink / raw)
  To: linux-arm-kernel

From: Magnus Damm <damm@opensource.se>

Expose shmobile_invalidate_start() in common.h for
mach-shmobile. This function will be used for boot of
secondary processors on future non-SCU SMP platforms.

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 | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/mach-shmobile/include/mach/common.h b/arch/arm/mach-shmobile/include/mach/common.h
index 26eaff1..a9df8f3 100644
--- a/arch/arm/mach-shmobile/include/mach/common.h
+++ b/arch/arm/mach-shmobile/include/mach/common.h
@@ -14,6 +14,7 @@ extern void shmobile_smp_sleep(void);
 extern void shmobile_smp_hook(unsigned int cpu, unsigned long fn,
 			      unsigned long arg);
 extern int shmobile_smp_cpu_disable(unsigned int cpu);
+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,
-- 
1.8.4


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 05/14] ARM: shmobile: Introduce shmobile_boot_size
  2013-10-01  2:35 [GIT PULL 00/14] Renesas ARM based SoC SMP updates for v3.13 Simon Horman
                   ` (3 preceding siblings ...)
  2013-10-01  2:35 ` [PATCH 04/14] ARM: shmobile: Expose shmobile_invalidate_start() Simon Horman
@ 2013-10-01  2:35 ` Simon Horman
  2013-10-01  2:35 ` [PATCH 06/14] ARM: shmobile: Shared APMU SMP support code without DT Simon Horman
                   ` (9 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Simon Horman @ 2013-10-01  2:35 UTC (permalink / raw)
  To: linux-arm-kernel

From: Magnus Damm <damm@opensource.se>

Introduce shmobile_boot_size that can be used by
future SMP code to determine the size of the boot
code that needs to be copied to internal SRAM.

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
 arch/arm/mach-shmobile/headsmp.S             | 3 +++
 arch/arm/mach-shmobile/include/mach/common.h | 1 +
 2 files changed, 4 insertions(+)

diff --git a/arch/arm/mach-shmobile/headsmp.S b/arch/arm/mach-shmobile/headsmp.S
index f93751c..e5be5c8 100644
--- a/arch/arm/mach-shmobile/headsmp.S
+++ b/arch/arm/mach-shmobile/headsmp.S
@@ -40,6 +40,9 @@ shmobile_boot_fn:
 	.globl	shmobile_boot_arg
 shmobile_boot_arg:
 2:	.space	4
+	.globl	shmobile_boot_size
+shmobile_boot_size:
+	.long	. - shmobile_boot_vector
 
 /*
  * Per-CPU SMP boot function/argument selection code based on MPIDR
diff --git a/arch/arm/mach-shmobile/include/mach/common.h b/arch/arm/mach-shmobile/include/mach/common.h
index a9df8f3..cfe3977 100644
--- a/arch/arm/mach-shmobile/include/mach/common.h
+++ b/arch/arm/mach-shmobile/include/mach/common.h
@@ -9,6 +9,7 @@ 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 unsigned long shmobile_boot_size;
 extern void shmobile_smp_boot(void);
 extern void shmobile_smp_sleep(void);
 extern void shmobile_smp_hook(unsigned int cpu, unsigned long fn,
-- 
1.8.4


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 06/14] ARM: shmobile: Shared APMU SMP support code without DT
  2013-10-01  2:35 [GIT PULL 00/14] Renesas ARM based SoC SMP updates for v3.13 Simon Horman
                   ` (4 preceding siblings ...)
  2013-10-01  2:35 ` [PATCH 05/14] ARM: shmobile: Introduce shmobile_boot_size Simon Horman
@ 2013-10-01  2:35 ` Simon Horman
  2013-10-01  2:35 ` [PATCH 07/14] ARM: shmobile: Add r8a7790 SMP support using APMU code Simon Horman
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Simon Horman @ 2013-10-01  2:35 UTC (permalink / raw)
  To: linux-arm-kernel

From: Magnus Damm <damm@opensource.se>

Introduce shared APMU SMP code for mach-shmobile. Both SMP boot up
and CPU Hotplug is supported. This version does not use DT but
if needed this will be added as an incremental feature patch.

The code is designed around CONFIG_NR_CPUS and should in theory support
any number of APMUs, however due to the current DT-less static design
only a single APMU is supported.

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 |   6 +
 arch/arm/mach-shmobile/platsmp-apmu.c        | 178 +++++++++++++++++++++++++++
 2 files changed, 184 insertions(+)
 create mode 100644 arch/arm/mach-shmobile/platsmp-apmu.c

diff --git a/arch/arm/mach-shmobile/include/mach/common.h b/arch/arm/mach-shmobile/include/mach/common.h
index cfe3977..3460bb1 100644
--- a/arch/arm/mach-shmobile/include/mach/common.h
+++ b/arch/arm/mach-shmobile/include/mach/common.h
@@ -22,6 +22,12 @@ 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);
+extern int shmobile_smp_apmu_boot_secondary(unsigned int cpu,
+					    struct task_struct *idle);
+extern void shmobile_smp_apmu_cpu_die(unsigned int cpu);
+extern int shmobile_smp_apmu_cpu_kill(unsigned int cpu);
+extern void shmobile_invalidate_start(void);
 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-apmu.c b/arch/arm/mach-shmobile/platsmp-apmu.c
new file mode 100644
index 0000000..34dc40d
--- /dev/null
+++ b/arch/arm/mach-shmobile/platsmp-apmu.c
@@ -0,0 +1,178 @@
+/*
+ * SMP support for SoCs with APMU
+ *
+ * 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/delay.h>
+#include <linux/init.h>
+#include <linux/io.h>
+#include <linux/ioport.h>
+#include <linux/of_address.h>
+#include <linux/smp.h>
+#include <asm/cacheflush.h>
+#include <asm/cp15.h>
+#include <asm/smp_plat.h>
+#include <mach/common.h>
+
+static struct {
+	void __iomem *iomem;
+	int bit;
+} apmu_cpus[CONFIG_NR_CPUS];
+
+#define WUPCR_OFFS 0x10
+#define PSTR_OFFS 0x40
+#define CPUNCR_OFFS(n) (0x100 + (0x10 * (n)))
+
+static int apmu_power_on(void __iomem *p, int bit)
+{
+	/* request power on */
+	writel_relaxed(BIT(bit), p + WUPCR_OFFS);
+
+	/* wait for APMU to finish */
+	while (readl_relaxed(p + WUPCR_OFFS) != 0)
+		;
+
+	return 0;
+}
+
+static int apmu_power_off(void __iomem *p, int bit)
+{
+	/* request Core Standby for next WFI */
+	writel_relaxed(3, p + CPUNCR_OFFS(bit));
+	return 0;
+}
+
+static int apmu_power_off_poll(void __iomem *p, int bit)
+{
+	int k;
+
+	for (k = 0; k < 1000; k++) {
+		if (((readl_relaxed(p + PSTR_OFFS) >> (bit * 4)) & 0x03) = 3)
+			return 1;
+
+		mdelay(1);
+	}
+
+	return 0;
+}
+
+static int apmu_wrap(int cpu, int (*fn)(void __iomem *p, int cpu))
+{
+	void __iomem *p = apmu_cpus[cpu].iomem;
+
+	return p ? fn(p, apmu_cpus[cpu].bit) : -EINVAL;
+}
+
+static void apmu_init_cpu(struct resource *res, int cpu, int bit)
+{
+	if (apmu_cpus[cpu].iomem)
+		return;
+
+	apmu_cpus[cpu].iomem = ioremap_nocache(res->start, resource_size(res));
+	apmu_cpus[cpu].bit = bit;
+
+	pr_debug("apmu ioremap %d %d 0x%08x 0x%08x\n", cpu, bit,
+		 res->start, resource_size(res));
+}
+
+static struct {
+	struct resource iomem;
+	int cpus[4];
+} apmu_config[] = {
+	{
+		.iomem = DEFINE_RES_MEM(0xe6152000, 0x88),
+		.cpus = { 0, 1, 2, 3 },
+	}
+};
+
+static void apmu_parse_cfg(void (*fn)(struct resource *res, int cpu, int bit))
+{
+	u32 id;
+	int k;
+	int bit, index;
+
+	for (k = 0; k < ARRAY_SIZE(apmu_config); k++) {
+		for (bit = 0; bit < ARRAY_SIZE(apmu_config[k].cpus); bit++) {
+			id = apmu_config[k].cpus[bit];
+			if (id >= 0) {
+				index = get_logical_index(id);
+				if (index >= 0)
+					fn(&apmu_config[k].iomem, index, bit);
+			}
+		}
+	}
+}
+
+void __init shmobile_smp_apmu_prepare_cpus(unsigned int max_cpus)
+{
+	/* install boot code shared by all CPUs */
+	shmobile_boot_fn = virt_to_phys(shmobile_smp_boot);
+	shmobile_boot_arg = MPIDR_HWID_BITMASK;
+
+	/* perform per-cpu setup */
+	apmu_parse_cfg(apmu_init_cpu);
+}
+
+int shmobile_smp_apmu_boot_secondary(unsigned int cpu, struct task_struct *idle)
+{
+	/* For this particular CPU register boot vector */
+	shmobile_smp_hook(cpu, virt_to_phys(shmobile_invalidate_start), 0);
+
+	return apmu_wrap(cpu, apmu_power_on);
+}
+
+#ifdef CONFIG_HOTPLUG_CPU
+/* nicked from arch/arm/mach-exynos/hotplug.c */
+static inline void cpu_enter_lowpower_a15(void)
+{
+	unsigned int v;
+
+	asm volatile(
+	"       mrc     p15, 0, %0, c1, c0, 0\n"
+	"       bic     %0, %0, %1\n"
+	"       mcr     p15, 0, %0, c1, c0, 0\n"
+		: "=&r" (v)
+		: "Ir" (CR_C)
+		: "cc");
+
+	flush_cache_louis();
+
+	asm volatile(
+	/*
+	 * Turn off coherency
+	 */
+	"       mrc     p15, 0, %0, c1, c0, 1\n"
+	"       bic     %0, %0, %1\n"
+	"       mcr     p15, 0, %0, c1, c0, 1\n"
+		: "=&r" (v)
+		: "Ir" (0x40)
+		: "cc");
+
+	isb();
+	dsb();
+}
+
+void shmobile_smp_apmu_cpu_die(unsigned int cpu)
+{
+	/* For this particular CPU deregister boot vector */
+	shmobile_smp_hook(cpu, 0, 0);
+
+	/* Select next sleep mode using the APMU */
+	apmu_wrap(cpu, apmu_power_off);
+
+	/* Do ARM specific CPU shutdown */
+	cpu_enter_lowpower_a15();
+
+	/* jump to shared mach-shmobile sleep / reset code */
+	shmobile_smp_sleep();
+}
+
+int shmobile_smp_apmu_cpu_kill(unsigned int cpu)
+{
+	return apmu_wrap(cpu, apmu_power_off_poll);
+}
+#endif
-- 
1.8.4


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 07/14] ARM: shmobile: Add r8a7790 SMP support using APMU code
  2013-10-01  2:35 [GIT PULL 00/14] Renesas ARM based SoC SMP updates for v3.13 Simon Horman
                   ` (5 preceding siblings ...)
  2013-10-01  2:35 ` [PATCH 06/14] ARM: shmobile: Shared APMU SMP support code without DT Simon Horman
@ 2013-10-01  2:35 ` Simon Horman
  2013-10-01  2:35 ` [PATCH 08/14] ARM: shmobile: Add CPU notifier based SCU boot vector code Simon Horman
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Simon Horman @ 2013-10-01  2:35 UTC (permalink / raw)
  To: linux-arm-kernel

From: Magnus Damm <damm@opensource.se>

Add r8a7790 SMP support using the shared APMU code. To enable
SMP the r8a7790 specific DTS needs to be updated to include
CPU cores, and this is happening in a separate patch.

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
 arch/arm/mach-shmobile/Makefile                |  1 +
 arch/arm/mach-shmobile/board-lager-reference.c |  1 +
 arch/arm/mach-shmobile/board-lager.c           |  1 +
 arch/arm/mach-shmobile/include/mach/r8a7790.h  |  1 +
 arch/arm/mach-shmobile/setup-r8a7790.c         |  1 +
 arch/arm/mach-shmobile/smp-r8a7790.c           | 67 ++++++++++++++++++++++++++
 6 files changed, 72 insertions(+)
 create mode 100644 arch/arm/mach-shmobile/smp-r8a7790.c

diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile
index 2705bfa..381fc97 100644
--- a/arch/arm/mach-shmobile/Makefile
+++ b/arch/arm/mach-shmobile/Makefile
@@ -34,6 +34,7 @@ endif
 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_R8A7790)	+= smp-r8a7790.o platsmp-apmu.o
 smp-$(CONFIG_ARCH_EMEV2)	+= smp-emev2.o headsmp-scu.o platsmp-scu.o
 
 # IRQ objects
diff --git a/arch/arm/mach-shmobile/board-lager-reference.c b/arch/arm/mach-shmobile/board-lager-reference.c
index 2856f51..d39a91b 100644
--- a/arch/arm/mach-shmobile/board-lager-reference.c
+++ b/arch/arm/mach-shmobile/board-lager-reference.c
@@ -38,6 +38,7 @@ static const char *lager_boards_compat_dt[] __initdata = {
 };
 
 DT_MACHINE_START(LAGER_DT, "lager")
+	.smp		= smp_ops(r8a7790_smp_ops),
 	.init_early	= r8a7790_init_early,
 	.init_machine	= lager_add_standard_devices,
 	.init_time	= r8a7790_timer_init,
diff --git a/arch/arm/mach-shmobile/board-lager.c b/arch/arm/mach-shmobile/board-lager.c
index 4047fac..ef3baaa 100644
--- a/arch/arm/mach-shmobile/board-lager.c
+++ b/arch/arm/mach-shmobile/board-lager.c
@@ -161,6 +161,7 @@ static const char *lager_boards_compat_dt[] __initdata = {
 };
 
 DT_MACHINE_START(LAGER_DT, "lager")
+	.smp		= smp_ops(r8a7790_smp_ops),
 	.init_early	= r8a7790_init_early,
 	.init_time	= r8a7790_timer_init,
 	.init_machine	= lager_add_standard_devices,
diff --git a/arch/arm/mach-shmobile/include/mach/r8a7790.h b/arch/arm/mach-shmobile/include/mach/r8a7790.h
index 177a837..79e731c 100644
--- a/arch/arm/mach-shmobile/include/mach/r8a7790.h
+++ b/arch/arm/mach-shmobile/include/mach/r8a7790.h
@@ -7,6 +7,7 @@ void r8a7790_clock_init(void);
 void r8a7790_pinmux_init(void);
 void r8a7790_init_early(void);
 void r8a7790_timer_init(void);
+extern struct smp_operations r8a7790_smp_ops;
 
 #define MD(nr) BIT(nr)
 u32 r8a7790_read_mode_pins(void);
diff --git a/arch/arm/mach-shmobile/setup-r8a7790.c b/arch/arm/mach-shmobile/setup-r8a7790.c
index e0d29a2..c7e24ef 100644
--- a/arch/arm/mach-shmobile/setup-r8a7790.c
+++ b/arch/arm/mach-shmobile/setup-r8a7790.c
@@ -283,6 +283,7 @@ static const char * const r8a7790_boards_compat_dt[] __initconst = {
 };
 
 DT_MACHINE_START(R8A7790_DT, "Generic R8A7790 (Flattened Device Tree)")
+	.smp		= smp_ops(r8a7790_smp_ops),
 	.init_early	= r8a7790_init_early,
 	.init_time	= r8a7790_timer_init,
 	.dt_compat	= r8a7790_boards_compat_dt,
diff --git a/arch/arm/mach-shmobile/smp-r8a7790.c b/arch/arm/mach-shmobile/smp-r8a7790.c
new file mode 100644
index 0000000..015e275
--- /dev/null
+++ b/arch/arm/mach-shmobile/smp-r8a7790.c
@@ -0,0 +1,67 @@
+/*
+ * SMP support for r8a7790
+ *
+ * Copyright (C) 2012-2013 Renesas Solutions Corp.
+ * Copyright (C) 2012 Takashi Yoshii <takashi.yoshii.ze@renesas.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/smp.h>
+#include <linux/io.h>
+#include <asm/smp_plat.h>
+#include <mach/common.h>
+
+#define RST		0xe6160000
+#define CA15BAR		0x0020
+#define CA7BAR		0x0030
+#define CA15RESCNT	0x0040
+#define CA7RESCNT	0x0044
+#define MERAM		0xe8080000
+
+static void __init r8a7790_smp_prepare_cpus(unsigned int max_cpus)
+{
+	void __iomem *p;
+	u32 bar;
+
+	/* let APMU code install data related to shmobile_boot_vector */
+	shmobile_smp_apmu_prepare_cpus(max_cpus);
+
+	/* MERAM for jump stub, because BAR requires 256KB aligned address */
+	p = ioremap_nocache(MERAM, shmobile_boot_size);
+	memcpy_toio(p, shmobile_boot_vector, shmobile_boot_size);
+	iounmap(p);
+
+	/* setup reset vectors */
+	p = ioremap_nocache(RST, 0x63);
+	bar = (MERAM >> 8) & 0xfffffc00;
+	writel_relaxed(bar, p + CA15BAR);
+	writel_relaxed(bar, p + CA7BAR);
+	writel_relaxed(bar | 0x10, p + CA15BAR);
+	writel_relaxed(bar | 0x10, p + CA7BAR);
+
+	/* enable clocks to all CPUs */
+	writel_relaxed((readl_relaxed(p + CA15RESCNT) & ~0x0f) | 0xa5a50000,
+		       p + CA15RESCNT);
+	writel_relaxed((readl_relaxed(p + CA7RESCNT) & ~0x0f) | 0x5a5a0000,
+		       p + CA7RESCNT);
+	iounmap(p);
+}
+
+struct smp_operations r8a7790_smp_ops __initdata = {
+	.smp_prepare_cpus	= r8a7790_smp_prepare_cpus,
+	.smp_boot_secondary	= shmobile_smp_apmu_boot_secondary,
+#ifdef CONFIG_HOTPLUG_CPU
+	.cpu_disable		= shmobile_smp_cpu_disable,
+	.cpu_die		= shmobile_smp_apmu_cpu_die,
+	.cpu_kill		= shmobile_smp_apmu_cpu_kill,
+#endif
+};
-- 
1.8.4


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 08/14] ARM: shmobile: Add CPU notifier based SCU boot vector code
  2013-10-01  2:35 [GIT PULL 00/14] Renesas ARM based SoC SMP updates for v3.13 Simon Horman
                   ` (6 preceding siblings ...)
  2013-10-01  2:35 ` [PATCH 07/14] ARM: shmobile: Add r8a7790 SMP support using APMU code Simon Horman
@ 2013-10-01  2:35 ` Simon Horman
  2013-10-01  2:35 ` [PATCH 09/14] ARM: shmobile: Let sh73a0 rely on SCU CPU notifier Simon Horman
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Simon Horman @ 2013-10-01  2:35 UTC (permalink / raw)
  To: linux-arm-kernel

From: Magnus Damm <damm@opensource.se>

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.

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 | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/arch/arm/mach-shmobile/platsmp-scu.c b/arch/arm/mach-shmobile/platsmp-scu.c
index c96f501..49ae8df 100644
--- a/arch/arm/mach-shmobile/platsmp-scu.c
+++ b/arch/arm/mach-shmobile/platsmp-scu.c
@@ -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_cpus(unsigned int max_cpus)
 	/* 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)
-- 
1.8.4


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 09/14] ARM: shmobile: Let sh73a0 rely on SCU CPU notifier
  2013-10-01  2:35 [GIT PULL 00/14] Renesas ARM based SoC SMP updates for v3.13 Simon Horman
                   ` (7 preceding siblings ...)
  2013-10-01  2:35 ` [PATCH 08/14] ARM: shmobile: Add CPU notifier based SCU boot vector code Simon Horman
@ 2013-10-01  2:35 ` Simon Horman
  2013-10-01  2:35 ` [PATCH 10/14] ARM: shmobile: Let EMEV2 " Simon Horman
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Simon Horman @ 2013-10-01  2:35 UTC (permalink / raw)
  To: linux-arm-kernel

From: Magnus Damm <damm@opensource.se>

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

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 | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/arch/arm/mach-shmobile/smp-sh73a0.c b/arch/arm/mach-shmobile/smp-sh73a0.c
index 9a30a3f..13ba36a 100644
--- a/arch/arm/mach-shmobile/smp-sh73a0.c
+++ b/arch/arm/mach-shmobile/smp-sh73a0.c
@@ -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 */
-- 
1.8.4


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 10/14] ARM: shmobile: Let EMEV2 rely on SCU CPU notifier
  2013-10-01  2:35 [GIT PULL 00/14] Renesas ARM based SoC SMP updates for v3.13 Simon Horman
                   ` (8 preceding siblings ...)
  2013-10-01  2:35 ` [PATCH 09/14] ARM: shmobile: Let sh73a0 rely on SCU CPU notifier Simon Horman
@ 2013-10-01  2:35 ` Simon Horman
  2013-10-01  2:35 ` [PATCH 11/14] ARM: shmobile: Let r8a7779 " Simon Horman
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Simon Horman @ 2013-10-01  2:35 UTC (permalink / raw)
  To: linux-arm-kernel

From: Magnus Damm <damm@opensource.se>

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

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
 arch/arm/mach-shmobile/smp-emev2.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/arch/arm/mach-shmobile/smp-emev2.c b/arch/arm/mach-shmobile/smp-emev2.c
index 522de5e..f2ca923 100644
--- a/arch/arm/mach-shmobile/smp-emev2.c
+++ b/arch/arm/mach-shmobile/smp-emev2.c
@@ -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;
 }
-- 
1.8.4


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 11/14] ARM: shmobile: Let r8a7779 rely on SCU CPU notifier
  2013-10-01  2:35 [GIT PULL 00/14] Renesas ARM based SoC SMP updates for v3.13 Simon Horman
                   ` (9 preceding siblings ...)
  2013-10-01  2:35 ` [PATCH 10/14] ARM: shmobile: Let EMEV2 " Simon Horman
@ 2013-10-01  2:35 ` Simon Horman
  2013-10-01  2:35 ` [PATCH 12/14] ARM: shmobile: Remove shmobile_smp_scu_boot_secondary() Simon Horman
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Simon Horman @ 2013-10-01  2:35 UTC (permalink / raw)
  To: linux-arm-kernel

From: Magnus Damm <damm@opensource.se>

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

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 | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/arch/arm/mach-shmobile/smp-r8a7779.c b/arch/arm/mach-shmobile/smp-r8a7779.c
index 0f05e9f..627c1f0 100644
--- a/arch/arm/mach-shmobile/smp-r8a7779.c
+++ b/arch/arm/mach-shmobile/smp-r8a7779.c
@@ -87,10 +87,6 @@ static int r8a7779_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 (lcpu < ARRAY_SIZE(r8a7779_ch_cpu))
 		ch = r8a7779_ch_cpu[lcpu];
 
-- 
1.8.4


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 12/14] ARM: shmobile: Remove shmobile_smp_scu_boot_secondary()
  2013-10-01  2:35 [GIT PULL 00/14] Renesas ARM based SoC SMP updates for v3.13 Simon Horman
                   ` (10 preceding siblings ...)
  2013-10-01  2:35 ` [PATCH 11/14] ARM: shmobile: Let r8a7779 " Simon Horman
@ 2013-10-01  2:35 ` Simon Horman
  2013-10-01  2:35 ` [PATCH 13/14] ARM: shmobile: Extend APMU code to allow single cluster only Simon Horman
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Simon Horman @ 2013-10-01  2:35 UTC (permalink / raw)
  To: linux-arm-kernel

From: Magnus Damm <damm@opensource.se>

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

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         | 8 --------
 2 files changed, 10 deletions(-)

diff --git a/arch/arm/mach-shmobile/include/mach/common.h b/arch/arm/mach-shmobile/include/mach/common.h
index 3460bb1..e319805 100644
--- a/arch/arm/mach-shmobile/include/mach/common.h
+++ b/arch/arm/mach-shmobile/include/mach/common.h
@@ -18,8 +18,6 @@ extern int shmobile_smp_cpu_disable(unsigned int cpu);
 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);
diff --git a/arch/arm/mach-shmobile/platsmp-scu.c b/arch/arm/mach-shmobile/platsmp-scu.c
index 49ae8df..673ad6e 100644
--- a/arch/arm/mach-shmobile/platsmp-scu.c
+++ b/arch/arm/mach-shmobile/platsmp-scu.c
@@ -51,14 +51,6 @@ void __init shmobile_smp_scu_prepare_cpus(unsigned int max_cpus)
 	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)
 {
-- 
1.8.4


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 13/14] ARM: shmobile: Extend APMU code to allow single cluster only
  2013-10-01  2:35 [GIT PULL 00/14] Renesas ARM based SoC SMP updates for v3.13 Simon Horman
                   ` (11 preceding siblings ...)
  2013-10-01  2:35 ` [PATCH 12/14] ARM: shmobile: Remove shmobile_smp_scu_boot_secondary() Simon Horman
@ 2013-10-01  2:35 ` Simon Horman
  2013-10-01  2:35 ` [PATCH 14/14] ARM: shmobile: Include CA7 cores in APMU table Simon Horman
  2013-10-07 18:33 ` [GIT PULL 00/14] Renesas ARM based SoC SMP updates for v3.13 Olof Johansson
  14 siblings, 0 replies; 16+ messages in thread
From: Simon Horman @ 2013-10-01  2:35 UTC (permalink / raw)
  To: linux-arm-kernel

From: Magnus Damm <damm@opensource.se>

Extend the APMU code with a check to only allow boot
of CPU cores that sit in the same cluster as CPU0.

This makes it possible for people to use the r8a790
CA7 boot mode with CA7-cores only. The default CA15
boot mode will enable CA15 cores only. This is an
intentional software limitation to cope with lacking
scheduler support.

By removing this patch it is possible to run all 8 cores
in parallel, but this is not recommended without out of tree
scheduler modfications or custom user space code to control
the CPU affinitiy.

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
 arch/arm/mach-shmobile/platsmp-apmu.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/arch/arm/mach-shmobile/platsmp-apmu.c b/arch/arm/mach-shmobile/platsmp-apmu.c
index 34dc40d..caaaa35 100644
--- a/arch/arm/mach-shmobile/platsmp-apmu.c
+++ b/arch/arm/mach-shmobile/platsmp-apmu.c
@@ -94,8 +94,21 @@ static void apmu_parse_cfg(void (*fn)(struct resource *res, int cpu, int bit))
 	u32 id;
 	int k;
 	int bit, index;
+	bool is_allowed;
 
 	for (k = 0; k < ARRAY_SIZE(apmu_config); k++) {
+		/* only enable the cluster that includes the boot CPU */
+		is_allowed = false;
+		for (bit = 0; bit < ARRAY_SIZE(apmu_config[k].cpus); bit++) {
+			id = apmu_config[k].cpus[bit];
+			if (id >= 0) {
+				if (id = cpu_logical_map(0))
+					is_allowed = true;
+			}
+		}
+		if (!is_allowed)
+			continue;
+
 		for (bit = 0; bit < ARRAY_SIZE(apmu_config[k].cpus); bit++) {
 			id = apmu_config[k].cpus[bit];
 			if (id >= 0) {
-- 
1.8.4


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 14/14] ARM: shmobile: Include CA7 cores in APMU table
  2013-10-01  2:35 [GIT PULL 00/14] Renesas ARM based SoC SMP updates for v3.13 Simon Horman
                   ` (12 preceding siblings ...)
  2013-10-01  2:35 ` [PATCH 13/14] ARM: shmobile: Extend APMU code to allow single cluster only Simon Horman
@ 2013-10-01  2:35 ` Simon Horman
  2013-10-07 18:33 ` [GIT PULL 00/14] Renesas ARM based SoC SMP updates for v3.13 Olof Johansson
  14 siblings, 0 replies; 16+ messages in thread
From: Simon Horman @ 2013-10-01  2:35 UTC (permalink / raw)
  To: linux-arm-kernel

From: Magnus Damm <damm@opensource.se>

Add information to the shared APMU code regarding
the APMU instance used to control the CA7 cores.

This can be used on r8a7790 and r8a73a4, but should
most likely be converted to DT in the future.

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
 arch/arm/mach-shmobile/platsmp-apmu.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/mach-shmobile/platsmp-apmu.c b/arch/arm/mach-shmobile/platsmp-apmu.c
index caaaa35..1da5a72 100644
--- a/arch/arm/mach-shmobile/platsmp-apmu.c
+++ b/arch/arm/mach-shmobile/platsmp-apmu.c
@@ -86,6 +86,10 @@ static struct {
 	{
 		.iomem = DEFINE_RES_MEM(0xe6152000, 0x88),
 		.cpus = { 0, 1, 2, 3 },
+	},
+	{
+		.iomem = DEFINE_RES_MEM(0xe6151000, 0x88),
+		.cpus = { 0x100, 0x101, 0x102, 0x103 },
 	}
 };
 
-- 
1.8.4


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [GIT PULL 00/14] Renesas ARM based SoC SMP updates for v3.13
  2013-10-01  2:35 [GIT PULL 00/14] Renesas ARM based SoC SMP updates for v3.13 Simon Horman
                   ` (13 preceding siblings ...)
  2013-10-01  2:35 ` [PATCH 14/14] ARM: shmobile: Include CA7 cores in APMU table Simon Horman
@ 2013-10-07 18:33 ` Olof Johansson
  14 siblings, 0 replies; 16+ messages in thread
From: Olof Johansson @ 2013-10-07 18:33 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Oct 01, 2013 at 11:35:35AM +0900, Simon Horman wrote:
> Hi Kevin, Olof and Arnd,
> 
> please consider these Renesas ARM based SoC SMP updates for v3.13.
> 
> This pull-request is based on renesas-cleanups-v3.13 which
> I has also sent a pull-request for today. The reason for choosing
> that base is to reduce conflicts.
> 
> 
> The following changes since commit cde214a890f81797a5eee94fffc89c1de21ed991:
> 
>   ARM: shmobile: r8a7790: Constify platform data and resources (2013-09-19 14:33:44 -0700)
> 
> are available in the git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas.git tags/renesas-smp-for-v3.13

Thanks, merged.


-Olof

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2013-10-07 18:33 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-01  2:35 [GIT PULL 00/14] Renesas ARM based SoC SMP updates for v3.13 Simon Horman
2013-10-01  2:35 ` [PATCH 01/14] ARM: shmobile: Introduce shmobile_smp_cpu_disable() Simon Horman
2013-10-01  2:35 ` [PATCH 02/14] ARM: shmobile: Use shmobile_smp_cpu_disable() on sh73a0 Simon Horman
2013-10-01  2:35 ` [PATCH 03/14] ARM: shmobile: Remove unused shmobile_smp_init_cpus() Simon Horman
2013-10-01  2:35 ` [PATCH 04/14] ARM: shmobile: Expose shmobile_invalidate_start() Simon Horman
2013-10-01  2:35 ` [PATCH 05/14] ARM: shmobile: Introduce shmobile_boot_size Simon Horman
2013-10-01  2:35 ` [PATCH 06/14] ARM: shmobile: Shared APMU SMP support code without DT Simon Horman
2013-10-01  2:35 ` [PATCH 07/14] ARM: shmobile: Add r8a7790 SMP support using APMU code Simon Horman
2013-10-01  2:35 ` [PATCH 08/14] ARM: shmobile: Add CPU notifier based SCU boot vector code Simon Horman
2013-10-01  2:35 ` [PATCH 09/14] ARM: shmobile: Let sh73a0 rely on SCU CPU notifier Simon Horman
2013-10-01  2:35 ` [PATCH 10/14] ARM: shmobile: Let EMEV2 " Simon Horman
2013-10-01  2:35 ` [PATCH 11/14] ARM: shmobile: Let r8a7779 " Simon Horman
2013-10-01  2:35 ` [PATCH 12/14] ARM: shmobile: Remove shmobile_smp_scu_boot_secondary() Simon Horman
2013-10-01  2:35 ` [PATCH 13/14] ARM: shmobile: Extend APMU code to allow single cluster only Simon Horman
2013-10-01  2:35 ` [PATCH 14/14] ARM: shmobile: Include CA7 cores in APMU table Simon Horman
2013-10-07 18:33 ` [GIT PULL 00/14] Renesas ARM based SoC SMP updates for v3.13 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).