linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 0/3] Per SoC descriptor
@ 2011-09-08 17:00 Marc Zyngier
  2011-09-08 17:00 ` [RFC PATCH 1/3] ARM: SoC: Introduce per " Marc Zyngier
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Marc Zyngier @ 2011-09-08 17:00 UTC (permalink / raw)
  To: linux-arm-kernel

This is my first stab at an idea that has floated around for a while,
which is to have a per-soc descriptor containing most of the SoC
specific operations, which should clear the path a bit more towards
the single zImage holy grail. It's as far as possible from being
perfect, but I thought I'd share it as early as possible and see what
people think of it.

This first patch series introduces the arm_soc_desc structure, adds
per-soc SMP and CPU hotplug operations, and converts both RealView and
VExpress to this new scheme.

There's a number of things I'm happy with yet in that patch series:
- the per-soc descriptor init is ugly
- all descriptors are kept around forever

I plan to address those in the future (if this patch series has any!).

It's been tested on VExpress (A5 and A15) and RealView EB-11MP.

Marc Zyngier (3):
  ARM: SoC: Introduce per SoC descriptor
  ARM: SoC: Add per SoC SMP and CPU hotplug operations
  ARM: SoC: convert VExpress/RealView to SoC descriptor

 arch/arm/include/asm/mach/arch.h               |    2 +
 arch/arm/include/asm/soc.h                     |   38 +++++++++++++++++++
 arch/arm/kernel/setup.c                        |    5 ++
 arch/arm/kernel/smp.c                          |   48 ++++++++++++++++++++++++
 arch/arm/mach-realview/core.c                  |   19 +++++++++
 arch/arm/mach-realview/core.h                  |    9 ++++
 arch/arm/mach-realview/hotplug.c               |    6 +-
 arch/arm/mach-realview/platsmp.c               |    4 +-
 arch/arm/mach-realview/realview_eb.c           |    1 +
 arch/arm/mach-realview/realview_pb1176.c       |    1 +
 arch/arm/mach-realview/realview_pb11mp.c       |    1 +
 arch/arm/mach-realview/realview_pba8.c         |    1 +
 arch/arm/mach-realview/realview_pbx.c          |    1 +
 arch/arm/mach-vexpress/core.h                  |    6 +++
 arch/arm/mach-vexpress/hotplug.c               |    6 +-
 arch/arm/mach-vexpress/platsmp.c               |    4 +-
 arch/arm/mach-vexpress/v2m.c                   |   20 ++++++++++
 arch/arm/plat-versatile/include/plat/platsmp.h |   13 ++++++
 arch/arm/plat-versatile/platsmp.c              |    4 +-
 19 files changed, 177 insertions(+), 12 deletions(-)
 create mode 100644 arch/arm/include/asm/soc.h
 create mode 100644 arch/arm/plat-versatile/include/plat/platsmp.h

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

* [RFC PATCH 1/3] ARM: SoC: Introduce per SoC descriptor
  2011-09-08 17:00 [RFC PATCH 0/3] Per SoC descriptor Marc Zyngier
@ 2011-09-08 17:00 ` Marc Zyngier
  2011-09-08 17:00 ` [RFC PATCH 2/3] ARM: SoC: Add per SoC SMP and CPU hotplug operations Marc Zyngier
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Marc Zyngier @ 2011-09-08 17:00 UTC (permalink / raw)
  To: linux-arm-kernel

The ARM core code expects the various SoCs to hide their
implementation differences behind a well established API.
The various sub-arch-specific bit are often either at
the machine descriptor level, or provided at link time
by the sub-arch code.

The SoC descriptor is a container that holds the SoC
specific bits that can be moved away from the machine
descriptor as well as an indirection point for the
global symbols (SMP and CPU hotplug support, for example).

This patch introduce this SoC descriptor, with the only field
being the name of the SoC.

Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
 arch/arm/include/asm/mach/arch.h |    2 ++
 arch/arm/include/asm/soc.h       |   21 +++++++++++++++++++++
 arch/arm/kernel/setup.c          |    5 +++++
 3 files changed, 28 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/include/asm/soc.h

diff --git a/arch/arm/include/asm/mach/arch.h b/arch/arm/include/asm/mach/arch.h
index 727da11..82883ca 100644
--- a/arch/arm/include/asm/mach/arch.h
+++ b/arch/arm/include/asm/mach/arch.h
@@ -13,6 +13,7 @@
 struct tag;
 struct meminfo;
 struct sys_timer;
+struct arm_soc_desc;
 
 struct machine_desc {
 	unsigned int		nr;		/* architecture number	*/
@@ -34,6 +35,7 @@ struct machine_desc {
 	unsigned int		reserve_lp1 :1;	/* never has lp1	*/
 	unsigned int		reserve_lp2 :1;	/* never has lp2	*/
 	unsigned int		soft_reboot :1;	/* soft reboot		*/
+	struct arm_soc_desc	*soc;		/* SoC descriptor	*/
 	void			(*fixup)(struct machine_desc *,
 					 struct tag *, char **,
 					 struct meminfo *);
diff --git a/arch/arm/include/asm/soc.h b/arch/arm/include/asm/soc.h
new file mode 100644
index 0000000..d9a6671
--- /dev/null
+++ b/arch/arm/include/asm/soc.h
@@ -0,0 +1,21 @@
+/*
+ *  linux/arch/arm/include/asm/soc.h
+ *
+ *  Copyright (C) 2011 ARM Ltd.
+ *  All Rights Reserved
+ *
+ * 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.
+ */
+
+#ifndef __ASM_ARM_SOC_H
+#define __ASM_ARM_SOC_H
+
+struct arm_soc_desc {
+	const char		*name;
+};
+
+extern struct arm_soc_desc	*soc_desc;
+
+#endif	/* __ASM_ARM_SOC_H */
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 192a24f..2d25835 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -45,6 +45,7 @@
 #include <asm/cachetype.h>
 #include <asm/tlbflush.h>
 #include <asm/system.h>
+#include <asm/soc.h>
 
 #include <asm/prom.h>
 #include <asm/mach/arch.h>
@@ -140,6 +141,7 @@ static const char *cpu_name;
 static const char *machine_name;
 static char __initdata cmd_line[COMMAND_LINE_SIZE];
 struct machine_desc *machine_desc __initdata;
+struct arm_soc_desc *soc_desc;
 
 static char default_command_line[COMMAND_LINE_SIZE] __initdata = CONFIG_CMDLINE;
 static union { char c[4]; unsigned long l; } endian_test __initdata = { { 'l', '?', '?', 'b' } };
@@ -909,6 +911,9 @@ void __init setup_arch(char **cmdline_p)
 		mdesc = setup_machine_tags(machine_arch_type);
 	machine_desc = mdesc;
 	machine_name = mdesc->name;
+	soc_desc = mdesc->soc;
+	if (soc_desc && soc_desc->name)
+		pr_info("SoC: %s\n", soc_desc->name);
 
 	if (mdesc->soft_reboot)
 		reboot_setup("s");
-- 
1.7.0.4

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

* [RFC PATCH 2/3] ARM: SoC: Add per SoC SMP and CPU hotplug operations
  2011-09-08 17:00 [RFC PATCH 0/3] Per SoC descriptor Marc Zyngier
  2011-09-08 17:00 ` [RFC PATCH 1/3] ARM: SoC: Introduce per " Marc Zyngier
