Commit eecd3bdb authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] Fix xics IRQ affinity

From: Anton Blanchard <anton@samba.org>

- Merge some whitespace differences with the ameslab tree
- We check for CPU_MASK_ALL in xics to send irqs to all cpus.
  In some cases CPU_MASK_ALL is smaller than the cpumask (eg
  NR_CPUS == 32 and cpumask is a long), so we mask it here to
  be consistent.
parent 09cce79c
...@@ -66,7 +66,7 @@ irq_desc_t irq_desc[NR_IRQS] __cacheline_aligned = { ...@@ -66,7 +66,7 @@ irq_desc_t irq_desc[NR_IRQS] __cacheline_aligned = {
.lock = SPIN_LOCK_UNLOCKED .lock = SPIN_LOCK_UNLOCKED
} }
}; };
int ppc_spurious_interrupts = 0; int ppc_spurious_interrupts = 0;
unsigned long lpEvent_count = 0; unsigned long lpEvent_count = 0;
...@@ -183,6 +183,7 @@ do_free_irq(int irq, void* dev_id) ...@@ -183,6 +183,7 @@ do_free_irq(int irq, void* dev_id)
return -ENOENT; return -ENOENT;
} }
int request_irq(unsigned int irq, int request_irq(unsigned int irq,
irqreturn_t (*handler)(int, void *, struct pt_regs *), irqreturn_t (*handler)(int, void *, struct pt_regs *),
unsigned long irqflags, const char * devname, void *dev_id) unsigned long irqflags, const char * devname, void *dev_id)
...@@ -195,25 +196,25 @@ int request_irq(unsigned int irq, ...@@ -195,25 +196,25 @@ int request_irq(unsigned int irq,
if (!handler) if (!handler)
/* We could implement really free_irq() instead of that... */ /* We could implement really free_irq() instead of that... */
return do_free_irq(irq, dev_id); return do_free_irq(irq, dev_id);
action = (struct irqaction *) action = (struct irqaction *)
kmalloc(sizeof(struct irqaction), GFP_KERNEL); kmalloc(sizeof(struct irqaction), GFP_KERNEL);
if (!action) { if (!action) {
printk(KERN_ERR "kmalloc() failed for irq %d !\n", irq); printk(KERN_ERR "kmalloc() failed for irq %d !\n", irq);
return -ENOMEM; return -ENOMEM;
} }
action->handler = handler; action->handler = handler;
action->flags = irqflags; action->flags = irqflags;
action->mask = 0; action->mask = 0;
action->name = devname; action->name = devname;
action->dev_id = dev_id; action->dev_id = dev_id;
action->next = NULL; action->next = NULL;
retval = setup_irq(irq, action); retval = setup_irq(irq, action);
if (retval) if (retval)
kfree(action); kfree(action);
return 0; return 0;
} }
...@@ -342,13 +343,13 @@ int show_interrupts(struct seq_file *p, void *v) ...@@ -342,13 +343,13 @@ int show_interrupts(struct seq_file *p, void *v)
action = irq_desc[i].action; action = irq_desc[i].action;
if (!action || !action->handler) if (!action || !action->handler)
goto skip; goto skip;
seq_printf(p, "%3d: ", i); seq_printf(p, "%3d: ", i);
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
for (j = 0; j < NR_CPUS; j++) { for (j = 0; j < NR_CPUS; j++) {
if (cpu_online(j)) if (cpu_online(j))
seq_printf(p, "%10u ", kstat_cpu(j).irqs[i]); seq_printf(p, "%10u ", kstat_cpu(j).irqs[i]);
} }
#else #else
seq_printf(p, "%10u ", kstat_irqs(i)); seq_printf(p, "%10u ", kstat_irqs(i));
#endif /* CONFIG_SMP */ #endif /* CONFIG_SMP */
if (irq_desc[i].handler) if (irq_desc[i].handler)
...@@ -670,7 +671,7 @@ void __init init_IRQ(void) ...@@ -670,7 +671,7 @@ void __init init_IRQ(void)
return; return;
once++; once++;
ppc_md.init_IRQ(); ppc_md.init_IRQ();
} }
...@@ -699,6 +700,7 @@ static int irq_affinity_write_proc (struct file *file, const char *buffer, ...@@ -699,6 +700,7 @@ static int irq_affinity_write_proc (struct file *file, const char *buffer,
{ {
int irq = (long)data, full_count = count, err; int irq = (long)data, full_count = count, err;
cpumask_t new_value, tmp; cpumask_t new_value, tmp;
cpumask_t allcpus = CPU_MASK_ALL;
if (!irq_desc[irq].handler->set_affinity) if (!irq_desc[irq].handler->set_affinity)
return -EIO; return -EIO;
...@@ -707,6 +709,14 @@ static int irq_affinity_write_proc (struct file *file, const char *buffer, ...@@ -707,6 +709,14 @@ static int irq_affinity_write_proc (struct file *file, const char *buffer,
if (err) if (err)
return err; return err;
/*
* We check for CPU_MASK_ALL in xics to send irqs to all cpus.
* In some cases CPU_MASK_ALL is smaller than the cpumask (eg
* NR_CPUS == 32 and cpumask is a long), so we mask it here to
* be consistent.
*/
cpus_and(new_value, new_value, allcpus);
/* /*
* Do not allow disabling IRQs completely - it's a too easy * Do not allow disabling IRQs completely - it's a too easy
* way to make the system unusable accidentally :-) At least * way to make the system unusable accidentally :-) At least
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment