[PATCH] Alpha: convert to generic irq framework (generic part)
authorIvan Kokshaysky <ink@jurassic.park.msu.ru>
Fri, 6 Jan 2006 08:12:21 +0000 (00:12 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Fri, 6 Jan 2006 16:33:40 +0000 (08:33 -0800)
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 <ink@jurassic.park.msu.ru>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Richard Henderson <rth@twiddle.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
include/linux/irq.h
kernel/irq/manage.c
kernel/irq/proc.c

index f04ba20712a2968cba8d9e77e31c2d716f157830..60f8bc78a35a9c8a1ec9625cebe57853cc129200 100644 (file)
@@ -221,6 +221,17 @@ extern void note_interrupt(unsigned int irq, irq_desc_t *desc,
 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 ? */
index 81c49a4d679eb03e54b9be8bb70d5f8f98447a41..97d5559997d28d1b4811b5ed5d1b267cc8715a49 100644 (file)
@@ -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);
index f26e534c6585dacf089be5fb602f70b08ee6db60..8a64a4844cdeeda11fd2286e17b9d9f977a7fa76 100644 (file)
@@ -68,7 +68,9 @@ static int irq_affinity_write_proc(struct file *file, const char __user *buffer,
         */
        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);