@ 2011-09-08 17:00 ` Marc Zyngier
  2011-09-08 20:23   ` Arnd Bergmann
  2011-09-08 17:00 ` [RFC PATCH 3/3] ARM: SoC: convert VExpress/RealView to SoC descriptor Marc Zyngier
  2011-09-08 20:18 ` [RFC PATCH 0/3] Per " Arnd Bergmann
  3 siblings, 1 reply; 7+ messages in thread
From: Marc Zyngier @ 2011-09-08 17:00 UTC (permalink / raw)
  To: linux-arm-kernel

Populate the SoC descriptor structure with the SMP and CPU hotplug
operations. To allow the kernel to continue building, the platform
hooks are defined as weak symbols which are overrided by the
platform code. Once all platforms are converted, the "weak" attribute
will be removed and the function made static.

Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
 arch/arm/include/asm/soc.h |   17 +++++++++++++++
 arch/arm/kernel/smp.c      |   48 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 65 insertions(+), 0 deletions(-)

diff --git a/arch/arm/include/asm/soc.h b/arch/arm/include/asm/soc.h
index d9a6671..caaedf9 100644
--- a/arch/arm/include/asm/soc.h
+++ b/arch/arm/include/asm/soc.h
@@ -12,8 +12,25 @@
 #ifndef __ASM_ARM_SOC_H
 #define __ASM_ARM_SOC_H
 
