diff options
Diffstat (limited to 'kernel/irq/proc.c')
-rw-r--r-- | kernel/irq/proc.c | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/kernel/irq/proc.c b/kernel/irq/proc.c index 6f50eccc79c0..09a2ee540bd2 100644 --- a/kernel/irq/proc.c +++ b/kernel/irq/proc.c | |||
@@ -7,6 +7,7 @@ | |||
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/irq.h> | 9 | #include <linux/irq.h> |
10 | #include <linux/gfp.h> | ||
10 | #include <linux/proc_fs.h> | 11 | #include <linux/proc_fs.h> |
11 | #include <linux/seq_file.h> | 12 | #include <linux/seq_file.h> |
12 | #include <linux/interrupt.h> | 13 | #include <linux/interrupt.h> |
@@ -31,6 +32,27 @@ static int irq_affinity_proc_show(struct seq_file *m, void *v) | |||
31 | return 0; | 32 | return 0; |
32 | } | 33 | } |
33 | 34 | ||
35 | static int irq_affinity_hint_proc_show(struct seq_file *m, void *v) | ||
36 | { | ||
37 | struct irq_desc *desc = irq_to_desc((long)m->private); | ||
38 | unsigned long flags; | ||
39 | cpumask_var_t mask; | ||
40 | |||
41 | if (!zalloc_cpumask_var(&mask, GFP_KERNEL)) | ||
42 | return -ENOMEM; | ||
43 | |||
44 | raw_spin_lock_irqsave(&desc->lock, flags); | ||
45 | if (desc->affinity_hint) | ||
46 | cpumask_copy(mask, desc->affinity_hint); | ||
47 | raw_spin_unlock_irqrestore(&desc->lock, flags); | ||
48 | |||
49 | seq_cpumask(m, mask); | ||
50 | seq_putc(m, '\n'); | ||
51 | free_cpumask_var(mask); | ||
52 | |||
53 | return 0; | ||
54 | } | ||
55 | |||
34 | #ifndef is_affinity_mask_valid | 56 | #ifndef is_affinity_mask_valid |
35 | #define is_affinity_mask_valid(val) 1 | 57 | #define is_affinity_mask_valid(val) 1 |
36 | #endif | 58 | #endif |
@@ -83,6 +105,11 @@ static int irq_affinity_proc_open(struct inode *inode, struct file *file) | |||
83 | return single_open(file, irq_affinity_proc_show, PDE(inode)->data); | 105 | return single_open(file, irq_affinity_proc_show, PDE(inode)->data); |
84 | } | 106 | } |
85 | 107 | ||
108 | static int irq_affinity_hint_proc_open(struct inode *inode, struct file *file) | ||
109 | { | ||
110 | return single_open(file, irq_affinity_hint_proc_show, PDE(inode)->data); | ||
111 | } | ||
112 | |||
86 | static const struct file_operations irq_affinity_proc_fops = { | 113 | static const struct file_operations irq_affinity_proc_fops = { |
87 | .open = irq_affinity_proc_open, | 114 | .open = irq_affinity_proc_open, |
88 | .read = seq_read, | 115 | .read = seq_read, |
@@ -91,6 +118,13 @@ static const struct file_operations irq_affinity_proc_fops = { | |||
91 | .write = irq_affinity_proc_write, | 118 | .write = irq_affinity_proc_write, |
92 | }; | 119 | }; |
93 | 120 | ||
121 | static const struct file_operations irq_affinity_hint_proc_fops = { | ||
122 | .open = irq_affinity_hint_proc_open, | ||
123 | .read = seq_read, | ||
124 | .llseek = seq_lseek, | ||
125 | .release = single_release, | ||
126 | }; | ||
127 | |||
94 | static int default_affinity_show(struct seq_file *m, void *v) | 128 | static int default_affinity_show(struct seq_file *m, void *v) |
95 | { | 129 | { |
96 | seq_cpumask(m, irq_default_affinity); | 130 | seq_cpumask(m, irq_default_affinity); |
@@ -146,6 +180,26 @@ static const struct file_operations default_affinity_proc_fops = { | |||
146 | .release = single_release, | 180 | .release = single_release, |
147 | .write = default_affinity_write, | 181 | .write = default_affinity_write, |
148 | }; | 182 | }; |
183 | |||
184 | static int irq_node_proc_show(struct seq_file *m, void *v) | ||
185 | { | ||
186 | struct irq_desc *desc = irq_to_desc((long) m->private); | ||
187 | |||
188 | seq_printf(m, "%d\n", desc->node); | ||
189 | return 0; | ||
190 | } | ||
191 | |||
192 | static int irq_node_proc_open(struct inode *inode, struct file *file) | ||
193 | { | ||
194 | return single_open(file, irq_node_proc_show, PDE(inode)->data); | ||
195 | } | ||
196 | |||
197 | static const struct file_operations irq_node_proc_fops = { | ||
198 | .open = irq_node_proc_open, | ||
199 | .read = seq_read, | ||
200 | .llseek = seq_lseek, | ||
201 | .release = single_release, | ||
202 | }; | ||
149 | #endif | 203 | #endif |
150 | 204 | ||
151 | static int irq_spurious_proc_show(struct seq_file *m, void *v) | 205 | static int irq_spurious_proc_show(struct seq_file *m, void *v) |
@@ -230,6 +284,13 @@ void register_irq_proc(unsigned int irq, struct irq_desc *desc) | |||
230 | /* create /proc/irq/<irq>/smp_affinity */ | 284 | /* create /proc/irq/<irq>/smp_affinity */ |
231 | proc_create_data("smp_affinity", 0600, desc->dir, | 285 | proc_create_data("smp_affinity", 0600, desc->dir, |
232 | &irq_affinity_proc_fops, (void *)(long)irq); | 286 | &irq_affinity_proc_fops, (void *)(long)irq); |
287 | |||
288 | /* create /proc/irq/<irq>/affinity_hint */ | ||
289 | proc_create_data("affinity_hint", 0400, desc->dir, | ||
290 | &irq_affinity_hint_proc_fops, (void *)(long)irq); | ||
291 | |||
292 | proc_create_data("node", 0444, desc->dir, | ||
293 | &irq_node_proc_fops, (void *)(long)irq); | ||
233 | #endif | 294 | #endif |
234 | 295 | ||
235 | proc_create_data("spurious", 0444, desc->dir, | 296 | proc_create_data("spurious", 0444, desc->dir, |