Skip to content

Commit eee4526

Browse files
Ivan KokshayskyLinus Torvalds
authored andcommitted
[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 <[email protected]> Cc: Christoph Hellwig <[email protected]> Cc: Richard Henderson <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 1fa744e commit eee4526

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

include/linux/irq.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,17 @@ extern void note_interrupt(unsigned int irq, irq_desc_t *desc,
221221
extern int can_request_irq(unsigned int irq, unsigned long irqflags);
222222

223223
extern void init_irq_proc(void);
224+
225+
#ifdef CONFIG_AUTO_IRQ_AFFINITY
226+
extern int select_smp_affinity(unsigned int irq);
227+
#else
228+
static inline int
229+
select_smp_affinity(unsigned int irq)
230+
{
231+
return 1;
232+
}
233+
#endif
234+
224235
#endif
225236

226237
extern hw_irq_controller no_irq_type; /* needed in every arch ? */

kernel/irq/manage.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,8 @@ int request_irq(unsigned int irq,
366366
action->next = NULL;
367367
action->dev_id = dev_id;
368368

369+
select_smp_affinity(irq);
370+
369371
retval = setup_irq(irq, action);
370372
if (retval)
371373
kfree(action);

kernel/irq/proc.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ static int irq_affinity_write_proc(struct file *file, const char __user *buffer,
6868
*/
6969
cpus_and(tmp, new_value, cpu_online_map);
7070
if (cpus_empty(tmp))
71-
return -EINVAL;
71+
/* Special case for empty set - allow the architecture
72+
code to set default SMP affinity. */
73+
return select_smp_affinity(irq) ? -EINVAL : full_count;
7274

7375
proc_set_irq_affinity(irq, new_value);
7476

0 commit comments

Comments
 (0)