diff options
Diffstat (limited to 'include/linux/irq.h')
-rw-r--r-- | include/linux/irq.h | 62 |
1 files changed, 59 insertions, 3 deletions
diff --git a/include/linux/irq.h b/include/linux/irq.h index ab70fd604d3a..5845bdc1ac09 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h | |||
@@ -130,9 +130,14 @@ struct irq_chip { | |||
130 | const char *typename; | 130 | const char *typename; |
131 | }; | 131 | }; |
132 | 132 | ||
133 | struct timer_rand_state; | ||
134 | struct irq_2_iommu; | ||
133 | /** | 135 | /** |
134 | * struct irq_desc - interrupt descriptor | 136 | * struct irq_desc - interrupt descriptor |
135 | * @irq: interrupt number for this descriptor | 137 | * @irq: interrupt number for this descriptor |
138 | * @timer_rand_state: pointer to timer rand state struct | ||
139 | * @kstat_irqs: irq stats per cpu | ||
140 | * @irq_2_iommu: iommu with this irq | ||
136 | * @handle_irq: highlevel irq-events handler [if NULL, __do_IRQ()] | 141 | * @handle_irq: highlevel irq-events handler [if NULL, __do_IRQ()] |
137 | * @chip: low level interrupt hardware access | 142 | * @chip: low level interrupt hardware access |
138 | * @msi_desc: MSI descriptor | 143 | * @msi_desc: MSI descriptor |
@@ -144,8 +149,8 @@ struct irq_chip { | |||
144 | * @depth: disable-depth, for nested irq_disable() calls | 149 | * @depth: disable-depth, for nested irq_disable() calls |
145 | * @wake_depth: enable depth, for multiple set_irq_wake() callers | 150 | * @wake_depth: enable depth, for multiple set_irq_wake() callers |
146 | * @irq_count: stats field to detect stalled irqs | 151 | * @irq_count: stats field to detect stalled irqs |
147 | * @irqs_unhandled: stats field for spurious unhandled interrupts | ||
148 | * @last_unhandled: aging timer for unhandled count | 152 | * @last_unhandled: aging timer for unhandled count |
153 | * @irqs_unhandled: stats field for spurious unhandled interrupts | ||
149 | * @lock: locking for SMP | 154 | * @lock: locking for SMP |
150 | * @affinity: IRQ affinity on SMP | 155 | * @affinity: IRQ affinity on SMP |
151 | * @cpu: cpu index useful for balancing | 156 | * @cpu: cpu index useful for balancing |
@@ -155,6 +160,13 @@ struct irq_chip { | |||
155 | */ | 160 | */ |
156 | struct irq_desc { | 161 | struct irq_desc { |
157 | unsigned int irq; | 162 | unsigned int irq; |
163 | #ifdef CONFIG_SPARSE_IRQ | ||
164 | struct timer_rand_state *timer_rand_state; | ||
165 | unsigned int *kstat_irqs; | ||
166 | # ifdef CONFIG_INTR_REMAP | ||
167 | struct irq_2_iommu *irq_2_iommu; | ||
168 | # endif | ||
169 | #endif | ||
158 | irq_flow_handler_t handle_irq; | 170 | irq_flow_handler_t handle_irq; |
159 | struct irq_chip *chip; | 171 | struct irq_chip *chip; |
160 | struct msi_desc *msi_desc; | 172 | struct msi_desc *msi_desc; |
@@ -166,8 +178,8 @@ struct irq_desc { | |||
166 | unsigned int depth; /* nested irq disables */ | 178 | unsigned int depth; /* nested irq disables */ |
167 | unsigned int wake_depth; /* nested wake enables */ | 179 | unsigned int wake_depth; /* nested wake enables */ |
168 | unsigned int irq_count; /* For detecting broken IRQs */ | 180 | unsigned int irq_count; /* For detecting broken IRQs */ |
169 | unsigned int irqs_unhandled; | ||
170 | unsigned long last_unhandled; /* Aging timer for unhandled count */ | 181 | unsigned long last_unhandled; /* Aging timer for unhandled count */ |
182 | unsigned int irqs_unhandled; | ||
171 | spinlock_t lock; | 183 | spinlock_t lock; |
172 | #ifdef CONFIG_SMP | 184 | #ifdef CONFIG_SMP |
173 | cpumask_t affinity; | 185 | cpumask_t affinity; |
@@ -182,12 +194,51 @@ struct irq_desc { | |||
182 | const char *name; | 194 | const char *name; |
183 | } ____cacheline_internodealigned_in_smp; | 195 | } ____cacheline_internodealigned_in_smp; |
184 | 196 | ||
197 | extern void early_irq_init(void); | ||
198 | extern void arch_early_irq_init(void); | ||
199 | extern void arch_init_chip_data(struct irq_desc *desc, int cpu); | ||
200 | extern void arch_init_copy_chip_data(struct irq_desc *old_desc, | ||
201 | struct irq_desc *desc, int cpu); | ||
202 | extern void arch_free_chip_data(struct irq_desc *old_desc, struct irq_desc *desc); | ||
185 | 203 | ||
204 | #ifndef CONFIG_SPARSE_IRQ | ||
186 | extern struct irq_desc irq_desc[NR_IRQS]; | 205 | extern struct irq_desc irq_desc[NR_IRQS]; |
187 | 206 | ||
188 | static inline struct irq_desc *irq_to_desc(unsigned int irq) | 207 | static inline struct irq_desc *irq_to_desc(unsigned int irq) |
189 | { | 208 | { |
190 | return (irq < nr_irqs) ? irq_desc + irq : NULL; | 209 | return (irq < NR_IRQS) ? irq_desc + irq : NULL; |
210 | } | ||
211 | static inline struct irq_desc *irq_to_desc_alloc_cpu(unsigned int irq, int cpu) | ||
212 | { | ||
213 | return irq_to_desc(irq); | ||
214 | } | ||
215 | |||
216 | #else | ||
217 | |||
218 | extern struct irq_desc *irq_to_desc(unsigned int irq); | ||
219 | extern struct irq_desc *irq_to_desc_alloc_cpu(unsigned int irq, int cpu); | ||
220 | extern struct irq_desc *move_irq_desc(struct irq_desc *old_desc, int cpu); | ||
221 | |||
222 | # define for_each_irq_desc(irq, desc) \ | ||
223 | for (irq = 0, desc = irq_to_desc(irq); irq < nr_irqs; irq++, desc = irq_to_desc(irq)) | ||
224 | # define for_each_irq_desc_reverse(irq, desc) \ | ||
225 | for (irq = nr_irqs - 1, desc = irq_to_desc(irq); irq >= 0; irq--, desc = irq_to_desc(irq)) | ||
226 | |||
227 | #define kstat_irqs_this_cpu(DESC) \ | ||
228 | ((DESC)->kstat_irqs[smp_processor_id()]) | ||
229 | #define kstat_incr_irqs_this_cpu(irqno, DESC) \ | ||
230 | ((DESC)->kstat_irqs[smp_processor_id()]++) | ||
231 | |||
232 | #endif | ||
233 | |||
234 | static inline struct irq_desc * | ||
235 | irq_remap_to_desc(unsigned int irq, struct irq_desc *desc) | ||
236 | { | ||
237 | #ifdef CONFIG_NUMA_MIGRATE_IRQ_DESC | ||
238 | return irq_to_desc(irq); | ||
239 | #else | ||
240 | return desc; | ||
241 | #endif | ||
191 | } | 242 | } |
192 | 243 | ||
193 | /* | 244 | /* |
@@ -381,6 +432,11 @@ extern int set_irq_msi(unsigned int irq, struct msi_desc *entry); | |||
381 | #define get_irq_data(irq) (irq_to_desc(irq)->handler_data) | 432 | #define get_irq_data(irq) (irq_to_desc(irq)->handler_data) |
382 | #define get_irq_msi(irq) (irq_to_desc(irq)->msi_desc) | 433 | #define get_irq_msi(irq) (irq_to_desc(irq)->msi_desc) |
383 | 434 | ||
435 | #define get_irq_desc_chip(desc) ((desc)->chip) | ||
436 | #define get_irq_desc_chip_data(desc) ((desc)->chip_data) | ||
437 | #define get_irq_desc_data(desc) ((desc)->handler_data) | ||
438 | #define get_irq_desc_msi(desc) ((desc)->msi_desc) | ||
439 | |||
384 | #endif /* CONFIG_GENERIC_HARDIRQS */ | 440 | #endif /* CONFIG_GENERIC_HARDIRQS */ |
385 | 441 | ||
386 | #endif /* !CONFIG_S390 */ | 442 | #endif /* !CONFIG_S390 */ |