diff options
author | Stephen Boyd <sboyd@codeaurora.org> | 2011-07-06 20:56:51 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2011-07-07 09:45:07 -0400 |
commit | 7fa22bd5460bb2021729fa5a1012c60b9b3a56e2 (patch) | |
tree | f17dd732f1c915b52a3d5de968ed0e26596a4feb /arch | |
parent | 10cdc7e5129ac26aefece4c7a7d5b1a0285237c2 (diff) |
ARM: 6993/1: platsmp: Allow secondary cpu hotplug with maxcpus=1
If an ARM system has multiple cpus in the same socket and the
kernel is booted with maxcpus=1, secondary cpus are possible but
not present due to how platform_smp_prepare_cpus() is called.
Since most typical ARM processors don't actually support physical
hotplug, initialize the present map to be equal to the possible
map in generic ARM SMP code. Also, always call
platform_smp_prepare_cpus() as long as max_cpus is non-zero (0
means no SMP) to allow platform code to do any SMP setup.
After applying this patch it's possible to boot an ARM system
with maxcpus=1 on the command line and then hotplug in secondary
cpus via sysfs. This is more in line with how x86 does things.
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: Kukjin Kim <kgene.kim@samsung.com>
Cc: David Brown <davidb@codeaurora.org>
Cc: Tony Lindgren <tony@atomide.com>
Cc: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com>
Cc: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/kernel/smp.c | 11 | ||||
-rw-r--r-- | arch/arm/mach-exynos4/platsmp.c | 8 | ||||
-rw-r--r-- | arch/arm/mach-msm/platsmp.c | 8 | ||||
-rw-r--r-- | arch/arm/mach-omap2/omap-smp.c | 8 | ||||
-rw-r--r-- | arch/arm/mach-realview/platsmp.c | 8 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/platsmp.c | 5 | ||||
-rw-r--r-- | arch/arm/mach-tegra/platsmp.c | 8 | ||||
-rw-r--r-- | arch/arm/mach-ux500/platsmp.c | 8 | ||||
-rw-r--r-- | arch/arm/mach-vexpress/ct-ca9x4.c | 4 |
9 files changed, 9 insertions, 59 deletions
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c index 344e52b16c8c..0ffcf5c0da43 100644 --- a/arch/arm/kernel/smp.c +++ b/arch/arm/kernel/smp.c | |||
@@ -361,8 +361,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus) | |||
361 | */ | 361 | */ |
362 | if (max_cpus > ncores) | 362 | if (max_cpus > ncores) |
363 | max_cpus = ncores; | 363 | max_cpus = ncores; |
364 | 364 | if (ncores > 1 && max_cpus) { | |
365 | if (max_cpus > 1) { | ||
366 | /* | 365 | /* |
367 | * Enable the local timer or broadcast device for the | 366 | * Enable the local timer or broadcast device for the |
368 | * boot CPU, but only if we have more than one CPU. | 367 | * boot CPU, but only if we have more than one CPU. |
@@ -370,6 +369,14 @@ void __init smp_prepare_cpus(unsigned int max_cpus) | |||
370 | percpu_timer_setup(); | 369 | percpu_timer_setup(); |
371 | 370 | ||
372 | /* | 371 | /* |
372 | * Initialise the present map, which describes the set of CPUs | ||
373 | * actually populated at the present time. A platform should | ||
374 | * re-initialize the map in platform_smp_prepare_cpus() if | ||
375 | * present != possible (e.g. physical hotplug). | ||
376 | */ | ||
377 | init_cpu_present(&cpu_possible_map); | ||
378 | |||
379 | /* | ||
373 | * Initialise the SCU if there are more than one CPU | 380 | * Initialise the SCU if there are more than one CPU |
374 | * and let them know where to start. | 381 | * and let them know where to start. |
375 | */ | 382 | */ |
diff --git a/arch/arm/mach-exynos4/platsmp.c b/arch/arm/mach-exynos4/platsmp.c index c5e65a02be8d..b68d5bdf04cf 100644 --- a/arch/arm/mach-exynos4/platsmp.c +++ b/arch/arm/mach-exynos4/platsmp.c | |||
@@ -154,14 +154,6 @@ void __init smp_init_cpus(void) | |||
154 | 154 | ||
155 | void __init platform_smp_prepare_cpus(unsigned int max_cpus) | 155 | void __init platform_smp_prepare_cpus(unsigned int max_cpus) |
156 | { | 156 | { |
157 | int i; | ||
158 | |||
159 | /* | ||
160 | * Initialise the present map, which describes the set of CPUs | ||
161 | * actually populated at the present time. | ||
162 | */ | ||
163 | for (i = 0; i < max_cpus; i++) | ||
164 | set_cpu_present(i, true); | ||
165 | 157 | ||
166 | scu_enable(scu_base_addr()); | 158 | scu_enable(scu_base_addr()); |
167 | 159 | ||
diff --git a/arch/arm/mach-msm/platsmp.c b/arch/arm/mach-msm/platsmp.c index 2034098cf015..315b9f365329 100644 --- a/arch/arm/mach-msm/platsmp.c +++ b/arch/arm/mach-msm/platsmp.c | |||
@@ -157,12 +157,4 @@ void __init smp_init_cpus(void) | |||
157 | 157 | ||
158 | void __init platform_smp_prepare_cpus(unsigned int max_cpus) | 158 | void __init platform_smp_prepare_cpus(unsigned int max_cpus) |
159 | { | 159 | { |
160 | int i; | ||
161 | |||
162 | /* | ||
163 | * Initialise the present map, which describes the set of CPUs | ||
164 | * actually populated at the present time. | ||
165 | */ | ||
166 | for (i = 0; i < max_cpus; i++) | ||
167 | set_cpu_present(i, true); | ||
168 | } | 160 | } |
diff --git a/arch/arm/mach-omap2/omap-smp.c b/arch/arm/mach-omap2/omap-smp.c index ecfe93c4b585..ce65e9329c7b 100644 --- a/arch/arm/mach-omap2/omap-smp.c +++ b/arch/arm/mach-omap2/omap-smp.c | |||
@@ -125,14 +125,6 @@ void __init smp_init_cpus(void) | |||
125 | 125 | ||
126 | void __init platform_smp_prepare_cpus(unsigned int max_cpus) | 126 | void __init platform_smp_prepare_cpus(unsigned int max_cpus) |
127 | { | 127 | { |
128 | int i; | ||
129 | |||
130 | /* | ||
131 | * Initialise the present map, which describes the set of CPUs | ||
132 | * actually populated at the present time. | ||
133 | */ | ||
134 | for (i = 0; i < max_cpus; i++) | ||
135 | set_cpu_present(i, true); | ||
136 | 128 | ||
137 | /* | 129 | /* |
138 | * Initialise the SCU and wake up the secondary core using | 130 | * Initialise the SCU and wake up the secondary core using |
diff --git a/arch/arm/mach-realview/platsmp.c b/arch/arm/mach-realview/platsmp.c index 963bf0d8119a..4ae943bafa92 100644 --- a/arch/arm/mach-realview/platsmp.c +++ b/arch/arm/mach-realview/platsmp.c | |||
@@ -68,14 +68,6 @@ void __init smp_init_cpus(void) | |||
68 | 68 | ||
69 | void __init platform_smp_prepare_cpus(unsigned int max_cpus) | 69 | void __init platform_smp_prepare_cpus(unsigned int max_cpus) |
70 | { | 70 | { |
71 | int i; | ||
72 | |||
73 | /* | ||
74 | * Initialise the present map, which describes the set of CPUs | ||
75 | * actually populated at the present time. | ||
76 | */ | ||
77 | for (i = 0; i < max_cpus; i++) | ||
78 | set_cpu_present(i, true); | ||
79 | 71 | ||
80 | scu_enable(scu_base_addr()); | 72 | scu_enable(scu_base_addr()); |
81 | 73 | ||
diff --git a/arch/arm/mach-shmobile/platsmp.c b/arch/arm/mach-shmobile/platsmp.c index f3888feb1c68..66f980625a33 100644 --- a/arch/arm/mach-shmobile/platsmp.c +++ b/arch/arm/mach-shmobile/platsmp.c | |||
@@ -64,10 +64,5 @@ void __init smp_init_cpus(void) | |||
64 | 64 | ||
65 | void __init platform_smp_prepare_cpus(unsigned int max_cpus) | 65 | void __init platform_smp_prepare_cpus(unsigned int max_cpus) |
66 | { | 66 | { |
67 | int i; | ||
68 | |||
69 | for (i = 0; i < max_cpus; i++) | ||
70 | set_cpu_present(i, true); | ||
71 | |||
72 | shmobile_smp_prepare_cpus(); | 67 | shmobile_smp_prepare_cpus(); |
73 | } | 68 | } |
diff --git a/arch/arm/mach-tegra/platsmp.c b/arch/arm/mach-tegra/platsmp.c index b8ae3c978dee..1a594dce8fbc 100644 --- a/arch/arm/mach-tegra/platsmp.c +++ b/arch/arm/mach-tegra/platsmp.c | |||
@@ -129,14 +129,6 @@ void __init smp_init_cpus(void) | |||
129 | 129 | ||
130 | void __init platform_smp_prepare_cpus(unsigned int max_cpus) | 130 | void __init platform_smp_prepare_cpus(unsigned int max_cpus) |
131 | { | 131 | { |
132 | int i; | ||
133 | |||
134 | /* | ||
135 | * Initialise the present map, which describes the set of CPUs | ||
136 | * actually populated at the present time. | ||
137 | */ | ||
138 | for (i = 0; i < max_cpus; i++) | ||
139 | set_cpu_present(i, true); | ||
140 | 132 | ||
141 | scu_enable(scu_base); | 133 | scu_enable(scu_base); |
142 | } | 134 | } |
diff --git a/arch/arm/mach-ux500/platsmp.c b/arch/arm/mach-ux500/platsmp.c index 0c527fe2cebb..a33df5f4c27a 100644 --- a/arch/arm/mach-ux500/platsmp.c +++ b/arch/arm/mach-ux500/platsmp.c | |||
@@ -172,14 +172,6 @@ void __init smp_init_cpus(void) | |||
172 | 172 | ||
173 | void __init platform_smp_prepare_cpus(unsigned int max_cpus) | 173 | void __init platform_smp_prepare_cpus(unsigned int max_cpus) |
174 | { | 174 | { |
175 | int i; | ||
176 | |||
177 | /* | ||
178 | * Initialise the present map, which describes the set of CPUs | ||
179 | * actually populated at the present time. | ||
180 | */ | ||
181 | for (i = 0; i < max_cpus; i++) | ||
182 | set_cpu_present(i, true); | ||
183 | 175 | ||
184 | scu_enable(scu_base_addr()); | 176 | scu_enable(scu_base_addr()); |
185 | wakeup_secondary(); | 177 | wakeup_secondary(); |
diff --git a/arch/arm/mach-vexpress/ct-ca9x4.c b/arch/arm/mach-vexpress/ct-ca9x4.c index 765a71ff7f3b..bfd32f52c2db 100644 --- a/arch/arm/mach-vexpress/ct-ca9x4.c +++ b/arch/arm/mach-vexpress/ct-ca9x4.c | |||
@@ -229,10 +229,6 @@ static void ct_ca9x4_init_cpu_map(void) | |||
229 | 229 | ||
230 | static void ct_ca9x4_smp_enable(unsigned int max_cpus) | 230 | static void ct_ca9x4_smp_enable(unsigned int max_cpus) |
231 | { | 231 | { |
232 | int i; | ||
233 | for (i = 0; i < max_cpus; i++) | ||
234 | set_cpu_present(i, true); | ||
235 | |||
236 | scu_enable(MMIO_P2V(A9_MPCORE_SCU)); | 232 | scu_enable(MMIO_P2V(A9_MPCORE_SCU)); |
237 | } | 233 | } |
238 | #endif | 234 | #endif |