Merge branch 'topic/paca' into next
[linux-2.6-block.git] / arch / powerpc / kernel / prom.c
index 330c65f04820e29bae77ea76570b69b5a30c38e6..9dbed488aba1a12b78b997990f6282f9ce16fcb6 100644 (file)
@@ -365,7 +365,6 @@ static int __init early_init_dt_scan_cpus(unsigned long node,
        DBG("boot cpu: logical %d physical %d\n", found,
            be32_to_cpu(intserv[found_thread]));
        boot_cpuid = found;
-       set_hard_smp_processor_id(found, be32_to_cpu(intserv[found_thread]));
 
        /*
         * PAPR defines "logical" PVR values for cpus that
@@ -403,7 +402,9 @@ static int __init early_init_dt_scan_cpus(unsigned long node,
                cur_cpu_spec->cpu_features &= ~CPU_FTR_SMT;
        else if (!dt_cpu_ftrs_in_use())
                cur_cpu_spec->cpu_features |= CPU_FTR_SMT;
+       allocate_paca(boot_cpuid);
 #endif
+       set_hard_smp_processor_id(found, be32_to_cpu(intserv[found_thread]));
 
        return 0;
 }
@@ -744,7 +745,7 @@ void __init early_init_devtree(void *params)
         * FIXME .. and the initrd too? */
        move_device_tree();
 
-       allocate_pacas();
+       allocate_paca_ptrs();
 
        DBG("Scanning CPUs ...\n");
 
@@ -874,5 +875,15 @@ EXPORT_SYMBOL(cpu_to_chip_id);
 
 bool arch_match_cpu_phys_id(int cpu, u64 phys_id)
 {
+#ifdef CONFIG_SMP
+       /*
+        * Early firmware scanning must use this rather than
+        * get_hard_smp_processor_id because we don't have pacas allocated
+        * until memory topology is discovered.
+        */
+       if (cpu_to_phys_id != NULL)
+               return (int)phys_id == cpu_to_phys_id[cpu];
+#endif
+
        return (int)phys_id == get_hard_smp_processor_id(cpu);
 }