aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/irqdesc.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/irqdesc.h')
-rw-r--r--include/linux/irqdesc.h109
1 files changed, 70 insertions, 39 deletions
diff --git a/include/linux/irqdesc.h b/include/linux/irqdesc.h
index c1a95b7b58de..a082905b5ebe 100644
--- a/include/linux/irqdesc.h
+++ b/include/linux/irqdesc.h
@@ -8,6 +8,7 @@
8 * For now it's included from <linux/irq.h> 8 * For now it's included from <linux/irq.h>
9 */ 9 */
10 10
11struct irq_affinity_notify;
11struct proc_dir_entry; 12struct proc_dir_entry;
12struct timer_rand_state; 13struct timer_rand_state;
13/** 14/**
@@ -18,50 +19,32 @@ struct timer_rand_state;
18 * @handle_irq: highlevel irq-events handler [if NULL, __do_IRQ()] 19 * @handle_irq: highlevel irq-events handler [if NULL, __do_IRQ()]
19 * @action: the irq action chain 20 * @action: the irq action chain
20 * @status: status information 21 * @status: status information
22 * @core_internal_state__do_not_mess_with_it: core internal status information
21 * @depth: disable-depth, for nested irq_disable() calls 23 * @depth: disable-depth, for nested irq_disable() calls
22 * @wake_depth: enable depth, for multiple set_irq_wake() callers 24 * @wake_depth: enable depth, for multiple set_irq_wake() callers
23 * @irq_count: stats field to detect stalled irqs 25 * @irq_count: stats field to detect stalled irqs
24 * @last_unhandled: aging timer for unhandled count 26 * @last_unhandled: aging timer for unhandled count
25 * @irqs_unhandled: stats field for spurious unhandled interrupts 27 * @irqs_unhandled: stats field for spurious unhandled interrupts
26 * @lock: locking for SMP 28 * @lock: locking for SMP
29 * @affinity_notify: context for notification of affinity changes
27 * @pending_mask: pending rebalanced interrupts 30 * @pending_mask: pending rebalanced interrupts
31 * @threads_oneshot: bitfield to handle shared oneshot threads
28 * @threads_active: number of irqaction threads currently running 32 * @threads_active: number of irqaction threads currently running
29 * @wait_for_threads: wait queue for sync_irq to wait for threaded handlers 33 * @wait_for_threads: wait queue for sync_irq to wait for threaded handlers
30 * @dir: /proc/irq/ procfs entry 34 * @dir: /proc/irq/ procfs entry
31 * @name: flow handler name for /proc/interrupts output 35 * @name: flow handler name for /proc/interrupts output
32 */ 36 */
33struct irq_desc { 37struct irq_desc {
34
35#ifdef CONFIG_GENERIC_HARDIRQS_NO_DEPRECATED
36 struct irq_data irq_data; 38 struct irq_data irq_data;
37#else
38 /*
39 * This union will go away, once we fixed the direct access to
40 * irq_desc all over the place. The direct fields are a 1:1
41 * overlay of irq_data.
42 */
43 union {
44 struct irq_data irq_data;
45 struct {
46 unsigned int irq;
47 unsigned int node;
48 struct irq_chip *chip;
49 void *handler_data;
50 void *chip_data;
51 struct msi_desc *msi_desc;
52#ifdef CONFIG_SMP
53 cpumask_var_t affinity;
54#endif
55 };
56 };
57#endif
58
59 struct timer_rand_state *timer_rand_state; 39 struct timer_rand_state *timer_rand_state;
60 unsigned int __percpu *kstat_irqs; 40 unsigned int __percpu *kstat_irqs;
61 irq_flow_handler_t handle_irq; 41 irq_flow_handler_t handle_irq;
42#ifdef CONFIG_IRQ_PREFLOW_FASTEOI
43 irq_preflow_handler_t preflow_handler;
44#endif
62 struct irqaction *action; /* IRQ action list */ 45 struct irqaction *action; /* IRQ action list */
63 unsigned int status; /* IRQ status */ 46 unsigned int status_use_accessors;
64 47 unsigned int core_internal_state__do_not_mess_with_it;
65 unsigned int depth; /* nested irq disables */ 48 unsigned int depth; /* nested irq disables */
66 unsigned int wake_depth; /* nested wake enables */ 49 unsigned int wake_depth; /* nested wake enables */
67 unsigned int irq_count; /* For detecting broken IRQs */ 50 unsigned int irq_count; /* For detecting broken IRQs */
@@ -70,10 +53,12 @@ struct irq_desc {
70 raw_spinlock_t lock; 53 raw_spinlock_t lock;
71#ifdef CONFIG_SMP 54#ifdef CONFIG_SMP
72 const struct cpumask *affinity_hint; 55 const struct cpumask *affinity_hint;
56 struct irq_affinity_notify *affinity_notify;
73#ifdef CONFIG_GENERIC_PENDING_IRQ 57#ifdef CONFIG_GENERIC_PENDING_IRQ
74 cpumask_var_t pending_mask; 58 cpumask_var_t pending_mask;
75#endif 59#endif
76#endif 60#endif
61 unsigned long threads_oneshot;
77 atomic_t threads_active; 62 atomic_t threads_active;
78 wait_queue_head_t wait_for_threads; 63 wait_queue_head_t wait_for_threads;
79#ifdef CONFIG_PROC_FS 64#ifdef CONFIG_PROC_FS
@@ -86,19 +71,32 @@ struct irq_desc {
86extern struct irq_desc irq_desc[NR_IRQS]; 71extern struct irq_desc irq_desc[NR_IRQS];
87#endif 72#endif
88 73
89/* Will be removed once the last users in power and sh are gone */ 74#ifdef CONFIG_GENERIC_HARDIRQS
90extern struct irq_desc *irq_to_desc_alloc_node(unsigned int irq, int node); 75
91static inline struct irq_desc *move_irq_desc(struct irq_desc *desc, int node) 76static inline struct irq_data *irq_desc_get_irq_data(struct irq_desc *desc)
92{ 77{
93 return desc; 78 return &desc->irq_data;
94} 79}
95 80
96#ifdef CONFIG_GENERIC_HARDIRQS 81static inline struct irq_chip *irq_desc_get_chip(struct irq_desc *desc)
82{
83 return desc->irq_data.chip;
84}
85
86static inline void *irq_desc_get_chip_data(struct irq_desc *desc)
87{
88 return desc->irq_data.chip_data;
89}
90
91static inline void *irq_desc_get_handler_data(struct irq_desc *desc)
92{
93 return desc->irq_data.handler_data;
94}
97 95
98#define get_irq_desc_chip(desc) ((desc)->irq_data.chip) 96static inline struct msi_desc *irq_desc_get_msi_desc(struct irq_desc *desc)
99#define get_irq_desc_chip_data(desc) ((desc)->irq_data.chip_data) 97{
100#define get_irq_desc_data(desc) ((desc)->irq_data.handler_data) 98 return desc->irq_data.msi_desc;
101#define get_irq_desc_msi(desc) ((desc)->irq_data.msi_desc) 99}
102 100
103/* 101/*
104 * Architectures call this to let the generic IRQ layer 102 * Architectures call this to let the generic IRQ layer
@@ -123,23 +121,56 @@ static inline int irq_has_action(unsigned int irq)
123 return desc->action != NULL; 121 return desc->action != NULL;
124} 122}
125 123
126static inline int irq_balancing_disabled(unsigned int irq) 124/* caller has locked the irq_desc and both params are valid */
125static inline void __irq_set_handler_locked(unsigned int irq,
126 irq_flow_handler_t handler)
127{ 127{
128 struct irq_desc *desc; 128 struct irq_desc *desc;
129 129
130 desc = irq_to_desc(irq); 130 desc = irq_to_desc(irq);
131 return desc->status & IRQ_NO_BALANCING_MASK; 131 desc->handle_irq = handler;
132} 132}
133 133
134/* caller has locked the irq_desc and both params are valid */ 134/* caller has locked the irq_desc and both params are valid */
135static inline void __set_irq_handler_unlocked(int irq, 135static inline void
136 irq_flow_handler_t handler) 136__irq_set_chip_handler_name_locked(unsigned int irq, struct irq_chip *chip,
137 irq_flow_handler_t handler, const char *name)
137{ 138{
138 struct irq_desc *desc; 139 struct irq_desc *desc;
139 140
140 desc = irq_to_desc(irq); 141 desc = irq_to_desc(irq);
142 irq_desc_get_irq_data(desc)->chip = chip;
141 desc->handle_irq = handler; 143 desc->handle_irq = handler;
144 desc->name = name;
142} 145}
146
147static inline int irq_balancing_disabled(unsigned int irq)
148{
149 struct irq_desc *desc;
150
151 desc = irq_to_desc(irq);
152 return desc->status_use_accessors & IRQ_NO_BALANCING_MASK;
153}
154
155static inline void
156irq_set_lockdep_class(unsigned int irq, struct lock_class_key *class)
157{
158 struct irq_desc *desc = irq_to_desc(irq);
159
160 if (desc)
161 lockdep_set_class(&desc->lock, class);
162}
163
164#ifdef CONFIG_IRQ_PREFLOW_FASTEOI
165static inline void
166__irq_set_preflow_handler(unsigned int irq, irq_preflow_handler_t handler)
167{
168 struct irq_desc *desc;
169
170 desc = irq_to_desc(irq);
171 desc->preflow_handler = handler;
172}
173#endif
143#endif 174#endif
144 175
145#endif 176#endif