]> git.karo-electronics.de Git - linux-beck.git/commitdiff
ARM: 6993/1: platsmp: Allow secondary cpu hotplug with maxcpus=1
authorStephen Boyd <sboyd@codeaurora.org>
Thu, 7 Jul 2011 00:56:51 +0000 (01:56 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Thu, 7 Jul 2011 13:45:07 +0000 (14:45 +0100)
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>
arch/arm/kernel/smp.c
arch/arm/mach-exynos4/platsmp.c
arch/arm/mach-msm/platsmp.c
arch/arm/mach-omap2/omap-smp.c
arch/arm/mach-realview/platsmp.c
arch/arm/mach-shmobile/platsmp.c
arch/arm/mach-tegra/platsmp.c
arch/arm/mach-ux500/platsmp.c
arch/arm/mach-vexpress/ct-ca9x4.c

index 344e52b16c8cd4234b523547d07a8b6ff9106bd6..0ffcf5c0da4323ac6255da97b296342871babb0e 100644 (file)
@@ -361,14 +361,21 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
         */
        if (max_cpus > ncores)
                max_cpus = ncores;
-
-       if (max_cpus > 1) {
+       if (ncores > 1 && max_cpus) {
                /*
                 * Enable the local timer or broadcast device for the
                 * boot CPU, but only if we have more than one CPU.
                 */
                percpu_timer_setup();
 
+               /*
+                * Initialise the present map, which describes the set of CPUs
+                * actually populated at the present time. A platform should
+                * re-initialize the map in platform_smp_prepare_cpus() if
+                * present != possible (e.g. physical hotplug).
+                */
+               init_cpu_present(&cpu_possible_map);
+
                /*
                 * Initialise the SCU if there are more than one CPU
                 * and let them know where to start.
index c5e65a02be8d4e2e4303f1333825e141c5988b66..b68d5bdf04cf57e52691dd0778a9bf6f664662a0 100644 (file)
@@ -154,14 +154,6 @@ void __init smp_init_cpus(void)
 
 void __init platform_smp_prepare_cpus(unsigned int max_cpus)
 {
-       int i;
-
-       /*
-        * Initialise the present map, which describes the set of CPUs
-        * actually populated at the present time.
-        */
-       for (i = 0; i < max_cpus; i++)
-               set_cpu_present(i, true);
 
        scu_enable(scu_base_addr());
 
index 2034098cf0150eaa45487a2020796d809bc265dc..315b9f365329a459bed0140f3d96f524cdfe655b 100644 (file)
@@ -157,12 +157,4 @@ void __init smp_init_cpus(void)
 
 void __init platform_smp_prepare_cpus(unsigned int max_cpus)
 {
-       int i;
-
-       /*
-        * Initialise the present map, which describes the set of CPUs
-        * actually populated at the present time.
-        */
-       for (i = 0; i < max_cpus; i++)
-               set_cpu_present(i, true);
 }
index ecfe93c4b5859d25c333f6f01b2507d882ff3895..ce65e9329c7b7ac77c179e7802aa673a6c82328a 100644 (file)
@@ -125,14 +125,6 @@ void __init smp_init_cpus(void)
 
 void __init platform_smp_prepare_cpus(unsigned int max_cpus)
 {
-       int i;
-
-       /*
-        * Initialise the present map, which describes the set of CPUs
-        * actually populated at the present time.
-        */
-       for (i = 0; i < max_cpus; i++)
-               set_cpu_present(i, true);
 
        /*
         * Initialise the SCU and wake up the secondary core using
index 963bf0d8119aafb17ac3281f843820ff454d3886..4ae943bafa9299d530629d53707487f87c9a83fb 100644 (file)
@@ -68,14 +68,6 @@ void __init smp_init_cpus(void)
 
 void __init platform_smp_prepare_cpus(unsigned int max_cpus)
 {
-       int i;
-
-       /*
-        * Initialise the present map, which describes the set of CPUs
-        * actually populated at the present time.
-        */
-       for (i = 0; i < max_cpus; i++)
-               set_cpu_present(i, true);
 
        scu_enable(scu_base_addr());
 
index f3888feb1c684de1911b20cbad2fc7208cf1aee6..66f980625a33e1e05fed0d142abd3fc0090d6c4e 100644 (file)
@@ -64,10 +64,5 @@ void __init smp_init_cpus(void)
 
 void __init platform_smp_prepare_cpus(unsigned int max_cpus)
 {
-       int i;
-
-       for (i = 0; i < max_cpus; i++)
-               set_cpu_present(i, true);
-
        shmobile_smp_prepare_cpus();
 }
index b8ae3c978dee30a26ce8ca4df3828714c3551f87..1a594dce8fbc1a8817f11545722c0786c7ffab93 100644 (file)
@@ -129,14 +129,6 @@ void __init smp_init_cpus(void)
 
 void __init platform_smp_prepare_cpus(unsigned int max_cpus)
 {
-       int i;
-
-       /*
-        * Initialise the present map, which describes the set of CPUs
-        * actually populated at the present time.
-        */
-       for (i = 0; i < max_cpus; i++)
-               set_cpu_present(i, true);
 
        scu_enable(scu_base);
 }
index 0c527fe2cebb1dd7c93a0f651323eaf7559fd77c..a33df5f4c27a1d33ca534e5b8071ad2677edb7fa 100644 (file)
@@ -172,14 +172,6 @@ void __init smp_init_cpus(void)
 
 void __init platform_smp_prepare_cpus(unsigned int max_cpus)
 {
-       int i;
-
-       /*
-        * Initialise the present map, which describes the set of CPUs
-        * actually populated at the present time.
-        */
-       for (i = 0; i < max_cpus; i++)
-               set_cpu_present(i, true);
 
        scu_enable(scu_base_addr());
        wakeup_secondary();
index 765a71ff7f3b5d6ef95fc76cdd95b2e9836367d8..bfd32f52c2dbebf0dbe175ee343dcc37ad78d6f7 100644 (file)
@@ -229,10 +229,6 @@ static void ct_ca9x4_init_cpu_map(void)
 
 static void ct_ca9x4_smp_enable(unsigned int max_cpus)
 {
-       int i;
-       for (i = 0; i < max_cpus; i++)
-               set_cpu_present(i, true);
-
        scu_enable(MMIO_P2V(A9_MPCORE_SCU));
 }
 #endif