+struct task_struct;
+
+struct arm_soc_smp_ops {
+	void (*smp_init_cpus)(void);
+	void (*smp_prepare_cpus)(unsigned int max_cpus);
+	void (*smp_secondary_init)(unsigned int cpu);
+	int  (*smp_boot_secondary)(unsigned int cpu, struct task_struct *idle);
+#ifdef CONFIG_HOTPLUG_CPU
+	int  (*cpu_kill)(unsigned int cpu);
+	void (*cpu_die)(unsigned int cpu);
+	int  (*cpu_disable)(unsigned int cpu);
+#endif
+};
+
 struct arm_soc_desc {
 	const char		*name;
+#ifdef CONFIG_SMP
+	struct arm_soc_smp_ops	smp_ops;
+#endif
 };
 
 extern struct arm_soc_desc	*soc_desc;
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index faa524b..3f17a93 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -28,6 +28,7 @@
 #include <linux/completion.h>
 
 #include <linux/atomic.h>
+#include <asm/soc.h>
 #include <asm/cacheflush.h>
 #include <asm/cpu.h>
 #include <asm/cputype.h>
@@ -154,7 +155,54 @@ int __cpuinit __cpu_up(unsigned int cpu)
 	return ret;
 }
 
+/* SoC helpers */
+void __attribute__((weak)) smp_init_cpus(void)
+{
+	if (soc_desc->smp_ops.smp_init_cpus)
+		soc_desc->smp_ops.smp_init_cpus();
+}
+
+void __attribute__((weak)) platform_smp_prepare_cpus(unsigned int max_cpus)
+{
+	if (soc_desc->smp_ops.smp_prepare_cpus)
+		soc_desc->smp_ops.smp_prepare_cpus(max_cpus);
+}
+
+void __attribute__((weak)) platform_secondary_init(unsigned int cpu)
+{
+	if (soc_desc->smp_ops.smp_secondary_init)
+		soc_desc->smp_ops.smp_secondary_init(cpu);
+}
+
+int __attribute__((weak)) boot_secondary(unsigned int cpu, struct task_struct *idle)
+{
+	if (soc_desc->smp_ops.smp_boot_secondary)
+		return soc_desc->smp_ops.smp_boot_secondary(cpu, idle);
+	return -ENOSYS;
+}
+
 #ifdef CONFIG_HOTPLUG_CPU
+
+int __attribute__((weak)) platform_cpu_kill(unsigned int cpu)
+{
+	if (soc_desc->smp_ops.cpu_kill)
+		return soc_desc->smp_ops.cpu_kill(cpu);
+	return 0;
+}
+
+void __attribute__((weak)) platform_cpu_die(unsigned int cpu)
+{
+	if (soc_desc->smp_ops.cpu_die)
+		soc_desc->smp_ops.cpu_die(cpu);
+}
+
+int __attribute__((weak)) platform_cpu_disable(unsigned int cpu)
+{
+	if (soc_desc->smp_ops.cpu_disable)
+		return soc_desc->smp_ops.cpu_disable(cpu);
+	return -EPERM;
+}
+
 /*
  * __cpu_disable runs on the processor to be shutdown.
  */
-- 
1.7.0.4

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

* [RFC PATCH 3/3] ARM: SoC: convert VExpress/RealView to SoC descriptor
  2011-09-08 17:00 [RFC PATCH 0/3] Per SoC descriptor Marc Zyngier
  2011-09-08 17:00 ` [RFC PATCH 1/3] ARM: SoC: Introduce per " Marc Zyngier
  2011-09-08 17:00 ` [RFC PATCH 2/3] ARM: SoC: Add per SoC SMP and CPU hotplug operations Marc Zyngier
@ 2011-09-08 17:00 ` Marc Zyngier
  2011-09-08 20:18 ` [RFC PATCH 0/3] Per " Arnd Bergmann
  3 siblings, 0 replies; 7+ messages in thread
From: Marc Zyngier @ 2011-09-08 17:00 UTC (permalink / raw)
  To: linux-arm-kernel

