]> git.neil.brown.name Git - history.git/commitdiff
PPC32: interrupt fixes along the lines of Ingo's changes to x86.
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>
Tue, 6 Aug 2002 06:22:08 +0000 (16:22 +1000)
committerPaul Mackerras <paulus@samba.org>
Tue, 6 Aug 2002 06:22:08 +0000 (16:22 +1000)
We don't unmask the interrupt at the end of handling it if there
is no action (i.e. someone has done free_irq).  Add some likely
and unlikely hints and fix synchronize_irq.

arch/ppc/kernel/i8259.c
arch/ppc/kernel/irq.c
arch/ppc/kernel/open_pic.c
arch/ppc/kernel/ppc4xx_pic.c
arch/ppc/kernel/ppc8260_pic.c
arch/ppc/kernel/ppc8xx_pic.c
arch/ppc/platforms/pmac_pic.c

index 1872114131aaec47eacee8887815f9a338ae9044..2b1c376faa2eaebe0dc6c9fae173fc4fea5cd936 100644 (file)
@@ -130,7 +130,8 @@ static void i8259_unmask_irq(unsigned int irq_nr)
 
 static void i8259_end_irq(unsigned int irq)
 {
-       if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
+       if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))
+           && irq_desc[irq].action)
                i8259_unmask_irq(irq);
 }
 
index eb0428beaf4a91f244bfc97aa2f52393f87d8940..6479e7ef326a6c5dc805adc9f3a21bb1e7978345 100644 (file)
@@ -443,7 +443,7 @@ void ppc_irq_dispatch_handler(struct pt_regs *regs, int irq)
         * use the action we have.
         */
        action = NULL;
-       if (!(status & (IRQ_DISABLED | IRQ_INPROGRESS))) {
+       if (likely(!(status & (IRQ_DISABLED | IRQ_INPROGRESS)))) {
                action = desc->action;
                if (!action || !action->handler) {
                        ppc_spurious_interrupts++;
@@ -468,7 +468,7 @@ void ppc_irq_dispatch_handler(struct pt_regs *regs, int irq)
           a different instance of this same irq, the other processor
           will take care of it.
         */
-       if (!action)
+       if (unlikely(!action))
                goto out;
 
 
@@ -487,12 +487,12 @@ void ppc_irq_dispatch_handler(struct pt_regs *regs, int irq)
                handle_irq_event(irq, regs, action);
                spin_lock(&desc->lock);
                
-               if (!(desc->status & IRQ_PENDING))
+               if (likely(!(desc->status & IRQ_PENDING)))
                        break;
                desc->status &= ~IRQ_PENDING;
        }
-       desc->status &= ~IRQ_INPROGRESS;
 out:
+       desc->status &= ~IRQ_INPROGRESS;
        /*
         * The ->end() handler has to deal with interrupts which got
         * disabled while the handler was running.
@@ -561,10 +561,6 @@ void __init init_IRQ(void)
 #ifdef CONFIG_SMP
 void synchronize_irq(unsigned int irq)
 {
-        /* is there anything to synchronize with? */
-       if (!irq_desc[irq].action)
-               return;
-
        while (irq_desc[irq].status & IRQ_INPROGRESS)
                barrier();
 }
index 685cbf4637691a44abc06ebc46b6cf11a831a7a9..5e5ee5cddd63d3e89c3628d1f884327c4a634e24 100644 (file)
@@ -25,6 +25,7 @@
 #include <asm/sections.h>
 #include <asm/open_pic.h>
 #include <asm/i8259.h>
+#include <asm/hardirq.h>
 
 #include "open_pic_defs.h"
 
@@ -798,7 +799,8 @@ static void openpic_ack_irq(unsigned int irq_nr)
 
 static void openpic_end_irq(unsigned int irq_nr)
 {
-       if (!(irq_desc[irq_nr].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
+       if (!(irq_desc[irq_nr].status & (IRQ_DISABLED|IRQ_INPROGRESS))
+           && irq_desc[irq_nr].action)
                openpic_enable_irq(irq_nr);
 }
 
index 6619898dbe97abd1668b01b7ce1d6d06d5a33062..a7cc37a8a12c846b5fb31164fef35443b9225fc7 100644 (file)
@@ -236,7 +236,8 @@ ppc405_uic_end(unsigned int irq)
                }
        }
 
-       if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS))) {
+       if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS))
+           && irq_desc[irq].action) {
                ppc_cached_irq_mask[word] |= 1 << (31 - bit);
                switch (word){
                        case 0:
index b2ae5e951aefc9ce5dc03cf9218dcb62ca6d3383..15262f92e6f172593046e0722b9cba6bf58e7de9 100644 (file)
@@ -90,7 +90,8 @@ static void m8260_end_irq(unsigned int irq_nr)
        int     bit, word;
        volatile uint   *simr;
 
-       if (!(irq_desc[irq_nr].status & (IRQ_DISABLED|IRQ_INPROGRESS))) {
+       if (!(irq_desc[irq_nr].status & (IRQ_DISABLED|IRQ_INPROGRESS))
+                       && irq_desc[irq_nr].action) {
 
                bit = irq_to_siubit[irq_nr];
                word = irq_to_siureg[irq_nr];
index a952d85ea01a54e989887a4c805e86431f6211c4..4cf470c094d50caa653df8079e4488cf8d5b3450 100644 (file)
@@ -46,7 +46,8 @@ static void m8xx_unmask_irq(unsigned int irq_nr)
 
 static void m8xx_end_irq(unsigned int irq_nr)
 {
-       if (!(irq_desc[irq_nr].status & (IRQ_DISABLED|IRQ_INPROGRESS))) {
+       if (!(irq_desc[irq_nr].status & (IRQ_DISABLED|IRQ_INPROGRESS))
+                       && irq_desc[irq_nr].action) {
                int bit, word;
 
                bit = irq_nr & 0x1f;
index 5ee8e42e0bdd2339f940434b1f8c4ddc13c57076..fdc3c8b5bf29a4abb3939c70bf59b082ac31a358 100644 (file)
@@ -149,7 +149,8 @@ static void __pmac pmac_unmask_irq(unsigned int irq_nr)
 
 static void __pmac pmac_end_irq(unsigned int irq_nr)
 {
-       if (!(irq_desc[irq_nr].status & (IRQ_DISABLED|IRQ_INPROGRESS))) {
+       if (!(irq_desc[irq_nr].status & (IRQ_DISABLED|IRQ_INPROGRESS))
+           && irq_desc[irq_nr].action) {
                set_bit(irq_nr, ppc_cached_irq_mask);
                pmac_set_irq_mask(irq_nr, 1);
        }