]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
x86: add handle_irq() to allow interrupt injection
authorJeremy Fitzhardinge <jeremy@goop.org>
Fri, 6 Feb 2009 22:09:40 +0000 (14:09 -0800)
committerIngo Molnar <mingo@elte.hu>
Mon, 9 Feb 2009 11:15:57 +0000 (12:15 +0100)
Xen uses a different interrupt path, so introduce handle_irq() to
allow interrupts to be inserted into the normal interrupt path.  This
is handled slightly differently on 32 and 64-bit.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/include/asm/irq.h
arch/x86/kernel/irq_32.c
arch/x86/kernel/irq_64.c

index 592688ed04d33462d172936d56dff55fc6e52eac..d0f6f7d1771cc832728c9db642c8895a96e5ce5f 100644 (file)
@@ -39,6 +39,7 @@ extern void fixup_irqs(void);
 extern unsigned int do_IRQ(struct pt_regs *regs);
 extern void init_IRQ(void);
 extern void native_init_IRQ(void);
+extern bool handle_irq(unsigned irq, struct pt_regs *regs);
 
 /* Interrupt vector management */
 extern DECLARE_BITMAP(used_vectors, NR_VECTORS);
index d802c844991eac56df8303b7f50796ce625b70b7..61f09fb969ee6303e1d9023b1f6824348d13b220 100644 (file)
@@ -191,6 +191,26 @@ static inline int
 execute_on_irq_stack(int overflow, struct irq_desc *desc, int irq) { return 0; }
 #endif
 
+bool handle_irq(unsigned irq, struct pt_regs *regs)
+{
+       struct irq_desc *desc;
+       int overflow;
+
+       overflow = check_stack_overflow();
+
+       desc = irq_to_desc(irq);
+       if (unlikely(!desc))
+               return false;
+
+       if (!execute_on_irq_stack(overflow, desc, irq)) {
+               if (unlikely(overflow))
+                       print_stack_overflow();
+               desc->handle_irq(irq, desc);
+       }
+
+       return true;
+}
+
 /*
  * do_IRQ handles all normal device IRQ's (the special
  * SMP cross-CPU interrupts have their own specific
@@ -200,31 +220,19 @@ unsigned int do_IRQ(struct pt_regs *regs)
 {
        struct pt_regs *old_regs;
        /* high bit used in ret_from_ code */
-       int overflow;
        unsigned vector = ~regs->orig_ax;
-       struct irq_desc *desc;
        unsigned irq;
 
-
        old_regs = set_irq_regs(regs);
        irq_enter();
        irq = __get_cpu_var(vector_irq)[vector];
 
-       overflow = check_stack_overflow();
-
-       desc = irq_to_desc(irq);
-       if (unlikely(!desc)) {
+       if (!handle_irq(irq, regs)) {
                printk(KERN_EMERG "%s: cannot handle IRQ %d vector %#x cpu %d\n",
                                        __func__, irq, vector, smp_processor_id());
                BUG();
        }
 
-       if (!execute_on_irq_stack(overflow, desc, irq)) {
-               if (unlikely(overflow))
-                       print_stack_overflow();
-               desc->handle_irq(irq, desc);
-       }
-
        irq_exit();
        set_irq_regs(old_regs);
        return 1;
index 018963aa6ee3fe1ab391808e88c9265e7a1fea51..a93f3b0dc7f25d90a91253cb4626c9fa52d73707 100644 (file)
@@ -48,6 +48,20 @@ static inline void stack_overflow_check(struct pt_regs *regs)
 #endif
 }
 
+bool handle_irq(unsigned irq, struct pt_regs *regs)
+{
+       struct irq_desc *desc;
+
+       stack_overflow_check(regs);
+
+       desc = irq_to_desc(irq);
+       if (unlikely(!desc))
+               return false;
+
+       generic_handle_irq_desc(irq, desc);
+       return true;
+}
+
 /*
  * do_IRQ handles all normal device IRQ's (the special
  * SMP cross-CPU interrupts have their own specific
@@ -56,7 +70,6 @@ static inline void stack_overflow_check(struct pt_regs *regs)
 asmlinkage unsigned int __irq_entry do_IRQ(struct pt_regs *regs)
 {
        struct pt_regs *old_regs = set_irq_regs(regs);
-       struct irq_desc *desc;
 
        /* high bit used in ret_from_ code  */
        unsigned vector = ~regs->orig_ax;
@@ -64,14 +77,10 @@ asmlinkage unsigned int __irq_entry do_IRQ(struct pt_regs *regs)
 
        exit_idle();
        irq_enter();
-       irq = __get_cpu_var(vector_irq)[vector];
 
-       stack_overflow_check(regs);
+       irq = __get_cpu_var(vector_irq)[vector];
 
-       desc = irq_to_desc(irq);
-       if (likely(desc))
-               generic_handle_irq_desc(irq, desc);
-       else {
+       if (!handle_irq(irq, regs)) {
                if (!disable_apic)
                        ack_APIC_irq();