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