Changeset fd67c9f in mainline for kernel/arch


Ignore:
Timestamp:
2019-04-06T08:10:27Z (7 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
534bcdf
Parents:
ef56a43
Message:

Handle PIC spurious IRQs with care

Location:
kernel/arch
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/amd64/src/interrupt.c

    ref56a43 rfd67c9f  
    172172        bool ack = false;
    173173        assert(inum < IRQ_COUNT);
    174         assert(inum != IRQ_PIC0_SPUR);
    175         assert(inum != IRQ_PIC1_SPUR);
    176174        assert(inum != IRQ_PIC1);
    177175
     
    190188                irq_spinlock_unlock(&irq->lock, false);
    191189        } else {
    192                 /*
    193                  * Spurious interrupt.
    194                  */
    195190#ifdef CONFIG_DEBUG
    196                 log(LF_ARCH, LVL_DEBUG, "cpu%u: spurious interrupt (inum=%u)",
    197                     CPU->id, inum);
     191                log(LF_ARCH, LVL_DEBUG, "cpu%u: unhandled IRQ %u", CPU->id,
     192                    inum);
    198193#endif
    199194        }
     
    205200static void pic_spurious(unsigned int n, istate_t *istate)
    206201{
    207         /*
    208          * XXX: Examine ISR to figure out whether this is indeed a spurious
    209          *      or actual IRQ.
    210          */
     202        unsigned int inum = n - IVT_IRQBASE;
     203        if (!pic_is_spurious(inum)) {
     204                /* This is actually not a spurious IRQ, so proceed as usual. */
     205                irq_interrupt(n, istate);
     206                return;
     207        }
     208        pic_handle_spurious(n);
    211209#ifdef CONFIG_DEBUG
    212         log(LF_ARCH, LVL_DEBUG, "cpu%u: PIC spurious interrupt", CPU->id);
     210        log(LF_ARCH, LVL_DEBUG, "cpu%u: PIC spurious interrupt %u", CPU->id,
     211            inum);
    213212#endif
    214213}
  • kernel/arch/ia32/src/interrupt.c

    ref56a43 rfd67c9f  
    192192        bool ack = false;
    193193        assert(inum < IRQ_COUNT);
    194         assert(inum != IRQ_PIC0_SPUR);
    195         assert(inum != IRQ_PIC1_SPUR);
    196194        assert(inum != IRQ_PIC1);
    197195
     
    210208                irq_spinlock_unlock(&irq->lock, false);
    211209        } else {
    212                 /*
    213                  * Spurious interrupt.
    214                  */
    215210#ifdef CONFIG_DEBUG
    216                 printf("cpu%u: spurious interrupt (inum=%u)\n", CPU->id, inum);
     211                log(LF_ARCH, LVL_DEBUG, "cpu%u: unhandled IRQ %u", CPU->id,
     212                    inum);
    217213#endif
    218214        }
     
    224220static void pic_spurious(unsigned int n, istate_t *istate)
    225221{
    226         /*
    227          * XXX: Examine ISR to figure out whether this is indeed a spurious
    228          *      or actual IRQ.
    229          */
     222        unsigned int inum = n - IVT_IRQBASE;
     223        if (!pic_is_spurious(inum)) {
     224                /* This is actually not a spurious IRQ, so proceed as usual. */
     225                irq_interrupt(n, istate);
     226                return;
     227        }
     228        pic_handle_spurious(n);
    230229#ifdef CONFIG_DEBUG
    231         log(LF_ARCH, LVL_DEBUG, "cpu%u: PIC spurious interrupt", CPU->id);
     230        log(LF_ARCH, LVL_DEBUG, "cpu%u: PIC spurious interrupt %u", CPU->id,
     231            inum);
    232232#endif
    233233}
  • kernel/arch/mips32/include/arch/mach/malta/malta.h

    ref56a43 rfd67c9f  
    4545
    4646#define PIC0_BASE               (MALTA_PCI_BASE + 0x20)
    47 #define PIC0_SPURIOUS_IRQ       7
    4847#define PIC1_BASE               (MALTA_PCI_BASE + 0xa0)
    49 #define PIC1_SPURIOUS_IRQ       15
    5048
    5149#define ISA_IRQ_COUNT           16
  • kernel/arch/mips32/src/mach/malta/malta.c

    ref56a43 rfd67c9f  
    7474{
    7575        uint8_t isa_irq = host2uint32_t_le(pio_read_32(GT64120_PCI0_INTACK));
    76         if (isa_irq == PIC0_SPURIOUS_IRQ || isa_irq == PIC1_SPURIOUS_IRQ) {
    77                 /*
    78                  * XXX: Examine ISR to figure out whether this is indeed a
    79                  *      spurious or actual IRQ.
    80                  */
     76        if (pic_is_spurious(isa_irq)) {
     77                pic_handle_spurious(isa_irq);
    8178#ifdef CONFIG_DEBUG
    82                 log(LF_ARCH, LVL_DEBUG, "cpu%u: PIC spurious interrupt",
    83                     CPU->id);
     79                log(LF_ARCH, LVL_DEBUG, "cpu%u: PIC spurious interrupt %u",
     80                    CPU->id, isa_irq);
    8481                return;
    8582#endif
     
    9188        } else {
    9289#ifdef CONFIG_DEBUG
    93                 log(LF_ARCH, LVL_DEBUG, "cpu%u: spurious IRQ (irq=%u)",
     90                log(LF_ARCH, LVL_DEBUG, "cpu%u: unhandled IRQ (irq=%u)",
    9491                    CPU->id, isa_irq);
    9592#endif
Note: See TracChangeset for help on using the changeset viewer.