aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/irq_32.c
diff options
context:
space:
mode:
authorYinghai Lu <yhlu.kernel@gmail.com>2008-08-19 23:50:27 -0400
committerIngo Molnar <mingo@elte.hu>2008-10-16 10:52:53 -0400
commit199751d715bba5b469ea22adadc68a4166bfa4f5 (patch)
treebc7edd6d16d75637fbe00d906636c1c879acedc8 /arch/x86/kernel/irq_32.c
parent0f978f4505e96227a89b3c9447552aca983c6b57 (diff)
x86: make 32 bit to use sparse_irq
but actually irq still needs to be less than NR_IRQS, because interrupt[NR_IRQS] in entry.S. need to enable per_cpu vector... Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/irq_32.c')
-rw-r--r--arch/x86/kernel/irq_32.c37
1 files changed, 28 insertions, 9 deletions
diff --git a/arch/x86/kernel/irq_32.c b/arch/x86/kernel/irq_32.c
index 576c5df6cad..0a57e39159a 100644
--- a/arch/x86/kernel/irq_32.c
+++ b/arch/x86/kernel/irq_32.c
@@ -224,9 +224,10 @@ unsigned int do_IRQ(struct pt_regs *regs)
224 struct pt_regs *old_regs; 224 struct pt_regs *old_regs;
225 /* high bit used in ret_from_ code */ 225 /* high bit used in ret_from_ code */
226 int overflow, irq = ~regs->orig_ax; 226 int overflow, irq = ~regs->orig_ax;
227 struct irq_desc *desc = irq_to_desc(irq); 227 struct irq_desc *desc;
228 228
229 if (unlikely((unsigned)irq >= nr_irqs)) { 229 desc = irq_to_desc(irq);
230 if (unlikely(!desc)) {
230 printk(KERN_EMERG "%s: cannot handle IRQ %d\n", 231 printk(KERN_EMERG "%s: cannot handle IRQ %d\n",
231 __func__, irq); 232 __func__, irq);
232 BUG(); 233 BUG();
@@ -263,6 +264,24 @@ int show_interrupts(struct seq_file *p, void *v)
263 int i = *(loff_t *) v, j; 264 int i = *(loff_t *) v, j;
264 struct irqaction * action; 265 struct irqaction * action;
265 unsigned long flags; 266 unsigned long flags;
267 unsigned int entries;
268 struct irq_desc *desc;
269 int tail = 0;
270
271#ifdef CONFIG_HAVE_SPARSE_IRQ
272 desc = (struct irq_desc *)v;
273 entries = -1U;
274 i = desc->irq;
275 if (!desc->next)
276 tail = 1;
277#else
278 entries = nr_irqs - 1;
279 i = *(loff_t *) v;
280 if (i == nr_irqs)
281 tail = 1;
282 else
283 desc = irq_to_desc(i);
284#endif
266 285
267 if (i == 0) { 286 if (i == 0) {
268 seq_printf(p, " "); 287 seq_printf(p, " ");
@@ -271,9 +290,8 @@ int show_interrupts(struct seq_file *p, void *v)
271 seq_putc(p, '\n'); 290 seq_putc(p, '\n');
272 } 291 }
273 292
274 if (i < nr_irqs) { 293 if (i <= entries) {
275 unsigned any_count = 0; 294 unsigned any_count = 0;
276 struct irq_desc *desc = irq_to_desc(i);
277 295
278 spin_lock_irqsave(&desc->lock, flags); 296 spin_lock_irqsave(&desc->lock, flags);
279#ifndef CONFIG_SMP 297#ifndef CONFIG_SMP
@@ -285,7 +303,7 @@ int show_interrupts(struct seq_file *p, void *v)
285 action = desc->action; 303 action = desc->action;
286 if (!action && !any_count) 304 if (!action && !any_count)
287 goto skip; 305 goto skip;
288 seq_printf(p, "%3d: ",i); 306 seq_printf(p, "%#x: ",i);
289#ifndef CONFIG_SMP 307#ifndef CONFIG_SMP
290 seq_printf(p, "%10u ", kstat_irqs(i)); 308 seq_printf(p, "%10u ", kstat_irqs(i));
291#else 309#else
@@ -304,7 +322,9 @@ int show_interrupts(struct seq_file *p, void *v)
304 seq_putc(p, '\n'); 322 seq_putc(p, '\n');
305skip: 323skip:
306 spin_unlock_irqrestore(&desc->lock, flags); 324 spin_unlock_irqrestore(&desc->lock, flags);
307 } else if (i == nr_irqs) { 325 }
326
327 if (tail) {
308 seq_printf(p, "NMI: "); 328 seq_printf(p, "NMI: ");
309 for_each_online_cpu(j) 329 for_each_online_cpu(j)
310 seq_printf(p, "%10u ", nmi_count(j)); 330 seq_printf(p, "%10u ", nmi_count(j));
@@ -396,15 +416,14 @@ void fixup_irqs(cpumask_t map)
396{ 416{
397 unsigned int irq; 417 unsigned int irq;
398 static int warned; 418 static int warned;
419 struct irq_desc *desc;
399 420
400 for (irq = 0; irq < nr_irqs; irq++) { 421 for_each_irq_desc(irq, desc) {
401 cpumask_t mask; 422 cpumask_t mask;
402 struct irq_desc *desc;
403 423
404 if (irq == 2) 424 if (irq == 2)
405 continue; 425 continue;
406 426
407 desc = irq_to_desc(irq);
408 cpus_and(mask, desc->affinity, map); 427 cpus_and(mask, desc->affinity, map);
409 if (any_online_cpu(mask) == NR_CPUS) { 428 if (any_online_cpu(mask) == NR_CPUS) {
410 printk("Breaking affinity for irq %i\n", irq); 429 printk("Breaking affinity for irq %i\n", irq);