diff options
author | Marc Zyngier <marc.zyngier@arm.com> | 2011-09-08 08:15:22 -0400 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2012-09-13 09:34:50 -0400 |
commit | 3695adc2fdaf3ad1881e0dd3e3422e5e141abd7d (patch) | |
tree | b8bef89c2d2f7527a78b2241e7729c6858927012 /arch | |
parent | abcee5fb0dfbb248d883a2f6bdb4820abe3ac524 (diff) |
ARM: SoC: convert VExpress/RealView to SMP operations
Convert both Realview and VExpress to use struct smp_operations to
provide their SMP and CPU hotplug operation.
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Acked-by: Nicolas Pitre <nico@fluxnic.net>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-realview/core.h | 3 | ||||
-rw-r--r-- | arch/arm/mach-realview/hotplug.c | 16 | ||||
-rw-r--r-- | arch/arm/mach-realview/platsmp.c | 18 | ||||
-rw-r--r-- | arch/arm/mach-realview/realview_pb11mp.c | 1 | ||||
-rw-r--r-- | arch/arm/mach-realview/realview_pbx.c | 1 | ||||
-rw-r--r-- | arch/arm/mach-vexpress/core.h | 4 | ||||
-rw-r--r-- | arch/arm/mach-vexpress/hotplug.c | 16 | ||||
-rw-r--r-- | arch/arm/mach-vexpress/platsmp.c | 18 | ||||
-rw-r--r-- | arch/arm/mach-vexpress/v2m.c | 4 | ||||
-rw-r--r-- | arch/arm/plat-versatile/include/plat/platsmp.h | 14 | ||||
-rw-r--r-- | arch/arm/plat-versatile/platsmp.c | 4 |
11 files changed, 59 insertions, 40 deletions
diff --git a/arch/arm/mach-realview/core.h b/arch/arm/mach-realview/core.h index f8f2c0ac4c01..78cd970c80f2 100644 --- a/arch/arm/mach-realview/core.h +++ b/arch/arm/mach-realview/core.h | |||
@@ -56,4 +56,7 @@ extern void realview_init_early(void); | |||
56 | extern void realview_fixup(struct tag *tags, char **from, | 56 | extern void realview_fixup(struct tag *tags, char **from, |
57 | struct meminfo *meminfo); | 57 | struct meminfo *meminfo); |
58 | 58 | ||
59 | extern struct smp_operations realview_smp_ops; | ||
60 | extern void realview_cpu_die(unsigned int cpu); | ||
61 | |||
59 | #endif | 62 | #endif |
diff --git a/arch/arm/mach-realview/hotplug.c b/arch/arm/mach-realview/hotplug.c index 57d9efba2956..fef4f4495225 100644 --- a/arch/arm/mach-realview/hotplug.c +++ b/arch/arm/mach-realview/hotplug.c | |||
@@ -89,17 +89,12 @@ static inline void platform_do_lowpower(unsigned int cpu, int *spurious) | |||
89 | } | 89 | } |
90 | } | 90 | } |
91 | 91 | ||
92 | int platform_cpu_kill(unsigned int cpu) | ||
93 | { | ||
94 | return 1; | ||
95 | } | ||
96 | |||
97 | /* | 92 | /* |
98 | * platform-specific code to shutdown a CPU | 93 | * platform-specific code to shutdown a CPU |
99 | * | 94 | * |
100 | * Called with IRQs disabled | 95 | * Called with IRQs disabled |
101 | */ | 96 | */ |
102 | void platform_cpu_die(unsigned int cpu) | 97 | void __ref realview_cpu_die(unsigned int cpu) |
103 | { | 98 | { |
104 | int spurious = 0; | 99 | int spurious = 0; |
105 | 100 | ||
@@ -118,12 +113,3 @@ void platform_cpu_die(unsigned int cpu) | |||
118 | if (spurious) | 113 | if (spurious) |
119 | pr_warn("CPU%u: %u spurious wakeup calls\n", cpu, spurious); | 114 | pr_warn("CPU%u: %u spurious wakeup calls\n", cpu, spurious); |
120 | } | 115 | } |
121 | |||
122 | int platform_cpu_disable(unsigned int cpu) | ||
123 | { | ||
124 | /* | ||
125 | * we don't allow CPU 0 to be shutdown (it is still too special | ||
126 | * e.g. clock tick interrupts) | ||
127 | */ | ||
128 | return cpu == 0 ? -EPERM : 0; | ||
129 | } | ||
diff --git a/arch/arm/mach-realview/platsmp.c b/arch/arm/mach-realview/platsmp.c index 17c878ddbc70..300f7064465d 100644 --- a/arch/arm/mach-realview/platsmp.c +++ b/arch/arm/mach-realview/platsmp.c | |||
@@ -22,9 +22,9 @@ | |||
22 | #include <mach/board-pb11mp.h> | 22 | #include <mach/board-pb11mp.h> |
23 | #include <mach/board-pbx.h> | 23 | #include <mach/board-pbx.h> |
24 | 24 | ||
25 | #include "core.h" | 25 | #include <plat/platsmp.h> |
26 | 26 | ||
27 | extern void versatile_secondary_startup(void); | 27 | #include "core.h" |
28 | 28 | ||
29 | static void __iomem *scu_base_addr(void) | 29 | static void __iomem *scu_base_addr(void) |
30 | { | 30 | { |
@@ -43,7 +43,7 @@ static void __iomem *scu_base_addr(void) | |||
43 | * Initialise the CPU possible map early - this describes the CPUs | 43 | * Initialise the CPU possible map early - this describes the CPUs |
44 | * which may be present or become present in the system. | 44 | * which may be present or become present in the system. |
45 | */ | 45 | */ |
46 | void __init smp_init_cpus(void) | 46 | static void __init realview_smp_init_cpus(void) |
47 | { | 47 | { |
48 | void __iomem *scu_base = scu_base_addr(); | 48 | void __iomem *scu_base = scu_base_addr(); |
49 | unsigned int i, ncores; | 49 | unsigned int i, ncores; |
@@ -63,7 +63,7 @@ void __init smp_init_cpus(void) | |||
63 | set_smp_cross_call(gic_raise_softirq); | 63 | set_smp_cross_call(gic_raise_softirq); |
64 | } | 64 | } |
65 | 65 | ||
66 | void __init platform_smp_prepare_cpus(unsigned int max_cpus) | 66 | static void __init realview_smp_prepare_cpus(unsigned int max_cpus) |
67 | { | 67 | { |
68 | 68 | ||
69 | scu_enable(scu_base_addr()); | 69 | scu_enable(scu_base_addr()); |
@@ -77,3 +77,13 @@ void __init platform_smp_prepare_cpus(unsigned int max_cpus) | |||
77 | __raw_writel(virt_to_phys(versatile_secondary_startup), | 77 | __raw_writel(virt_to_phys(versatile_secondary_startup), |
78 | __io_address(REALVIEW_SYS_FLAGSSET)); | 78 | __io_address(REALVIEW_SYS_FLAGSSET)); |
79 | } | 79 | } |
80 | |||
81 | struct smp_operations realview_smp_ops __initdata = { | ||
82 | .smp_init_cpus = realview_smp_init_cpus, | ||
83 | .smp_prepare_cpus = realview_smp_prepare_cpus, | ||
84 | .smp_secondary_init = versatile_secondary_init, | ||
85 | .smp_boot_secondary = versatile_boot_secondary, | ||
86 | #ifdef CONFIG_HOTPLUG_CPU | ||
87 | .cpu_die = realview_cpu_die, | ||
88 | #endif | ||
89 | }; | ||
diff --git a/arch/arm/mach-realview/realview_pb11mp.c b/arch/arm/mach-realview/realview_pb11mp.c index a98c536e3327..2eacda179f77 100644 --- a/arch/arm/mach-realview/realview_pb11mp.c +++ b/arch/arm/mach-realview/realview_pb11mp.c | |||
@@ -366,6 +366,7 @@ static void __init realview_pb11mp_init(void) | |||
366 | MACHINE_START(REALVIEW_PB11MP, "ARM-RealView PB11MPCore") | 366 | MACHINE_START(REALVIEW_PB11MP, "ARM-RealView PB11MPCore") |
367 | /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */ | 367 | /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */ |
368 | .atag_offset = 0x100, | 368 | .atag_offset = 0x100, |
369 | .smp = smp_ops(realview_smp_ops), | ||
369 | .fixup = realview_fixup, | 370 | .fixup = realview_fixup, |
370 | .map_io = realview_pb11mp_map_io, | 371 | .map_io = realview_pb11mp_map_io, |
371 | .init_early = realview_init_early, | 372 | .init_early = realview_init_early, |
diff --git a/arch/arm/mach-realview/realview_pbx.c b/arch/arm/mach-realview/realview_pbx.c index 3f2f605624e9..2cd4f157c6fc 100644 --- a/arch/arm/mach-realview/realview_pbx.c +++ b/arch/arm/mach-realview/realview_pbx.c | |||
@@ -403,6 +403,7 @@ static void __init realview_pbx_init(void) | |||
403 | MACHINE_START(REALVIEW_PBX, "ARM-RealView PBX") | 403 | MACHINE_START(REALVIEW_PBX, "ARM-RealView PBX") |
404 | /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */ | 404 | /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */ |
405 | .atag_offset = 0x100, | 405 | .atag_offset = 0x100, |
406 | .smp = smp_ops(realview_smp_ops), | ||
406 | .fixup = realview_pbx_fixup, | 407 | .fixup = realview_pbx_fixup, |
407 | .map_io = realview_pbx_map_io, | 408 | .map_io = realview_pbx_map_io, |
408 | .init_early = realview_init_early, | 409 | .init_early = realview_init_early, |
diff --git a/arch/arm/mach-vexpress/core.h b/arch/arm/mach-vexpress/core.h index a3a4980770bd..f134cd4a85f1 100644 --- a/arch/arm/mach-vexpress/core.h +++ b/arch/arm/mach-vexpress/core.h | |||
@@ -5,3 +5,7 @@ | |||
5 | #define V2T_PERIPH 0xf8200000 | 5 | #define V2T_PERIPH 0xf8200000 |
6 | 6 | ||
7 | void vexpress_dt_smp_map_io(void); | 7 | void vexpress_dt_smp_map_io(void); |
8 | |||
9 | extern struct smp_operations vexpress_smp_ops; | ||
10 | |||
11 | extern void vexpress_cpu_die(unsigned int cpu); | ||
diff --git a/arch/arm/mach-vexpress/hotplug.c b/arch/arm/mach-vexpress/hotplug.c index c504a72b94d6..734423a39e7c 100644 --- a/arch/arm/mach-vexpress/hotplug.c +++ b/arch/arm/mach-vexpress/hotplug.c | |||
@@ -84,17 +84,12 @@ static inline void platform_do_lowpower(unsigned int cpu, int *spurious) | |||
84 | } | 84 | } |
85 | } | 85 | } |
86 | 86 | ||
87 | int platform_cpu_kill(unsigned int cpu) | ||
88 | { | ||
89 | return 1; | ||
90 | } | ||
91 | |||
92 | /* | 87 | /* |
93 | * platform-specific code to shutdown a CPU | 88 | * platform-specific code to shutdown a CPU |
94 | * | 89 | * |
95 | * Called with IRQs disabled | 90 | * Called with IRQs disabled |
96 | */ | 91 | */ |
97 | void platform_cpu_die(unsigned int cpu) | 92 | void __ref vexpress_cpu_die(unsigned int cpu) |
98 | { | 93 | { |
99 | int spurious = 0; | 94 | int spurious = 0; |
100 | 95 | ||
@@ -113,12 +108,3 @@ void platform_cpu_die(unsigned int cpu) | |||
113 | if (spurious) | 108 | if (spurious) |
114 | pr_warn("CPU%u: %u spurious wakeup calls\n", cpu, spurious); | 109 | pr_warn("CPU%u: %u spurious wakeup calls\n", cpu, spurious); |
115 | } | 110 | } |
116 | |||
117 | int platform_cpu_disable(unsigned int cpu) | ||
118 | { | ||
119 | /* | ||
120 | * we don't allow CPU 0 to be shutdown (it is still too special | ||
121 | * e.g. clock tick interrupts) | ||
122 | */ | ||
123 | return cpu == 0 ? -EPERM : 0; | ||
124 | } | ||
diff --git a/arch/arm/mach-vexpress/platsmp.c b/arch/arm/mach-vexpress/platsmp.c index 14ba1128ae8d..7db27c8c05cc 100644 --- a/arch/arm/mach-vexpress/platsmp.c +++ b/arch/arm/mach-vexpress/platsmp.c | |||
@@ -20,9 +20,9 @@ | |||
20 | 20 | ||
21 | #include <mach/motherboard.h> | 21 | #include <mach/motherboard.h> |
22 | 22 | ||
23 | #include "core.h" | 23 | #include <plat/platsmp.h> |
24 | 24 | ||
25 | extern void versatile_secondary_startup(void); | 25 | #include "core.h" |
26 | 26 | ||
27 | #if defined(CONFIG_OF) | 27 | #if defined(CONFIG_OF) |
28 | 28 | ||
@@ -167,7 +167,7 @@ void __init vexpress_dt_smp_prepare_cpus(unsigned int max_cpus) | |||
167 | * Initialise the CPU possible map early - this describes the CPUs | 167 | * Initialise the CPU possible map early - this describes the CPUs |
168 | * which may be present or become present in the system. | 168 | * which may be present or become present in the system. |
169 | */ | 169 | */ |
170 | void __init smp_init_cpus(void) | 170 | static void __init vexpress_smp_init_cpus(void) |
171 | { | 171 | { |
172 | if (ct_desc) | 172 | if (ct_desc) |
173 | ct_desc->init_cpu_map(); | 173 | ct_desc->init_cpu_map(); |
@@ -176,7 +176,7 @@ void __init smp_init_cpus(void) | |||
176 | 176 | ||
177 | } | 177 | } |
178 | 178 | ||
179 | void __init platform_smp_prepare_cpus(unsigned int max_cpus) | 179 | static void __init vexpress_smp_prepare_cpus(unsigned int max_cpus) |
180 | { | 180 | { |
181 | /* | 181 | /* |
182 | * Initialise the present map, which describes the set of CPUs | 182 | * Initialise the present map, which describes the set of CPUs |
@@ -195,3 +195,13 @@ void __init platform_smp_prepare_cpus(unsigned int max_cpus) | |||
195 | */ | 195 | */ |
196 | v2m_flags_set(virt_to_phys(versatile_secondary_startup)); | 196 | v2m_flags_set(virt_to_phys(versatile_secondary_startup)); |
197 | } | 197 | } |
198 | |||
199 | struct smp_operations __initdata vexpress_smp_ops = { | ||
200 | .smp_init_cpus = vexpress_smp_init_cpus, | ||
201 | .smp_prepare_cpus = vexpress_smp_prepare_cpus, | ||
202 | .smp_secondary_init = versatile_secondary_init, | ||
203 | .smp_boot_secondary = versatile_boot_secondary, | ||
204 | #ifdef CONFIG_HOTPLUG_CPU | ||
205 | .cpu_die = vexpress_cpu_die, | ||
206 | #endif | ||
207 | }; | ||
diff --git a/arch/arm/mach-vexpress/v2m.c b/arch/arm/mach-vexpress/v2m.c index 37608f22ee31..722ef339c5f2 100644 --- a/arch/arm/mach-vexpress/v2m.c +++ b/arch/arm/mach-vexpress/v2m.c | |||
@@ -5,6 +5,7 @@ | |||
5 | #include <linux/amba/bus.h> | 5 | #include <linux/amba/bus.h> |
6 | #include <linux/amba/mmci.h> | 6 | #include <linux/amba/mmci.h> |
7 | #include <linux/io.h> | 7 | #include <linux/io.h> |
8 | #include <linux/smp.h> | ||
8 | #include <linux/init.h> | 9 | #include <linux/init.h> |
9 | #include <linux/of_address.h> | 10 | #include <linux/of_address.h> |
10 | #include <linux/of_fdt.h> | 11 | #include <linux/of_fdt.h> |
@@ -38,6 +39,7 @@ | |||
38 | #include <mach/motherboard.h> | 39 | #include <mach/motherboard.h> |
39 | 40 | ||
40 | #include <plat/sched_clock.h> | 41 | #include <plat/sched_clock.h> |
42 | #include <plat/platsmp.h> | ||
41 | 43 | ||
42 | #include "core.h" | 44 | #include "core.h" |
43 | 45 | ||
@@ -530,6 +532,7 @@ static void __init v2m_init(void) | |||
530 | 532 | ||
531 | MACHINE_START(VEXPRESS, "ARM-Versatile Express") | 533 | MACHINE_START(VEXPRESS, "ARM-Versatile Express") |
532 | .atag_offset = 0x100, | 534 | .atag_offset = 0x100, |
535 | .smp = smp_ops(vexpress_smp_ops), | ||
533 | .map_io = v2m_map_io, | 536 | .map_io = v2m_map_io, |
534 | .init_early = v2m_init_early, | 537 | .init_early = v2m_init_early, |
535 | .init_irq = v2m_init_irq, | 538 | .init_irq = v2m_init_irq, |
@@ -663,6 +666,7 @@ const static char *v2m_dt_match[] __initconst = { | |||
663 | 666 | ||
664 | DT_MACHINE_START(VEXPRESS_DT, "ARM-Versatile Express") | 667 | DT_MACHINE_START(VEXPRESS_DT, "ARM-Versatile Express") |
665 | .dt_compat = v2m_dt_match, | 668 | .dt_compat = v2m_dt_match, |
669 | .smp = smp_ops(vexpress_smp_ops), | ||
666 | .map_io = v2m_dt_map_io, | 670 | .map_io = v2m_dt_map_io, |
667 | .init_early = v2m_dt_init_early, | 671 | .init_early = v2m_dt_init_early, |
668 | .init_irq = v2m_dt_init_irq, | 672 | .init_irq = v2m_dt_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 000000000000..50fb830192e0 --- /dev/null +++ b/arch/arm/plat-versatile/include/plat/platsmp.h | |||
@@ -0,0 +1,14 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/plat-versatile/include/plat/platsmp.h | ||
3 | * | ||
4 | * Copyright (C) 2011 ARM Ltd. | ||
5 | * All Rights Reserved | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | extern void versatile_secondary_startup(void); | ||
13 | extern void versatile_secondary_init(unsigned int cpu); | ||
14 | 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 d7c5c171f5aa..39e60ac4fe65 100644 --- a/arch/arm/plat-versatile/platsmp.c +++ b/arch/arm/plat-versatile/platsmp.c | |||
@@ -40,7 +40,7 @@ static void __cpuinit write_pen_release(int val) | |||
40 | 40 | ||
41 | static DEFINE_SPINLOCK(boot_lock); | 41 | static DEFINE_SPINLOCK(boot_lock); |
42 | 42 | ||
43 | void __cpuinit platform_secondary_init(unsigned int cpu) | 43 | void __cpuinit versatile_secondary_init(unsigned int cpu) |
44 | { | 44 | { |
45 | /* | 45 | /* |
46 | * if any interrupts are already enabled for the primary | 46 | * if any interrupts are already enabled for the primary |
@@ -62,7 +62,7 @@ void __cpuinit platform_secondary_init(unsigned int cpu) | |||
62 | spin_unlock(&boot_lock); | 62 | spin_unlock(&boot_lock); |
63 | } | 63 | } |
64 | 64 | ||
65 | int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle) | 65 | int __cpuinit versatile_boot_secondary(unsigned int cpu, struct task_struct *idle) |
66 | { | 66 | { |
67 | unsigned long timeout; | 67 | unsigned long timeout; |
68 | 68 | ||