Convert both Realview and VExpress to use the SoC descriptor to
provide their SMP and CPU hotplug operation.

Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
 arch/arm/mach-realview/core.c                  |   19 +++++++++++++++++++
 arch/arm/mach-realview/core.h                  |    9 +++++++++
 arch/arm/mach-realview/hotplug.c               |    6 +++---
 arch/arm/mach-realview/platsmp.c               |    4 ++--
 arch/arm/mach-realview/realview_eb.c           |    1 +
 arch/arm/mach-realview/realview_pb1176.c       |    1 +
 arch/arm/mach-realview/realview_pb11mp.c       |    1 +
 arch/arm/mach-realview/realview_pba8.c         |    1 +
 arch/arm/mach-realview/realview_pbx.c          |    1 +
 arch/arm/mach-vexpress/core.h                  |    6 ++++++
 arch/arm/mach-vexpress/hotplug.c               |    6 +++---
 arch/arm/mach-vexpress/platsmp.c               |    4 ++--
 arch/arm/mach-vexpress/v2m.c                   |   20 ++++++++++++++++++++
 arch/arm/plat-versatile/include/plat/platsmp.h |   13 +++++++++++++
 arch/arm/plat-versatile/platsmp.c              |    4 ++--
 15 files changed, 84 insertions(+), 12 deletions(-)
 create mode 100644 arch/arm/plat-versatile/include/plat/platsmp.h

diff --git a/arch/arm/mach-realview/core.c b/arch/arm/mach-realview/core.c
index 5c23450..60893c6 100644
--- a/arch/arm/mach-realview/core.c
+++ b/arch/arm/mach-realview/core.c
@@ -33,6 +33,7 @@
 #include <linux/clkdev.h>
 #include <linux/mtd/physmap.h>
 
+#include <asm/soc.h>
 #include <asm/system.h>
 #include <mach/hardware.h>
 #include <asm/irq.h>
@@ -51,6 +52,7 @@
 #include <mach/irqs.h>
 #include <asm/hardware/timer-sp.h>
 
+#include <plat/platsmp.h>
 #include <plat/clcd.h>
 #include <plat/sched_clock.h>
 
@@ -534,3 +536,20 @@ void realview_fixup(struct machine_desc *mdesc, struct tag *tags, char **from,
 	meminfo->nr_banks = 1;
 #endif
 }
+
+struct arm_soc_desc realview_soc_desc __refdata = {
+	.name		= "ARM RealView Platform",
+#ifdef CONFIG_SMP
+	.smp_ops	= {
+		.smp_init_cpus		= realview_smp_init_cpus,
+		.smp_prepare_cpus	= realview_smp_prepare_cpus,
+		.smp_secondary_init	= versatile_secondary_init,
+		.smp_boot_secondary	= versatile_boot_secondary,
+#ifdef CONFIG_HOTPLUG_CPU
+		.cpu_kill		= realview_cpu_kill,
+		.cpu_die		= realview_cpu_die,
+		.cpu_disable		= realview_cpu_disable,
+#endif
+	},
+#endif
+};
diff --git a/arch/arm/mach-realview/core.h b/arch/arm/mach-realview/core.h
index 5c83d1e..93b23f1 100644
--- a/arch/arm/mach-realview/core.h
+++ b/arch/arm/mach-realview/core.h
@@ -45,6 +45,7 @@ static struct amba_device name##_device = {			\
 }
 
 struct machine_desc;
+struct arm_soc_desc;
 
 extern struct platform_device realview_flash_device;
 extern struct platform_device realview_cf_device;
@@ -67,4 +68,12 @@ extern void realview_fixup(struct machine_desc *mdesc, struct tag *tags,
 			   char **from, struct meminfo *meminfo);
 extern void (*realview_reset)(char);
 
+extern struct arm_soc_desc realview_soc_desc;
+
+extern void realview_smp_init_cpus(void);
+extern void realview_smp_prepare_cpus(unsigned int max_cpus);
+extern int  realview_cpu_kill(unsigned int cpu);
+extern void realview_cpu_die(unsigned int cpu);
+extern int  realview_cpu_disable(unsigned int cpu);
+
 #endif
diff --git a/arch/arm/mach-realview/hotplug.c b/arch/arm/mach-realview/hotplug.c
index a87523d..ce28104 100644
--- a/arch/arm/mach-realview/hotplug.c
+++ b/arch/arm/mach-realview/hotplug.c
@@ -87,7 +87,7 @@ static inline void platform_do_lowpower(unsigned int cpu, int *spurious)
 	}
 }
 
