tree a8ed14ee532ea8dabc1010d540542eea1d620540 parent 1fa744e6e91a895750b9980d13fcfc5791a0cd91 author Ivan Kokshaysky Fri, 06 Jan 2006 16:12:21 -0800 committer Linus Torvalds Sat, 07 Jan 2006 00:33:40 -0800 [PATCH] Alpha: convert to generic irq framework (generic part) Thanks to Christoph for doing most of the work. This allows automatic SMP IRQ affinity assignment other than default "all interrupts on all CPUs" which is rather expensive. This might be useful if the hardware can be programmed to distribute interrupts among different CPUs, like Alpha does. Signed-off-by: Ivan Kokshaysky Cc: Christoph Hellwig Cc: Richard Henderson Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds include/linux/irq.h | 11 +++++++++++ kernel/irq/manage.c | 2 ++ kernel/irq/proc.c | 4 +++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/include/linux/irq.h b/include/linux/irq.h index f04ba20..60f8bc7 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h @@ -221,6 +221,17 @@ extern void note_interrupt(unsigned int extern int can_request_irq(unsigned int irq, unsigned long irqflags); extern void init_irq_proc(void); + +#ifdef CONFIG_AUTO_IRQ_AFFINITY +extern int select_smp_affinity(unsigned int irq); +#else +static inline int +select_smp_affinity(unsigned int irq) +{ + return 1; +} +#endif + #endif extern hw_irq_controller no_irq_type; /* needed in every arch ? */ diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c index 81c49a4..97d5559 100644 --- a/kernel/irq/manage.c +++ b/kernel/irq/manage.c @@ -366,6 +366,8 @@ int request_irq(unsigned int irq, action->next = NULL; action->dev_id = dev_id; + select_smp_affinity(irq); + retval = setup_irq(irq, action); if (retval) kfree(action); diff --git a/kernel/irq/proc.c b/kernel/irq/proc.c index f26e534..8a64a48 100644 --- a/kernel/irq/proc.c +++ b/kernel/irq/proc.c @@ -68,7 +68,9 @@ static int irq_affinity_write_proc(struc */ cpus_and(tmp, new_value, cpu_online_map); if (cpus_empty(tmp)) - return -EINVAL; + /* Special case for empty set - allow the architecture + code to set default SMP affinity. */ + return select_smp_affinity(irq) ? -EINVAL : full_count; proc_set_irq_affinity(irq, new_value);