diff options
| author | Ralf Baechle <ralf@linux-mips.org> | 2008-02-08 07:22:01 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-08 12:22:42 -0500 |
| commit | 46f4f8f665080900e865392f4b3593be463bf0d8 (patch) | |
| tree | d4d1cb04b461b4ddd841396647d911fdc08819ef | |
| parent | 922f9cfa79b52c85b6002d96cb0eefd13437c58c (diff) | |
IRQ_NOPROBE helper functions
Probing non-ISA interrupts using the handle_percpu_irq as their handle_irq
method may crash the system because handle_percpu_irq does not check
IRQ_WAITING. This for example hits the MIPS Qemu configuration.
This patch provides two helper functions set_irq_noprobe and set_irq_probe to
set rsp. clear the IRQ_NOPROBE flag. The only current caller is MIPS code
but this really belongs into generic code.
As an aside, interrupt probing these days has become a mostly obsolete if not
dangerous art. I think Linux interrupts should be changed to default to
non-probing but that's subject of this patch.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Acked-and-tested-by: Rob Landley <rob@landley.net>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
| -rw-r--r-- | include/linux/irq.h | 3 | ||||
| -rw-r--r-- | kernel/irq/chip.c | 36 |
2 files changed, 39 insertions, 0 deletions
diff --git a/include/linux/irq.h b/include/linux/irq.h index a19b381d4112..bfd9efb5cb49 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h | |||
| @@ -367,6 +367,9 @@ set_irq_chained_handler(unsigned int irq, | |||
| 367 | __set_irq_handler(irq, handle, 1, NULL); | 367 | __set_irq_handler(irq, handle, 1, NULL); |
| 368 | } | 368 | } |
| 369 | 369 | ||
| 370 | extern void set_irq_noprobe(unsigned int irq); | ||
| 371 | extern void set_irq_probe(unsigned int irq); | ||
| 372 | |||
| 370 | /* Handle dynamic irq creation and destruction */ | 373 | /* Handle dynamic irq creation and destruction */ |
| 371 | extern int create_irq(void); | 374 | extern int create_irq(void); |
| 372 | extern void destroy_irq(unsigned int irq); | 375 | extern void destroy_irq(unsigned int irq); |
diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c index 10e006643c8c..cc54c6276356 100644 --- a/kernel/irq/chip.c +++ b/kernel/irq/chip.c | |||
| @@ -589,3 +589,39 @@ set_irq_chip_and_handler_name(unsigned int irq, struct irq_chip *chip, | |||
| 589 | set_irq_chip(irq, chip); | 589 | set_irq_chip(irq, chip); |
| 590 | __set_irq_handler(irq, handle, 0, name); | 590 | __set_irq_handler(irq, handle, 0, name); |
| 591 | } | 591 | } |
| 592 | |||
| 593 | void __init set_irq_noprobe(unsigned int irq) | ||
| 594 | { | ||
| 595 | struct irq_desc *desc; | ||
| 596 | unsigned long flags; | ||
| 597 | |||
| 598 | if (irq >= NR_IRQS) { | ||
| 599 | printk(KERN_ERR "Trying to mark IRQ%d non-probeable\n", irq); | ||
| 600 | |||
| 601 | return; | ||
| 602 | } | ||
| 603 | |||
| 604 | desc = irq_desc + irq; | ||
| 605 | |||
| 606 | spin_lock_irqsave(&desc->lock, flags); | ||
| 607 | desc->status |= IRQ_NOPROBE; | ||
| 608 | spin_unlock_irqrestore(&desc->lock, flags); | ||
| 609 | } | ||
| 610 | |||
| 611 | void __init set_irq_probe(unsigned int irq) | ||
| 612 | { | ||
| 613 | struct irq_desc *desc; | ||
| 614 | unsigned long flags; | ||
| 615 | |||
| 616 | if (irq >= NR_IRQS) { | ||
| 617 | printk(KERN_ERR "Trying to mark IRQ%d probeable\n", irq); | ||
| 618 | |||
| 619 | return; | ||
| 620 | } | ||
| 621 | |||
| 622 | desc = irq_desc + irq; | ||
| 623 | |||
| 624 | spin_lock_irqsave(&desc->lock, flags); | ||
| 625 | desc->status &= ~IRQ_NOPROBE; | ||
| 626 | spin_unlock_irqrestore(&desc->lock, flags); | ||
| 627 | } | ||