-int platform_cpu_kill(unsigned int cpu)
+int realview_cpu_kill(unsigned int cpu)
 {
 	return 1;
 }
@@ -97,7 +97,7 @@ int platform_cpu_kill(unsigned int cpu)
  *
  * Called with IRQs disabled
  */
-void platform_cpu_die(unsigned int cpu)
+void realview_cpu_die(unsigned int cpu)
 {
 	int spurious = 0;
 
@@ -117,7 +117,7 @@ void platform_cpu_die(unsigned int cpu)
 		pr_warn("CPU%u: %u spurious wakeup calls\n", cpu, spurious);
 }
 
-int platform_cpu_disable(unsigned int cpu)
+int realview_cpu_disable(unsigned int cpu)
 {
 	/*
 	 * we don't allow CPU 0 to be shutdown (it is still too special
diff --git a/arch/arm/mach-realview/platsmp.c b/arch/arm/mach-realview/platsmp.c
index 4ae943b..da6acae 100644
--- a/arch/arm/mach-realview/platsmp.c
+++ b/arch/arm/mach-realview/platsmp.c
@@ -44,7 +44,7 @@ static void __iomem *scu_base_addr(void)
  * Initialise the CPU possible map early - this describes the CPUs
  * which may be present or become present in the system.
  */
-void __init smp_init_cpus(void)
+void __init realview_smp_init_cpus(void)
 {
 	void __iomem *scu_base = scu_base_addr();
 	unsigned int i, ncores;
@@ -66,7 +66,7 @@ void __init smp_init_cpus(void)
 	set_smp_cross_call(gic_raise_softirq);
 }
 
-void __init platform_smp_prepare_cpus(unsigned int max_cpus)
+void __init realview_smp_prepare_cpus(unsigned int max_cpus)
 {
 
 	scu_enable(scu_base_addr());
diff --git a/arch/arm/mach-realview/realview_eb.c b/arch/arm/mach-realview/realview_eb.c
index 2e16bc4..bb45143 100644
--- a/arch/arm/mach-realview/realview_eb.c
+++ b/arch/arm/mach-realview/realview_eb.c
@@ -489,6 +489,7 @@ static void __init realview_eb_init(void)
 MACHINE_START(REALVIEW_EB, "ARM-RealView EB")
 	/* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */
 	.atag_offset	= 0x100,
+	.soc		= &realview_soc_desc,
 	.fixup		= realview_fixup,
 	.map_io		= realview_eb_map_io,
 	.init_early	= realview_init_early,
diff --git a/arch/arm/mach-realview/realview_pb1176.c b/arch/arm/mach-realview/realview_pb1176.c
index c47e599..539cde3 100644
--- a/arch/arm/mach-realview/realview_pb1176.c
+++ b/arch/arm/mach-realview/realview_pb1176.c
@@ -359,6 +359,7 @@ static void __init realview_pb1176_init(void)
 MACHINE_START(REALVIEW_PB1176, "ARM-RealView PB1176")
 	/* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */
 	.atag_offset	= 0x100,
+	.soc		= &realview_soc_desc,
 	.fixup		= realview_pb1176_fixup,
 	.map_io		= realview_pb1176_map_io,
 	.init_early	= realview_init_early,
diff --git a/arch/arm/mach-realview/realview_pb11mp.c b/arch/arm/mach-realview/realview_pb11mp.c
index 5dd8f00..95bdf42 100644
--- a/arch/arm/mach-realview/realview_pb11mp.c
+++ b/arch/arm/mach-realview/realview_pb11mp.c
@@ -384,6 +384,7 @@ static void __init realview_pb11mp_init(void)
 MACHINE_START(REALVIEW_PB11MP, "ARM-RealView PB11MPCore")
 	/* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */
 	.atag_offset	= 0x100,
+	.soc		= &realview_soc_desc,
 	.fixup		= realview_fixup,
 	.map_io		= realview_pb11mp_map_io,
 	.init_early	= realview_init_early,
diff --git a/arch/arm/mach-realview/realview_pba8.c b/arch/arm/mach-realview/realview_pba8.c
index 6e5f2b9..0896cc4 100644
--- a/arch/arm/mach-realview/realview_pba8.c
+++ b/arch/arm/mach-realview/realview_pba8.c
@@ -311,6 +311,7 @@ static void __init realview_pba8_init(void)
 MACHINE_START(REALVIEW_PBA8, "ARM-RealView PB-A8")
 	/* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */
 	.atag_offset	= 0x100,
+	.soc		= &realview_soc_desc,
 	.fixup		= realview_fixup,
 	.map_io		= realview_pba8_map_io,
 	.init_early	= realview_init_early,
diff --git a/arch/arm/mach-realview/realview_pbx.c b/arch/arm/mach-realview/realview_pbx.c
index be2d7de..80ce353 100644
--- a/arch/arm/mach-realview/realview_pbx.c
+++ b/arch/arm/mach-realview/realview_pbx.c
@@ -418,6 +418,7 @@ static void __init realview_pbx_init(void)
 MACHINE_START(REALVIEW_PBX, "ARM-RealView PBX")
 	/* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */
 	.atag_offset	= 0x100,
+	.soc		= &realview_soc_desc,
 	.fixup		= realview_pbx_fixup,
 	.map_io		= realview_pbx_map_io,
 	.init_early	= realview_init_early,
diff --git a/arch/arm/mach-vexpress/core.h b/arch/arm/mach-vexpress/core.h
index e325f50..7f1e7d8 100644
--- a/arch/arm/mach-vexpress/core.h
+++ b/arch/arm/mach-vexpress/core.h
@@ -24,3 +24,9 @@ struct amba_device name##_device = {		\
 	.irq		= IRQ_##base,		\
 	/* .dma		= DMA_##base,*/		\
 }
+
+extern void v2m_smp_init_cpus(void);
+extern void v2m_smp_prepare_cpus(unsigned int max_cpus);
+extern int  v2m_cpu_kill(unsigned int cpu);
+extern void v2m_cpu_die(unsigned int cpu);
+extern int  v2m_cpu_disable(unsigned int cpu);
diff --git a/arch/arm/mach-vexpress/hotplug.c b/arch/arm/mach-vexpress/hotplug.c
index ea4cbfb..1d57864 100644
--- a/arch/arm/mach-vexpress/hotplug.c
+++ b/arch/arm/mach-vexpress/hotplug.c
@@ -88,7 +88,7 @@ static inline void platform_do_lowpower(unsigned int cpu, int *spurious)
 	}
 }
 
