aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/irq/proc.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/irq/proc.c')
-rw-r--r--kernel/irq/proc.c88
1 files changed, 84 insertions, 4 deletions
diff --git a/kernel/irq/proc.c b/kernel/irq/proc.c
index 6c8a2a9f8a7b..dd201bd35103 100644
--- a/kernel/irq/proc.c
+++ b/kernel/irq/proc.c
@@ -11,6 +11,7 @@
11#include <linux/proc_fs.h> 11#include <linux/proc_fs.h>
12#include <linux/seq_file.h> 12#include <linux/seq_file.h>
13#include <linux/interrupt.h> 13#include <linux/interrupt.h>
14#include <linux/kernel_stat.h>
14 15
15#include "internals.h" 16#include "internals.h"
16 17
@@ -24,7 +25,7 @@ static int irq_affinity_proc_show(struct seq_file *m, void *v)
24 const struct cpumask *mask = desc->irq_data.affinity; 25 const struct cpumask *mask = desc->irq_data.affinity;
25 26
26#ifdef CONFIG_GENERIC_PENDING_IRQ 27#ifdef CONFIG_GENERIC_PENDING_IRQ
27 if (desc->status & IRQ_MOVE_PENDING) 28 if (irqd_is_setaffinity_pending(&desc->irq_data))
28 mask = desc->pending_mask; 29 mask = desc->pending_mask;
29#endif 30#endif
30 seq_cpumask(m, mask); 31 seq_cpumask(m, mask);
@@ -65,8 +66,7 @@ static ssize_t irq_affinity_proc_write(struct file *file,
65 cpumask_var_t new_value; 66 cpumask_var_t new_value;
66 int err; 67 int err;
67 68
68 if (!irq_to_desc(irq)->irq_data.chip->irq_set_affinity || no_irq_affinity || 69 if (!irq_can_set_affinity(irq) || no_irq_affinity)
69 irq_balancing_disabled(irq))
70 return -EIO; 70 return -EIO;
71 71
72 if (!alloc_cpumask_var(&new_value, GFP_KERNEL)) 72 if (!alloc_cpumask_var(&new_value, GFP_KERNEL))
@@ -89,7 +89,7 @@ static ssize_t irq_affinity_proc_write(struct file *file,
89 if (!cpumask_intersects(new_value, cpu_online_mask)) { 89 if (!cpumask_intersects(new_value, cpu_online_mask)) {
90 /* Special case for empty set - allow the architecture 90 /* Special case for empty set - allow the architecture
91 code to set default SMP affinity. */ 91 code to set default SMP affinity. */
92 err = irq_select_affinity_usr(irq) ? -EINVAL : count; 92 err = irq_select_affinity_usr(irq, new_value) ? -EINVAL : count;
93 } else { 93 } else {
94 irq_set_affinity(irq, new_value); 94 irq_set_affinity(irq, new_value);
95 err = count; 95 err = count;
@@ -357,3 +357,83 @@ void init_irq_proc(void)
357 } 357 }
358} 358}
359 359
360#ifdef CONFIG_GENERIC_IRQ_SHOW
361
362int __weak arch_show_interrupts(struct seq_file *p, int prec)
363{
364 return 0;
365}
366
367#ifndef ACTUAL_NR_IRQS
368# define ACTUAL_NR_IRQS nr_irqs
369#endif
370
371int show_interrupts(struct seq_file *p, void *v)
372{
373 static int prec;
374
375 unsigned long flags, any_count = 0;
376 int i = *(loff_t *) v, j;
377 struct irqaction *action;
378 struct irq_desc *desc;
379
380 if (i > ACTUAL_NR_IRQS)
381 return 0;
382
383 if (i == ACTUAL_NR_IRQS)
384 return arch_show_interrupts(p, prec);
385
386 /* print header and calculate the width of the first column */
387 if (i == 0) {
388 for (prec = 3, j = 1000; prec < 10 && j <= nr_irqs; ++prec)
389 j *= 10;
390
391 seq_printf(p, "%*s", prec + 8, "");
392 for_each_online_cpu(j)
393 seq_printf(p, "CPU%-8d", j);
394 seq_putc(p, '\n');
395 }
396
397 desc = irq_to_desc(i);
398 if (!desc)
399 return 0;
400
401 raw_spin_lock_irqsave(&desc->lock, flags);
402 for_each_online_cpu(j)
403 any_count |= kstat_irqs_cpu(i, j);
404 action = desc->action;
405 if (!action && !any_count)
406 goto out;
407
408 seq_printf(p, "%*d: ", prec, i);
409 for_each_online_cpu(j)
410 seq_printf(p, "%10u ", kstat_irqs_cpu(i, j));
411
412 if (desc->irq_data.chip) {
413 if (desc->irq_data.chip->irq_print_chip)
414 desc->irq_data.chip->irq_print_chip(&desc->irq_data, p);
415 else if (desc->irq_data.chip->name)
416 seq_printf(p, " %8s", desc->irq_data.chip->name);
417 else
418 seq_printf(p, " %8s", "-");
419 } else {
420 seq_printf(p, " %8s", "None");
421 }
422#ifdef CONFIG_GENIRC_IRQ_SHOW_LEVEL
423 seq_printf(p, " %-8s", irqd_is_level_type(&desc->irq_data) ? "Level" : "Edge");
424#endif
425 if (desc->name)
426 seq_printf(p, "-%-8s", desc->name);
427
428 if (action) {
429 seq_printf(p, " %s", action->name);
430 while ((action = action->next) != NULL)
431 seq_printf(p, ", %s", action->name);
432 }
433
434 seq_putc(p, '\n');
435out:
436 raw_spin_unlock_irqrestore(&desc->lock, flags);
437 return 0;
438}
439#endif