IRQ: Maintain regs pointer globally rather than passing to IRQ handlers
[powerpc.git] / arch / i386 / mach-voyager / voyager_smp.c
index 70e560a..d42422f 100644 (file)
@@ -9,7 +9,6 @@
  * This file provides all the same external entries as smp.c but uses
  * the voyager hal to provide the functionality
  */
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/mm.h>
 #include <linux/kernel_stat.h>
@@ -100,6 +99,7 @@ static void do_boot_cpu(__u8 cpuid);
 static void do_quad_bootstrap(void);
 
 int hard_smp_processor_id(void);
+int safe_smp_processor_id(void);
 
 /* Inline functions */
 static inline void
@@ -126,10 +126,10 @@ send_QIC_CPI(__u32 cpuset, __u8 cpi)
 }
 
 static inline void
-wrapper_smp_local_timer_interrupt(struct pt_regs *regs)
+wrapper_smp_local_timer_interrupt(void)
 {
        irq_enter();
-       smp_local_timer_interrupt(regs);
+       smp_local_timer_interrupt();
        irq_exit();
 }
 
@@ -661,6 +661,7 @@ do_boot_cpu(__u8 cpu)
                print_cpu_info(&cpu_data[cpu]);
                wmb();
                cpu_set(cpu, cpu_callout_map);
+               cpu_set(cpu, cpu_present_map);
        }
        else {
                printk("CPU%d FAILED TO BOOT: ", cpu);
@@ -785,7 +786,7 @@ fastcall void
 smp_vic_sys_interrupt(struct pt_regs *regs)
 {
        ack_CPI(VIC_SYS_INT);
-       printk("Voyager SYSTEM INTERRUPT\n");
+       printk("Voyager SYSTEM INTERRUPT\n");   
 }
 
 /* Handle a voyager CMN_INT; These interrupts occur either because of
@@ -1134,7 +1135,9 @@ EXPORT_SYMBOL(smp_call_function);
 fastcall void 
 smp_apic_timer_interrupt(struct pt_regs *regs)
 {
-       wrapper_smp_local_timer_interrupt(regs);
+       struct pt_regs *old_regs = set_irq_regs(regs);
+       wrapper_smp_local_timer_interrupt();
+       set_irq_regs(old_regs);
 }
 
 /* All of the QUAD interrupt GATES */
@@ -1142,7 +1145,9 @@ fastcall void
 smp_qic_timer_interrupt(struct pt_regs *regs)
 {
        ack_QIC_CPI(QIC_TIMER_CPI);
-       wrapper_smp_local_timer_interrupt(regs);
+       struct pt_regs *old_regs = set_irq_regs(regs);
+       wrapper_smp_local_timer_interrupt(void);
+       set_irq_regs(old_regs);
 }
 
 fastcall void
@@ -1176,6 +1181,7 @@ smp_qic_call_function_interrupt(struct pt_regs *regs)
 fastcall void
 smp_vic_cpi_interrupt(struct pt_regs *regs)
 {
+       struct pt_regs *old_regs = set_irq_regs(regs);
        __u8 cpu = smp_processor_id();
 
        if(is_cpu_quad())
@@ -1184,7 +1190,7 @@ smp_vic_cpi_interrupt(struct pt_regs *regs)
                ack_VIC_CPI(VIC_CPI_LEVEL0);
 
        if(test_and_clear_bit(VIC_TIMER_CPI, &vic_cpi_mailbox[cpu]))
-               wrapper_smp_local_timer_interrupt(regs);
+               wrapper_smp_local_timer_interrupt();
        if(test_and_clear_bit(VIC_INVALIDATE_CPI, &vic_cpi_mailbox[cpu]))
                smp_invalidate_interrupt();
        if(test_and_clear_bit(VIC_RESCHEDULE_CPI, &vic_cpi_mailbox[cpu]))
@@ -1193,6 +1199,7 @@ smp_vic_cpi_interrupt(struct pt_regs *regs)
                smp_enable_irq_interrupt();
        if(test_and_clear_bit(VIC_CALL_FUNCTION_CPI, &vic_cpi_mailbox[cpu]))
                smp_call_function_interrupt();
+       set_irq_regs(old_regs);
 }
 
 static void
@@ -1247,6 +1254,12 @@ hard_smp_processor_id(void)
        return 0;
 }
 
+int
+safe_smp_processor_id(void)
+{
+       return hard_smp_processor_id();
+}
+
 /* broadcast a halt to all other CPUs */
 void
 smp_send_stop(void)
@@ -1259,8 +1272,10 @@ smp_send_stop(void)
 void
 smp_vic_timer_interrupt(struct pt_regs *regs)
 {
+       struct pt_regs *old_regs = set_irq_regs(regs);
        send_CPI_allbutself(VIC_TIMER_CPI);
-       smp_local_timer_interrupt(regs);
+       smp_local_timer_interrupt();
+       set_irq_regs(old_regs);
 }
 
 /* local (per CPU) timer interrupt.  It does both profiling and
@@ -1272,12 +1287,12 @@ smp_vic_timer_interrupt(struct pt_regs *regs)
  * value into /proc/profile.
  */
 void
-smp_local_timer_interrupt(struct pt_regs * regs)
+smp_local_timer_interrupt(void)
 {
        int cpu = smp_processor_id();
        long weight;
 
-       profile_tick(CPU_PROFILING, regs);
+       profile_tick(CPU_PROFILING);
        if (--per_cpu(prof_counter, cpu) <= 0) {
                /*
                 * The multiplier may have changed since the last time we got
@@ -1295,7 +1310,7 @@ smp_local_timer_interrupt(struct pt_regs * regs)
                                                per_cpu(prof_counter, cpu);
                }
 
-               update_process_times(user_mode_vm(regs));
+               update_process_times(user_mode_vm(irq_regs));
        }
 
        if( ((1<<cpu) & voyager_extended_vic_processors) == 0)
@@ -1418,7 +1433,7 @@ smp_intr_init(void)
         * This is for later: first 16 correspond to PC IRQs; next 16
         * are Primary MC IRQs and final 16 are Secondary MC IRQs */
        for(i = 0; i < 48; i++)
-               irq_desc[i].handler = &vic_irq_type;
+               irq_desc[i].chip = &vic_irq_type;
 }
 
 /* send a CPI at level cpi to a set of cpus in cpuset (set 1 bit per
@@ -1912,6 +1927,7 @@ void __devinit smp_prepare_boot_cpu(void)
        cpu_set(smp_processor_id(), cpu_online_map);
        cpu_set(smp_processor_id(), cpu_callout_map);
        cpu_set(smp_processor_id(), cpu_possible_map);
+       cpu_set(smp_processor_id(), cpu_present_map);
 }
 
 int __devinit
@@ -1936,3 +1952,9 @@ smp_cpus_done(unsigned int max_cpus)
 {
        zap_low_mappings();
 }
+
+void __init
+smp_setup_processor_id(void)
+{
+       current_thread_info()->cpu = hard_smp_processor_id();
+}