-int platform_cpu_kill(unsigned int cpu)
+int v2m_cpu_kill(unsigned int cpu)
 {
 	return 1;
 }
@@ -98,7 +98,7 @@ int platform_cpu_kill(unsigned int cpu)
  *
  * Called with IRQs disabled
  */
-void platform_cpu_die(unsigned int cpu)
+void v2m_cpu_die(unsigned int cpu)
 {
 	int spurious = 0;
 
@@ -118,7 +118,7 @@ void platform_cpu_die(unsigned int cpu)
 		pr_warn("CPU%u: %u spurious wakeup calls\n", cpu, spurious);
 }
 
-int platform_cpu_disable(unsigned int cpu)
+int v2m_cpu_disable(unsigned int cpu)
 {
 	/*
 	 * we don't allow CPU 0 to be shutdown (it is still too special
diff --git a/arch/arm/mach-vexpress/platsmp.c b/arch/arm/mach-vexpress/platsmp.c
index ae31cc2..5f2f5e0 100644
--- a/arch/arm/mach-vexpress/platsmp.c
+++ b/arch/arm/mach-vexpress/platsmp.c
@@ -26,13 +26,13 @@ extern void versatile_secondary_startup(void);
  * Initialise the CPU possible map early - this describes the CPUs
  * which may be present or become present in the system.
  */
-void __init smp_init_cpus(void)
+void __init v2m_smp_init_cpus(void)
 {
 	set_smp_cross_call(gic_raise_softirq);
 	ct_desc->init_cpu_map();
 }
 
-void __init platform_smp_prepare_cpus(unsigned int max_cpus)
+void __init v2m_smp_prepare_cpus(unsigned int max_cpus)
 {
 	/*
 	 * Initialise the present map, which describes the set of CPUs
diff --git a/arch/arm/mach-vexpress/v2m.c b/arch/arm/mach-vexpress/v2m.c
index ed02f27..8981d4a 100644
--- a/arch/arm/mach-vexpress/v2m.c
+++ b/arch/arm/mach-vexpress/v2m.c
@@ -18,6 +18,7 @@
 #include <linux/mtd/physmap.h>
 
 #include <asm/mach-types.h>
+#include <asm/soc.h>
 #include <asm/sizes.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
@@ -33,6 +34,7 @@
 #include <mach/motherboard.h>
 
 #include <plat/sched_clock.h>
+#include <plat/platsmp.h>
 #include <plat/clcd.h>
 
 #include "core.h"
@@ -563,8 +565,26 @@ static void __init v2m_init(void)
 	amba_device_register(&clcd_device, &iomem_resource);
 }
 
+static struct arm_soc_desc v2m_soc_desc __refdata = {
+	.name		= "ARM VE Platform",
+#ifdef CONFIG_SMP
+	.smp_ops	= {
+		.smp_init_cpus		= v2m_smp_init_cpus,
+		.smp_prepare_cpus	= v2m_smp_prepare_cpus,
+		.smp_secondary_init	= versatile_secondary_init,
+		.smp_boot_secondary	= versatile_boot_secondary,
+#ifdef CONFIG_HOTPLUG_CPU
+		.cpu_kill		= v2m_cpu_kill,
+		.cpu_die		= v2m_cpu_die,
+		.cpu_disable		= v2m_cpu_disable,
+#endif
+	},
+#endif
+};
+
 MACHINE_START(VEXPRESS, "ARM-Versatile Express")
 	.atag_offset	= 0x100,
+	.soc		= &v2m_soc_desc,
 	.map_io		= v2m_map_io,
 	.init_early	= v2m_init_early,
 	.init_irq	= v2m_init_irq,
diff --git a/arch/arm/plat-versatile/include/plat/platsmp.h b/arch/arm/plat-versatile/include/plat/platsmp.h
new file mode 100644
index 0000000..cb893c2
--- /dev/null
+++ b/arch/arm/plat-versatile/include/plat/platsmp.h
@@ -0,0 +1,13 @@
+/*
+ *  linux/arch/arm/plat-versatile/include/plat/platsmp.h
+ *
+ *  Copyright (C) 2011 ARM Ltd.
+ *  All Rights Reserved
+ *
+ * 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.
+ */
+
+extern void versatile_secondary_init(unsigned int cpu);
+extern int  versatile_boot_secondary(unsigned int cpu, struct task_struct *idle);
diff --git a/arch/arm/plat-versatile/platsmp.c b/arch/arm/plat-versatile/platsmp.c
index 51ecfea..ec6a80b 100644
--- a/arch/arm/plat-versatile/platsmp.c
+++ b/arch/arm/plat-versatile/platsmp.c
@@ -39,7 +39,7 @@ static void __cpuinit write_pen_release(int val)
 
 static DEFINE_SPINLOCK(boot_lock);
 
-void __cpuinit platform_secondary_init(unsigned int cpu)
+void __cpuinit versatile_secondary_init(unsigned int cpu)
 {
 	/*
 	 * if any interrupts are already enabled for the primary
@@ -61,7 +61,7 @@ void __cpuinit platform_secondary_init(unsigned int cpu)
 	spin_unlock(&boot_lock);
 }
 
-int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
+int __cpuinit versatile_boot_secondary(unsigned int cpu, struct task_struct *idle)
 {
 	unsigned long timeout;
 
-- 
1.7.0.4

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

* [RFC PATCH 0/3] Per SoC descriptor
  2011-09-08 17:00 [RFC PATCH 0/3] Per SoC descriptor Marc Zyngier
                   ` (2 preceding siblings ...)
  2011-09-08 17:00 ` [RFC PATCH 3/3] ARM: SoC: convert VExpress/RealView to SoC descriptor Marc Zyngier
@ 2011-09-08 20:18 ` Arnd Bergmann
  2011-09-08 20:54   ` Nicolas Pitre
  3 siblings, 1 reply; 7+ messages in thread
From: Arnd Bergmann @ 2011-09-08 20:18 UTC (permalink / raw)
  To: linux-arm-kernel

On Thursday 08 September 2011 18:00:09 Marc Zyngier wrote:
> This is my first stab at an idea that has floated around for a while,
> which is to have a per-soc descriptor containing most of the SoC
> specific operations, which should clear the path a bit more towards
> the single zImage holy grail. It's as far as possible from being
> perfect, but I thought I'd share it as early as possible and see what
> people think of it.
> 
> This first patch series introduces the arm_soc_desc structure, adds
> per-soc SMP and CPU hotplug operations, and converts both RealView and
> VExpress to this new scheme.

Very nice, I definitely like the concept! This is going to be really
helpful reducing the amount of stuff we need in machine descriptors.

	Arnd

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

* [RFC PATCH 2/3] ARM: SoC: Add per SoC SMP and CPU hotplug operations
  2011-09-08 17:00 ` [RFC PATCH 2/3] ARM: SoC: Add per SoC SMP and CPU hotplug operations Marc Zyngier
@ 2011-09-08 20:23   ` Arnd Bergmann
  0 siblings, 0 replies; 7+ messages in thread
From: Arnd Bergmann @ 2011-09-08 20:23 UTC (permalink / raw)
  To: linux-arm-kernel

On Thursday 08 September 2011 18:00:11 Marc Zyngier wrote:
> +struct arm_soc_smp_ops {
> +       void (*smp_init_cpus)(void);
> +       void (*smp_prepare_cpus)(unsigned int max_cpus);
> +       void (*smp_secondary_init)(unsigned int cpu);
> +       int  (*smp_boot_secondary)(unsigned int cpu, struct task_struct *idle);
> +#ifdef CONFIG_HOTPLUG_CPU
> +       int  (*cpu_kill)(unsigned int cpu);
> +       void (*cpu_die)(unsigned int cpu);
> +       int  (*cpu_disable)(unsigned int cpu);
> +#endif
> +};
> +
>  struct arm_soc_desc {
>         const char              *name;
> +#ifdef CONFIG_SMP
> +       struct arm_soc_smp_ops  smp_ops;
> +#endif
>  };

If you make this two data structures, I would actually recommend using a
pointer to the arm_soc_smp_ops instead of embedding it in arm_soc_desc.

This will make it possible to put the arm_soc_smp_ops into the plat_smp.c file
and get rid of a few more #ifdefs.

It may also be a good idea to have global pointers and for arm_soc_desc and
arm_soc_smp_ops instead of pointing to them from the board file. I can see
reasons both ways, and that should probably be driven by code efficiency
concerns.

	Arnd

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

* [RFC PATCH 0/3] Per SoC descriptor
  2011-09-08 20:18 ` [RFC PATCH 0/3] Per " Arnd Bergmann
@ 2011-09-08 20:54   ` Nicolas Pitre
  0 siblings, 0 replies; 7+ messages in thread
From: Nicolas Pitre @ 2011-09-08 20:54 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, 8 Sep 2011, Arnd Bergmann wrote:

> On Thursday 08 September 2011 18:00:09 Marc Zyngier wrote:
> > This is my first stab at an idea that has floated around for a while,
> > which is to have a per-soc descriptor containing most of the SoC
> > specific operations, which should clear the path a bit more towards
> > the single zImage holy grail. It's as far as possible from being
> > perfect, but I thought I'd share it as early as possible and see what
> > people think of it.
> > 
> > This first patch series introduces the arm_soc_desc structure, adds
> > per-soc SMP and CPU hotplug operations, and converts both RealView and
> > VExpress to this new scheme.
> 
> Very nice, I definitely like the concept! This is going to be really
> helpful reducing the amount of stuff we need in machine descriptors.

Agreed.  And starting up with things that are not already in the 
per-machine descriptor is a good move.  Once this is well established 
then we might consider moving some features over from the machine desc 
to this SOC desc.


Nicolas

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

end of thread, other threads:[~2011-09-08 20:54 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-08 17:00 [RFC PATCH 0/3] Per SoC descriptor Marc Zyngier
2011-09-08 17:00 ` [RFC PATCH 1/3] ARM: SoC: Introduce per " Marc Zyngier
2011-09-08 17:00 ` [RFC PATCH 2/3] ARM: SoC: Add per SoC SMP and CPU hotplug operations Marc Zyngier
2011-09-08 20:23   ` Arnd Bergmann
2011-09-08 17:00 ` [RFC PATCH 3/3] ARM: SoC: convert VExpress/RealView to SoC descriptor Marc Zyngier
2011-09-08 20:18 ` [RFC PATCH 0/3] Per " Arnd Bergmann
2011-09-08 20:54   ` Nicolas Pitre

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).