![Ingo Molnar](/assets/img/avatar_default.png)
This patch-queue improves the generic IRQ layer to be truly generic, by adding various abstractions and features to it, without impacting existing functionality. While the queue can be best described as "fix and improve everything in the generic IRQ layer that we could think of", and thus it consists of many smaller features and lots of cleanups, the one feature that stands out most is the new 'irq chip' abstraction. The irq-chip abstraction is about describing and coding and IRQ controller driver by mapping its raw hardware capabilities [and quirks, if needed] in a straightforward way, without having to think about "IRQ flow" (level/edge/etc.) type of details. This stands in contrast with the current 'irq-type' model of genirq architectures, which 'mixes' raw hardware capabilities with 'flow' details. The patchset supports both types of irq controller designs at once, and converts i386 and x86_64 to the new irq-chip design. As a bonus side-effect of the irq-chip approach, chained interrupt controllers (master/slave PIC constructs, etc.) are now supported by design as well. The end result of this patchset intends to be simpler architecture-level code and more consolidation between architectures. We reused many bits of code and many concepts from Russell King's ARM IRQ layer, the merging of which was one of the motivations for this patchset. This patch: rename desc->handler to desc->chip. Originally i did not want to do this, because it's a big patch. But having both "desc->handler", "desc->handle_irq" and "action->handler" caused a large degree of confusion and made the code appear alot less clean than it truly is. I have also attempted a dual approach as well by introducing a desc->chip alias - but that just wasnt robust enough and broke frequently. So lets get over with this quickly. The conversion was done automatically via scripts and converts all the code in the kernel. This renaming patch is the first one amongst the patches, so that the remaining patches can stay flexible and can be merged and split up without having some big monolithic patch act as a merge barrier. [akpm@osdl.org: build fix] [akpm@osdl.org: another build fix] Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
124 lines
3.1 KiB
C
124 lines
3.1 KiB
C
/*
|
|
* arch/v850/kernel/irq.c -- High-level interrupt handling
|
|
*
|
|
* Copyright (C) 2001,02,03,04,05 NEC Electronics Corporation
|
|
* Copyright (C) 2001,02,03,04,05 Miles Bader <miles@gnu.org>
|
|
* Copyright (C) 1994-2000 Ralf Baechle
|
|
* Copyright (C) 1992 Linus Torvalds
|
|
*
|
|
* This file is subject to the terms and conditions of the GNU General
|
|
* Public License. See the file COPYING in the main directory of this
|
|
* archive for more details.
|
|
*
|
|
* This file was was derived from the mips version, arch/mips/kernel/irq.c
|
|
*/
|
|
|
|
#include <linux/kernel.h>
|
|
#include <linux/module.h>
|
|
#include <linux/irq.h>
|
|
#include <linux/init.h>
|
|
#include <linux/interrupt.h>
|
|
#include <linux/kernel_stat.h>
|
|
#include <linux/slab.h>
|
|
#include <linux/mm.h>
|
|
#include <linux/random.h>
|
|
#include <linux/seq_file.h>
|
|
|
|
#include <asm/system.h>
|
|
|
|
/*
|
|
* 'what should we do if we get a hw irq event on an illegal vector'.
|
|
* each architecture has to answer this themselves, it doesn't deserve
|
|
* a generic callback i think.
|
|
*/
|
|
void ack_bad_irq(unsigned int irq)
|
|
{
|
|
printk("received IRQ %d with unknown interrupt type\n", irq);
|
|
}
|
|
|
|
volatile unsigned long irq_err_count, spurious_count;
|
|
|
|
/*
|
|
* Generic, controller-independent functions:
|
|
*/
|
|
|
|
int show_interrupts(struct seq_file *p, void *v)
|
|
{
|
|
int irq = *(loff_t *) v;
|
|
|
|
if (irq == 0) {
|
|
int cpu;
|
|
seq_puts(p, " ");
|
|
for (cpu=0; cpu < 1 /*smp_num_cpus*/; cpu++)
|
|
seq_printf(p, "CPU%d ", cpu);
|
|
seq_putc(p, '\n');
|
|
}
|
|
|
|
if (irq < NR_IRQS) {
|
|
unsigned long flags;
|
|
struct irqaction *action;
|
|
|
|
spin_lock_irqsave(&irq_desc[irq].lock, flags);
|
|
|
|
action = irq_desc[irq].action;
|
|
if (action) {
|
|
int j;
|
|
int count = 0;
|
|
int num = -1;
|
|
const char *type_name = irq_desc[irq].chip->typename;
|
|
|
|
for (j = 0; j < NR_IRQS; j++)
|
|
if (irq_desc[j].chip->typename == type_name){
|
|
if (irq == j)
|
|
num = count;
|
|
count++;
|
|
}
|
|
|
|
seq_printf(p, "%3d: ",irq);
|
|
seq_printf(p, "%10u ", kstat_irqs(irq));
|
|
if (count > 1) {
|
|
int prec = (num >= 100 ? 3 : num >= 10 ? 2 : 1);
|
|
seq_printf(p, " %*s%d", 14 - prec,
|
|
type_name, num);
|
|
} else
|
|
seq_printf(p, " %14s", type_name);
|
|
|
|
seq_printf(p, " %s", action->name);
|
|
for (action=action->next; action; action = action->next)
|
|
seq_printf(p, ", %s", action->name);
|
|
seq_putc(p, '\n');
|
|
}
|
|
|
|
spin_unlock_irqrestore(&irq_desc[irq].lock, flags);
|
|
} else if (irq == NR_IRQS)
|
|
seq_printf(p, "ERR: %10lu\n", irq_err_count);
|
|
|
|
return 0;
|
|
}
|
|
|
|
/* Handle interrupt IRQ. REGS are the registers at the time of ther
|
|
interrupt. */
|
|
unsigned int handle_irq (int irq, struct pt_regs *regs)
|
|
{
|
|
irq_enter();
|
|
__do_IRQ(irq, regs);
|
|
irq_exit();
|
|
return 1;
|
|
}
|
|
|
|
/* Initialize irq handling for IRQs.
|
|
BASE_IRQ, BASE_IRQ+INTERVAL, ..., BASE_IRQ+NUM*INTERVAL
|
|
to IRQ_TYPE. An IRQ_TYPE of 0 means to use a generic interrupt type. */
|
|
void __init
|
|
init_irq_handlers (int base_irq, int num, int interval,
|
|
struct hw_interrupt_type *irq_type)
|
|
{
|
|
while (num-- > 0) {
|
|
irq_desc[base_irq].status = IRQ_DISABLED;
|
|
irq_desc[base_irq].action = NULL;
|
|
irq_desc[base_irq].depth = 1;
|
|
irq_desc[base_irq].chip = irq_type;
|
|
base_irq += interval;
|
|
}
|
|
}
|