Commit a06f916b authored by Russell King's avatar Russell King

ARM: smp: fix clipping of number of CPUs

Rather than clipping the number of CPUs using the compile-time NR_CPUS
constant, use the runtime nr_cpu_ids value instead.  This allows the
nr_cpus command line option to work as expected.

Cc: <stable@kernel.org>
Reported-by: default avatarMark Salter <msalter@redhat.com>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 5a567d78
...@@ -191,12 +191,10 @@ void __init smp_init_cpus(void) ...@@ -191,12 +191,10 @@ void __init smp_init_cpus(void)
ncores = scu_base ? scu_get_core_count(scu_base) : 1; ncores = scu_base ? scu_get_core_count(scu_base) : 1;
/* sanity check */ /* sanity check */
if (ncores > NR_CPUS) { if (ncores > nr_cpu_ids) {
printk(KERN_WARNING pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
"EXYNOS4: no. of cores (%d) greater than configured " ncores, nr_cpu_ids);
"maximum of %d - clipping\n", ncores = nr_cpu_ids;
ncores, NR_CPUS);
ncores = NR_CPUS;
} }
for (i = 0; i < ncores; i++) for (i = 0; i < ncores; i++)
......
...@@ -156,6 +156,12 @@ void __init smp_init_cpus(void) ...@@ -156,6 +156,12 @@ void __init smp_init_cpus(void)
{ {
unsigned int i, ncores = get_core_count(); unsigned int i, ncores = get_core_count();
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++) for (i = 0; i < ncores; i++)
set_cpu_possible(i, true); set_cpu_possible(i, true);
......
...@@ -109,12 +109,10 @@ void __init smp_init_cpus(void) ...@@ -109,12 +109,10 @@ void __init smp_init_cpus(void)
ncores = scu_get_core_count(scu_base); ncores = scu_get_core_count(scu_base);
/* sanity check */ /* sanity check */
if (ncores > NR_CPUS) { if (ncores > nr_cpu_ids) {
printk(KERN_WARNING pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
"OMAP4: no. of cores (%d) greater than configured " ncores, nr_cpu_ids);
"maximum of %d - clipping\n", ncores = nr_cpu_ids;
ncores, NR_CPUS);
ncores = NR_CPUS;
} }
for (i = 0; i < ncores; i++) for (i = 0; i < ncores; i++)
......
...@@ -52,12 +52,10 @@ void __init smp_init_cpus(void) ...@@ -52,12 +52,10 @@ void __init smp_init_cpus(void)
ncores = scu_base ? scu_get_core_count(scu_base) : 1; ncores = scu_base ? scu_get_core_count(scu_base) : 1;
/* sanity check */ /* sanity check */
if (ncores > NR_CPUS) { if (ncores > nr_cpu_ids) {
printk(KERN_WARNING pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
"Realview: no. of cores (%d) greater than configured " ncores, nr_cpu_ids);
"maximum of %d - clipping\n", ncores = nr_cpu_ids;
ncores, NR_CPUS);
ncores = NR_CPUS;
} }
for (i = 0; i < ncores; i++) for (i = 0; i < ncores; i++)
......
...@@ -56,6 +56,12 @@ void __init smp_init_cpus(void) ...@@ -56,6 +56,12 @@ void __init smp_init_cpus(void)
unsigned int ncores = shmobile_smp_get_core_count(); unsigned int ncores = shmobile_smp_get_core_count();
unsigned int i; 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++) for (i = 0; i < ncores; i++)
set_cpu_possible(i, true); set_cpu_possible(i, true);
......
...@@ -114,10 +114,10 @@ void __init smp_init_cpus(void) ...@@ -114,10 +114,10 @@ void __init smp_init_cpus(void)
{ {
unsigned int i, ncores = scu_get_core_count(scu_base); unsigned int i, ncores = scu_get_core_count(scu_base);
if (ncores > NR_CPUS) { if (ncores > nr_cpu_ids) {
printk(KERN_ERR "Tegra: no. of cores (%u) greater than configured (%u), clipping\n", pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
ncores, NR_CPUS); ncores, nr_cpu_ids);
ncores = NR_CPUS; ncores = nr_cpu_ids;
} }
for (i = 0; i < ncores; i++) for (i = 0; i < ncores; i++)
......
...@@ -156,12 +156,10 @@ void __init smp_init_cpus(void) ...@@ -156,12 +156,10 @@ void __init smp_init_cpus(void)
ncores = scu_base ? scu_get_core_count(scu_base) : 1; ncores = scu_base ? scu_get_core_count(scu_base) : 1;
/* sanity check */ /* sanity check */
if (ncores > NR_CPUS) { if (ncores > nr_cpu_ids) {
printk(KERN_WARNING pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
"U8500: no. of cores (%d) greater than configured " ncores, nr_cpu_ids);
"maximum of %d - clipping\n", ncores = nr_cpu_ids;
ncores, NR_CPUS);
ncores = NR_CPUS;
} }
for (i = 0; i < ncores; i++) for (i = 0; i < ncores; i++)
......
...@@ -221,6 +221,12 @@ static void ct_ca9x4_init_cpu_map(void) ...@@ -221,6 +221,12 @@ static void ct_ca9x4_init_cpu_map(void)
{ {
int i, ncores = scu_get_core_count(MMIO_P2V(A9_MPCORE_SCU)); int i, ncores = scu_get_core_count(MMIO_P2V(A9_MPCORE_SCU));
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) for (i = 0; i < ncores; ++i)
set_cpu_possible(i, true); set_cpu_possible(i, true);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment