aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/irq.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/irq.h')
-rw-r--r--include/linux/irq.h81
1 files changed, 78 insertions, 3 deletions
diff --git a/include/linux/irq.h b/include/linux/irq.h
index f899b502f186..fa27210f1dfd 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -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;
@@ -422,4 +422,79 @@ extern int set_irq_msi(unsigned int irq, struct msi_desc *entry);
422 422
423#endif /* !CONFIG_S390 */ 423#endif /* !CONFIG_S390 */
424 424
425#ifdef CONFIG_SMP
426/**
427 * init_alloc_desc_masks - allocate cpumasks for irq_desc
428 * @desc: pointer to irq_desc struct
429 * @boot: true if need bootmem
430 *
431 * Allocates affinity and pending_mask cpumask if required.
432 * Returns true if successful (or not required).
433 * Side effect: affinity has all bits set, pending_mask has all bits clear.
434 */
435static inline bool init_alloc_desc_masks(struct irq_desc *desc, int node,
436 bool boot)
437{
438 if (boot) {
439 alloc_bootmem_cpumask_var(&desc->affinity);
440 cpumask_setall(desc->affinity);
441
442#ifdef CONFIG_GENERIC_PENDING_IRQ
443 alloc_bootmem_cpumask_var(&desc->pending_mask);
444 cpumask_clear(desc->pending_mask);
445#endif
446 return true;
447 }
448
449 if (!alloc_cpumask_var_node(&desc->affinity, GFP_ATOMIC, node))
450 return false;
451 cpumask_setall(desc->affinity);
452
453#ifdef CONFIG_GENERIC_PENDING_IRQ
454 if (!alloc_cpumask_var_node(&desc->pending_mask, GFP_ATOMIC, node)) {
455 free_cpumask_var(desc->affinity);
456 return false;
457 }
458 cpumask_clear(desc->pending_mask);
459#endif
460 return true;
461}
462
463/**
464 * init_copy_desc_masks - copy cpumasks for irq_desc
465 * @old_desc: pointer to old irq_desc struct
466 * @new_desc: pointer to new irq_desc struct
467 *
468 * Insures affinity and pending_masks are copied to new irq_desc.
469 * If !CONFIG_CPUMASKS_OFFSTACK the cpumasks are embedded in the
470 * irq_desc struct so the copy is redundant.
471 */
472
473static inline void init_copy_desc_masks(struct irq_desc *old_desc,
474 struct irq_desc *new_desc)
475{
476#ifdef CONFIG_CPUMASKS_OFFSTACK
477 cpumask_copy(new_desc->affinity, old_desc->affinity);
478
479#ifdef CONFIG_GENERIC_PENDING_IRQ
480 cpumask_copy(new_desc->pending_mask, old_desc->pending_mask);
481#endif
482#endif
483}
484
485#else /* !CONFIG_SMP */
486
487static inline bool init_alloc_desc_masks(struct irq_desc *desc, int node,
488 bool boot)
489{
490 return true;
491}
492
493static inline void init_copy_desc_masks(struct irq_desc *old_desc,
494 struct irq_desc *new_desc)
495{
496}
497
498#endif /* CONFIG_SMP */
499
425#endif /* _LINUX_IRQ_H */ 500#endif /* _LINUX_IRQ_H */