@@ -432,6 +432,7 @@ void __init smp_prepare_boot_cpu(void)
void __init smp_prepare_cpus(unsigned int max_cpus)
{
+ unsigned int cpu, max;
unsigned int ncores = num_possible_cpus();
init_cpu_topology();
@@ -443,15 +444,29 @@ 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).
+ */
+ max = max_cpus;
+ max--;
+ for_each_possible_cpu(cpu) {
+ if (max == 0)
+ break;
+
+ if (cpu == smp_processor_id())
+ continue;
+
+ set_cpu_present(cpu, true);
+ max--;
+ }
+
+ if (ncores > 1 && max_cpus) {
/*
* Initialise the SCU if there are more than one CPU
* and let them know where to start.