Merge branch 'clk' of http://ftp.arm.linux.org.uk/pub/linux/arm/kernel/git-cur/linux...
[pandora-kernel.git] / arch / arm / kernel / smp.c
index 3f12ce9..94f34a6 100644 (file)
@@ -16,7 +16,6 @@
 #include <linux/cache.h>
 #include <linux/profile.h>
 #include <linux/errno.h>
-#include <linux/ftrace.h>
 #include <linux/mm.h>
 #include <linux/err.h>
 #include <linux/cpu.h>
@@ -31,6 +30,7 @@
 #include <asm/cacheflush.h>
 #include <asm/cpu.h>
 #include <asm/cputype.h>
+#include <asm/exception.h>
 #include <asm/topology.h>
 #include <asm/mmu_context.h>
 #include <asm/pgtable.h>
@@ -319,17 +319,7 @@ asmlinkage void __cpuinit secondary_start_kernel(void)
         */
        platform_secondary_init(cpu);
 
-       /*
-        * Enable local interrupts.
-        */
        notify_cpu_starting(cpu);
-       local_irq_enable();
-       local_fiq_enable();
-
-       /*
-        * Setup the percpu timer for this CPU.
-        */
-       percpu_timer_setup();
 
        calibrate_delay();
 
@@ -341,9 +331,22 @@ asmlinkage void __cpuinit secondary_start_kernel(void)
         * before we continue.
         */
        set_cpu_online(cpu, true);
+
+       /*
+        * Setup the percpu timer for this CPU.
+        */
+       percpu_timer_setup();
+
        while (!cpu_active(cpu))
                cpu_relax();
 
+       /*
+        * cpu_active bit is set, so it's safe to enalbe interrupts
+        * now.
+        */
+       local_irq_enable();
+       local_fiq_enable();
+
        /*
         * OK, it's off to the idle thread for us
         */
@@ -479,6 +482,11 @@ static void ipi_timer(void)
 
 #ifdef CONFIG_LOCAL_TIMERS
 asmlinkage void __exception_irq_entry do_local_timer(struct pt_regs *regs)
+{
+       handle_local_timer(regs);
+}
+
+void handle_local_timer(struct pt_regs *regs)
 {
        struct pt_regs *old_regs = set_irq_regs(regs);
        int cpu = smp_processor_id();
@@ -558,7 +566,7 @@ static void percpu_timer_stop(void)
 }
 #endif
 
-static DEFINE_SPINLOCK(stop_lock);
+static DEFINE_RAW_SPINLOCK(stop_lock);
 
 /*
  * ipi_cpu_stop - handle IPI from smp_send_stop()
@@ -567,10 +575,10 @@ static void ipi_cpu_stop(unsigned int cpu)
 {
        if (system_state == SYSTEM_BOOTING ||
            system_state == SYSTEM_RUNNING) {
-               spin_lock(&stop_lock);
+               raw_spin_lock(&stop_lock);
                printk(KERN_CRIT "CPU%u: stopping\n", cpu);
                dump_stack();
-               spin_unlock(&stop_lock);
+               raw_spin_unlock(&stop_lock);
        }
 
        set_cpu_online(cpu, false);
@@ -586,6 +594,11 @@ static void ipi_cpu_stop(unsigned int cpu)
  * Main handler for inter-processor interrupts
  */
 asmlinkage void __exception_irq_entry do_IPI(int ipinr, struct pt_regs *regs)
+{
+       handle_IPI(ipinr, regs);
+}
+
+void handle_IPI(int ipinr, struct pt_regs *regs)
 {
        unsigned int cpu = smp_processor_id();
        struct pt_regs *old_regs = set_irq_regs(regs);