@@ -443,15 +443,31 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
*/
if (max_cpus > ncores)
max_cpus = ncores;
- if (ncores > 1 && max_cpus) {
- /*
- * Initialise the present map, which describes the set of CPUs
- * actually populated at the present time. A platform should
- * re-initialize the map in the platforms smp_prepare_cpus()
- * if present != possible (e.g. physical hotplug).
- */
- init_cpu_present(cpu_possible_mask);
+ /* Don't bother if we're effectively UP */
+ if (max_cpus <= 1)
+ return;
+
+ /*
+ * Initialise the present map (which describes the set of CPUs
+ * actually populated at the present time) and release the
+ * secondaries from the bootloader.
+ *
+ * Make sure we online at most (max_cpus - 1) additional CPUs.
+ */
+ max_cpus--;
+ for_each_possible_cpu(cpu) {
+ if (max_cpus == 0)
+ break;
+
+ if (cpu == smp_processor_id())
+ continue;
+
+ set_cpu_present(cpu, true);
+ max_cpus--;
+ }
+
+ if (ncores > 1 && max_cpus) {
/*
* Initialise the SCU if there are more than one CPU
* and let them know where to start.