diff options
Diffstat (limited to 'include/linux/irq.h')
-rw-r--r-- | include/linux/irq.h | 102 |
1 files changed, 87 insertions, 15 deletions
diff --git a/include/linux/irq.h b/include/linux/irq.h index f899b502f186..873e4ac11b81 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h | |||
@@ -160,12 +160,10 @@ struct irq_2_iommu; | |||
160 | */ | 160 | */ |
161 | struct irq_desc { | 161 | struct irq_desc { |
162 | unsigned int irq; | 162 | unsigned int irq; |
163 | #ifdef CONFIG_SPARSE_IRQ | ||
164 | struct timer_rand_state *timer_rand_state; | 163 | struct timer_rand_state *timer_rand_state; |
165 | unsigned int *kstat_irqs; | 164 | unsigned int *kstat_irqs; |
166 | # ifdef CONFIG_INTR_REMAP | 165 | #ifdef CONFIG_INTR_REMAP |
167 | struct irq_2_iommu *irq_2_iommu; | 166 | struct irq_2_iommu *irq_2_iommu; |
168 | # endif | ||
169 | #endif | 167 | #endif |
170 | irq_flow_handler_t handle_irq; | 168 | irq_flow_handler_t handle_irq; |
171 | struct irq_chip *chip; | 169 | struct irq_chip *chip; |
@@ -182,11 +180,11 @@ struct irq_desc { | |||
182 | unsigned int irqs_unhandled; | 180 | unsigned int irqs_unhandled; |
183 | spinlock_t lock; | 181 | spinlock_t lock; |
184 | #ifdef CONFIG_SMP | 182 | #ifdef CONFIG_SMP |
185 | cpumask_t affinity; | 183 | cpumask_var_t affinity; |
186 | unsigned int cpu; | 184 | unsigned int cpu; |
187 | #endif | ||
188 | #ifdef CONFIG_GENERIC_PENDING_IRQ | 185 | #ifdef CONFIG_GENERIC_PENDING_IRQ |
189 | cpumask_t pending_mask; | 186 | cpumask_var_t pending_mask; |
187 | #endif | ||
190 | #endif | 188 | #endif |
191 | #ifdef CONFIG_PROC_FS | 189 | #ifdef CONFIG_PROC_FS |
192 | struct proc_dir_entry *dir; | 190 | struct proc_dir_entry *dir; |
@@ -202,12 +200,6 @@ extern void arch_free_chip_data(struct irq_desc *old_desc, struct irq_desc *desc | |||
202 | extern struct irq_desc irq_desc[NR_IRQS]; | 200 | extern struct irq_desc irq_desc[NR_IRQS]; |
203 | #else /* CONFIG_SPARSE_IRQ */ | 201 | #else /* CONFIG_SPARSE_IRQ */ |
204 | extern struct irq_desc *move_irq_desc(struct irq_desc *old_desc, int cpu); | 202 | extern struct irq_desc *move_irq_desc(struct irq_desc *old_desc, int cpu); |
205 | |||
206 | #define kstat_irqs_this_cpu(DESC) \ | ||
207 | ((DESC)->kstat_irqs[smp_processor_id()]) | ||
208 | #define kstat_incr_irqs_this_cpu(irqno, DESC) \ | ||
209 | ((DESC)->kstat_irqs[smp_processor_id()]++) | ||
210 | |||
211 | #endif /* CONFIG_SPARSE_IRQ */ | 203 | #endif /* CONFIG_SPARSE_IRQ */ |
212 | 204 | ||
213 | extern struct irq_desc *irq_to_desc_alloc_cpu(unsigned int irq, int cpu); | 205 | extern struct irq_desc *irq_to_desc_alloc_cpu(unsigned int irq, int cpu); |
@@ -226,7 +218,6 @@ irq_remap_to_desc(unsigned int irq, struct irq_desc *desc) | |||
226 | * Migration helpers for obsolete names, they will go away: | 218 | * Migration helpers for obsolete names, they will go away: |
227 | */ | 219 | */ |
228 | #define hw_interrupt_type irq_chip | 220 | #define hw_interrupt_type irq_chip |
229 | typedef struct irq_chip hw_irq_controller; | ||
230 | #define no_irq_type no_irq_chip | 221 | #define no_irq_type no_irq_chip |
231 | typedef struct irq_desc irq_desc_t; | 222 | typedef struct irq_desc irq_desc_t; |
232 | 223 | ||
@@ -236,6 +227,7 @@ typedef struct irq_desc irq_desc_t; | |||
236 | #include <asm/hw_irq.h> | 227 | #include <asm/hw_irq.h> |
237 | 228 | ||
238 | extern int setup_irq(unsigned int irq, struct irqaction *new); | 229 | extern int setup_irq(unsigned int irq, struct irqaction *new); |
230 | extern void remove_irq(unsigned int irq, struct irqaction *act); | ||
239 | 231 | ||
240 | #ifdef CONFIG_GENERIC_HARDIRQS | 232 | #ifdef CONFIG_GENERIC_HARDIRQS |
241 | 233 | ||
@@ -280,7 +272,7 @@ static inline int irq_balancing_disabled(unsigned int irq) | |||
280 | } | 272 | } |
281 | 273 | ||
282 | /* Handle irq action chains: */ | 274 | /* Handle irq action chains: */ |
283 | extern int handle_IRQ_event(unsigned int irq, struct irqaction *action); | 275 | extern irqreturn_t handle_IRQ_event(unsigned int irq, struct irqaction *action); |
284 | 276 | ||
285 | /* | 277 | /* |
286 | * Built-in IRQ handlers for various IRQ types, | 278 | * Built-in IRQ handlers for various IRQ types, |
@@ -325,7 +317,7 @@ static inline void generic_handle_irq(unsigned int irq) | |||
325 | 317 | ||
326 | /* Handling of unhandled and spurious interrupts: */ | 318 | /* Handling of unhandled and spurious interrupts: */ |
327 | extern void note_interrupt(unsigned int irq, struct irq_desc *desc, | 319 | extern void note_interrupt(unsigned int irq, struct irq_desc *desc, |
328 | int action_ret); | 320 | irqreturn_t action_ret); |
329 | 321 | ||
330 | /* Resending of interrupts :*/ | 322 | /* Resending of interrupts :*/ |
331 | void check_irq_resend(struct irq_desc *desc, unsigned int irq); | 323 | void check_irq_resend(struct irq_desc *desc, unsigned int irq); |
@@ -422,4 +414,84 @@ extern int set_irq_msi(unsigned int irq, struct msi_desc *entry); | |||
422 | 414 | ||
423 | #endif /* !CONFIG_S390 */ | 415 | #endif /* !CONFIG_S390 */ |
424 | 416 | ||
417 | #ifdef CONFIG_SMP | ||
418 | /** | ||
419 | * init_alloc_desc_masks - allocate cpumasks for irq_desc | ||
420 | * @desc: pointer to irq_desc struct | ||
421 | * @cpu: cpu which will be handling the cpumasks | ||
422 | * @boot: true if need bootmem | ||
423 | * | ||
424 | * Allocates affinity and pending_mask cpumask if required. | ||
425 | * Returns true if successful (or not required). | ||
426 | * Side effect: affinity has all bits set, pending_mask has all bits clear. | ||
427 | */ | ||
428 | static inline bool init_alloc_desc_masks(struct irq_desc *desc, int cpu, | ||
429 | bool boot) | ||
430 | { | ||
431 | int node; | ||
432 | |||
433 | if (boot) { | ||
434 | alloc_bootmem_cpumask_var(&desc->affinity); | ||
435 | cpumask_setall(desc->affinity); | ||
436 | |||
437 | #ifdef CONFIG_GENERIC_PENDING_IRQ | ||
438 | alloc_bootmem_cpumask_var(&desc->pending_mask); | ||
439 | cpumask_clear(desc->pending_mask); | ||
440 | #endif | ||
441 | return true; | ||
442 | } | ||
443 | |||
444 | node = cpu_to_node(cpu); | ||
445 | |||
446 | if (!alloc_cpumask_var_node(&desc->affinity, GFP_ATOMIC, node)) | ||
447 | return false; | ||
448 | cpumask_setall(desc->affinity); | ||
449 | |||
450 | #ifdef CONFIG_GENERIC_PENDING_IRQ | ||
451 | if (!alloc_cpumask_var_node(&desc->pending_mask, GFP_ATOMIC, node)) { | ||
452 | free_cpumask_var(desc->affinity); | ||
453 | return false; | ||
454 | } | ||
455 | cpumask_clear(desc->pending_mask); | ||
456 | #endif | ||
457 | return true; | ||
458 | } | ||
459 | |||
460 | /** | ||
461 | * init_copy_desc_masks - copy cpumasks for irq_desc | ||
462 | * @old_desc: pointer to old irq_desc struct | ||
463 | * @new_desc: pointer to new irq_desc struct | ||
464 | * | ||
465 | * Insures affinity and pending_masks are copied to new irq_desc. | ||
466 | * If !CONFIG_CPUMASKS_OFFSTACK the cpumasks are embedded in the | ||
467 | * irq_desc struct so the copy is redundant. | ||
468 | */ | ||
469 | |||
470 | static inline void init_copy_desc_masks(struct irq_desc *old_desc, | ||
471 | struct irq_desc *new_desc) | ||
472 | { | ||
473 | #ifdef CONFIG_CPUMASKS_OFFSTACK | ||
474 | cpumask_copy(new_desc->affinity, old_desc->affinity); | ||
475 | |||
476 | #ifdef CONFIG_GENERIC_PENDING_IRQ | ||
477 | cpumask_copy(new_desc->pending_mask, old_desc->pending_mask); | ||
478 | #endif | ||
479 | #endif | ||
480 | } | ||
481 | |||
482 | #else /* !CONFIG_SMP */ | ||
483 | |||
484 | static inline bool init_alloc_desc_masks(struct irq_desc *desc, int cpu, | ||
485 | bool boot) | ||
486 | { | ||
487 | return true; | ||
488 | } | ||
489 | |||
490 | static inline void init_copy_desc_masks(struct irq_desc *old_desc, | ||
491 | struct irq_desc *new_desc) | ||
492 | { | ||
493 | } | ||
494 | |||
495 | #endif /* CONFIG_SMP */ | ||
496 | |||
425 | #endif /* _LINUX_IRQ_H */ | 497 | #endif /* _LINUX_IRQ_H */ |