]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - arch/powerpc/kernel/smp.c
powerpc/smp: Call smp_ops->setup_cpu() directly on the boot CPU
[karo-tx-linux.git] / arch / powerpc / kernel / smp.c
index 1069f74fca47b77c4cab348f41a522317e6af88e..b0ea6d4d4853c90f63db6d0c2da8d8202bebacf4 100644 (file)
@@ -33,6 +33,7 @@
 #include <linux/notifier.h>
 #include <linux/topology.h>
 #include <linux/profile.h>
+#include <linux/processor.h>
 
 #include <asm/ptrace.h>
 #include <linux/atomic.h>
@@ -112,7 +113,8 @@ int smp_generic_cpu_bootable(unsigned int nr)
 #ifdef CONFIG_PPC64
 int smp_generic_kick_cpu(int nr)
 {
-       BUG_ON(nr < 0 || nr >= NR_CPUS);
+       if (nr < 0 || nr >= nr_cpu_ids)
+               return -EINVAL;
 
        /*
         * The processor is currently spinning, waiting for the
@@ -766,8 +768,7 @@ int __cpu_up(unsigned int cpu, struct task_struct *tidle)
                smp_ops->give_timebase();
 
        /* Wait until cpu puts itself in the online & active maps */
-       while (!cpu_online(cpu))
-               cpu_relax();
+       spin_until_cond(cpu_online(cpu));
 
        return 0;
 }
@@ -984,21 +985,13 @@ static struct sched_domain_topology_level powerpc_topology[] = {
        { NULL, },
 };
 
-static __init long smp_setup_cpu_workfn(void *data __always_unused)
-{
-       smp_ops->setup_cpu(boot_cpuid);
-       return 0;
-}
-
 void __init smp_cpus_done(unsigned int max_cpus)
 {
        /*
-        * We want the setup_cpu() here to be called on the boot CPU, but
-        * init might run on any CPU, so make sure it's invoked on the boot
-        * CPU.
+        * We are running pinned to the boot CPU, see rest_init().
         */
        if (smp_ops && smp_ops->setup_cpu)
-               work_on_cpu_safe(boot_cpuid, smp_setup_cpu_workfn, NULL);
+               smp_ops->setup_cpu(boot_cpuid);
 
        if (smp_ops && smp_ops->bringup_done)
                smp_ops->bringup_done();