aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2011-04-06 17:01:44 -0400
committerThomas Gleixner <tglx@linutronix.de>2011-04-23 09:56:24 -0400
commit7f1b1244e159a8490d7fb13667c6cb7e1e75046b (patch)
tree1d5f5ff0ec14e3ac84d4ec17b0de4d43dacf8118
parent770767787c23040dc152e7ae230597ff55b39470 (diff)
genirq: Support per-IRQ thread disabling.
This adds support for disabling threading on a per-IRQ basis via the IRQ status instead of the IRQ flow, which is necessary for interrupts that don't follow the natural IRQ flow channels, such as those that are virtually created. The new APIs added are simply: irq_set_thread() irq_set_nothread() which follow the rest of the IRQ status routines. Chained handlers also have IRQ_NOTHREAD set on them automatically, making the lack of threading explicit rather than implicit. Subsequently, the nothread flag can be viewed through the standard genirq debugging facilities. [ tglx: Fixed cleanup fallout ] Signed-off-by: Paul Mundt <lethal@linux-sh.org> Link: http://lkml.kernel.org/r/%3C20110406210135.GF18426%40linux-sh.org%3E Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r--include/linux/irq.h14
-rw-r--r--kernel/irq/chip.c1
-rw-r--r--kernel/irq/debug.h1
-rw-r--r--kernel/irq/manage.c3
-rw-r--r--kernel/irq/settings.h17
5 files changed, 34 insertions, 2 deletions
diff --git a/include/linux/irq.h b/include/linux/irq.h
index a71dd18639f..39c23786c1d 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -59,6 +59,7 @@ typedef void (*irq_preflow_handler_t)(struct irq_data *data);
59 * IRQ_NOPROBE - Interrupt cannot be probed by autoprobing 59 * IRQ_NOPROBE - Interrupt cannot be probed by autoprobing
60 * IRQ_NOREQUEST - Interrupt cannot be requested via 60 * IRQ_NOREQUEST - Interrupt cannot be requested via
61 * request_irq() 61 * request_irq()
62 * IRQ_NOTHREAD - Interrupt cannot be threaded
62 * IRQ_NOAUTOEN - Interrupt is not automatically enabled in 63 * IRQ_NOAUTOEN - Interrupt is not automatically enabled in
63 * request/setup_irq() 64 * request/setup_irq()
64 * IRQ_NO_BALANCING - Interrupt cannot be balanced (affinity set) 65 * IRQ_NO_BALANCING - Interrupt cannot be balanced (affinity set)
@@ -85,6 +86,7 @@ enum {
85 IRQ_NO_BALANCING = (1 << 13), 86 IRQ_NO_BALANCING = (1 << 13),
86 IRQ_MOVE_PCNTXT = (1 << 14), 87 IRQ_MOVE_PCNTXT = (1 << 14),
87 IRQ_NESTED_THREAD = (1 << 15), 88 IRQ_NESTED_THREAD = (1 << 15),
89 IRQ_NOTHREAD = (1 << 16),
88}; 90};
89 91
90#define IRQF_MODIFY_MASK \ 92#define IRQF_MODIFY_MASK \
@@ -422,7 +424,7 @@ irq_set_handler(unsigned int irq, irq_flow_handler_t handle)
422/* 424/*
423 * Set a highlevel chained flow handler for a given IRQ. 425 * Set a highlevel chained flow handler for a given IRQ.
424 * (a chained handler is automatically enabled and set to 426 * (a chained handler is automatically enabled and set to
425 * IRQ_NOREQUEST and IRQ_NOPROBE) 427 * IRQ_NOREQUEST, IRQ_NOPROBE, and IRQ_NOTHREAD)
426 */ 428 */
427static inline void 429static inline void
428irq_set_chained_handler(unsigned int irq, irq_flow_handler_t handle) 430irq_set_chained_handler(unsigned int irq, irq_flow_handler_t handle)
@@ -452,6 +454,16 @@ static inline void irq_set_probe(unsigned int irq)
452 irq_modify_status(irq, IRQ_NOPROBE, 0); 454 irq_modify_status(irq, IRQ_NOPROBE, 0);
453} 455}
454 456
457static inline void irq_set_nothread(unsigned int irq)
458{
459 irq_modify_status(irq, 0, IRQ_NOTHREAD);
460}
461
462static inline void irq_set_thread(unsigned int irq)
463{
464 irq_modify_status(irq, IRQ_NOTHREAD, 0);
465}
466
455static inline void irq_set_nested_thread(unsigned int irq, bool nest) 467static inline void irq_set_nested_thread(unsigned int irq, bool nest)
456{ 468{
457 if (nest) 469 if (nest)
diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index 4af1e2b244c..52d856d513f 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -573,6 +573,7 @@ __irq_set_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained,
573 if (handle != handle_bad_irq && is_chained) { 573 if (handle != handle_bad_irq && is_chained) {
574 irq_settings_set_noprobe(desc); 574 irq_settings_set_noprobe(desc);
575 irq_settings_set_norequest(desc); 575 irq_settings_set_norequest(desc);
576 irq_settings_set_nothread(desc);
576 irq_startup(desc); 577 irq_startup(desc);
577 } 578 }
578out: 579out:
diff --git a/kernel/irq/debug.h b/kernel/irq/debug.h
index 306cba37e9a..97a8bfadc88 100644
--- a/kernel/irq/debug.h
+++ b/kernel/irq/debug.h
@@ -27,6 +27,7 @@ static inline void print_irq_desc(unsigned int irq, struct irq_desc *desc)
27 P(IRQ_PER_CPU); 27 P(IRQ_PER_CPU);
28 P(IRQ_NOPROBE); 28 P(IRQ_NOPROBE);
29 P(IRQ_NOREQUEST); 29 P(IRQ_NOREQUEST);
30 P(IRQ_NOTHREAD);
30 P(IRQ_NOAUTOEN); 31 P(IRQ_NOAUTOEN);
31 32
32 PS(IRQS_AUTODETECT); 33 PS(IRQS_AUTODETECT);
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 07c1611f389..f7ce0021e1c 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -900,7 +900,8 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new)
900 */ 900 */
901 new->handler = irq_nested_primary_handler; 901 new->handler = irq_nested_primary_handler;
902 } else { 902 } else {
903 irq_setup_forced_threading(new); 903 if (irq_settings_can_thread(desc))
904 irq_setup_forced_threading(new);
904 } 905 }
905 906
906 /* 907 /*
diff --git a/kernel/irq/settings.h b/kernel/irq/settings.h
index 0d91730b633..f1667833d44 100644
--- a/kernel/irq/settings.h
+++ b/kernel/irq/settings.h
@@ -8,6 +8,7 @@ enum {
8 _IRQ_LEVEL = IRQ_LEVEL, 8 _IRQ_LEVEL = IRQ_LEVEL,
9 _IRQ_NOPROBE = IRQ_NOPROBE, 9 _IRQ_NOPROBE = IRQ_NOPROBE,
10 _IRQ_NOREQUEST = IRQ_NOREQUEST, 10 _IRQ_NOREQUEST = IRQ_NOREQUEST,
11 _IRQ_NOTHREAD = IRQ_NOTHREAD,
11 _IRQ_NOAUTOEN = IRQ_NOAUTOEN, 12 _IRQ_NOAUTOEN = IRQ_NOAUTOEN,
12 _IRQ_MOVE_PCNTXT = IRQ_MOVE_PCNTXT, 13 _IRQ_MOVE_PCNTXT = IRQ_MOVE_PCNTXT,
13 _IRQ_NO_BALANCING = IRQ_NO_BALANCING, 14 _IRQ_NO_BALANCING = IRQ_NO_BALANCING,
@@ -20,6 +21,7 @@ enum {
20#define IRQ_LEVEL GOT_YOU_MORON 21#define IRQ_LEVEL GOT_YOU_MORON
21#define IRQ_NOPROBE GOT_YOU_MORON 22#define IRQ_NOPROBE GOT_YOU_MORON
22#define IRQ_NOREQUEST GOT_YOU_MORON 23#define IRQ_NOREQUEST GOT_YOU_MORON
24#define IRQ_NOTHREAD GOT_YOU_MORON
23#define IRQ_NOAUTOEN GOT_YOU_MORON 25#define IRQ_NOAUTOEN GOT_YOU_MORON
24#define IRQ_NESTED_THREAD GOT_YOU_MORON 26#define IRQ_NESTED_THREAD GOT_YOU_MORON
25#undef IRQF_MODIFY_MASK 27#undef IRQF_MODIFY_MASK
@@ -94,6 +96,21 @@ static inline void irq_settings_set_norequest(struct irq_desc *desc)
94 desc->status_use_accessors |= _IRQ_NOREQUEST; 96 desc->status_use_accessors |= _IRQ_NOREQUEST;
95} 97}
96 98
99static inline bool irq_settings_can_thread(struct irq_desc *desc)
100{
101 return !(desc->status_use_accessors & _IRQ_NOTHREAD);
102}
103
104static inline void irq_settings_clr_nothread(struct irq_desc *desc)
105{
106 desc->status_use_accessors &= ~_IRQ_NOTHREAD;
107}
108
109static inline void irq_settings_set_nothread(struct irq_desc *desc)
110{
111 desc->status_use_accessors |= _IRQ_NOTHREAD;
112}
113
97static inline bool irq_settings_can_probe(struct irq_desc *desc) 114static inline bool irq_settings_can_probe(struct irq_desc *desc)
98{ 115{
99 return !(desc->status_use_accessors & _IRQ_NOPROBE); 116 return !(desc->status_use_accessors & _IRQ_NOPROBE);