diff options
Diffstat (limited to 'kernel/irq/internals.h')
| -rw-r--r-- | kernel/irq/internals.h | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/kernel/irq/internals.h b/kernel/irq/internals.h index b905f0ab1bb2..e281e45fbb55 100644 --- a/kernel/irq/internals.h +++ b/kernel/irq/internals.h | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * IRQ subsystem internal functions and variables: | 2 | * IRQ subsystem internal functions and variables: |
| 3 | */ | 3 | */ |
| 4 | #include <linux/irqdesc.h> | ||
| 4 | 5 | ||
| 5 | extern int noirqdebug; | 6 | extern int noirqdebug; |
| 6 | 7 | ||
| @@ -22,6 +23,9 @@ extern void init_kstat_irqs(struct irq_desc *desc, int node, int nr); | |||
| 22 | extern void clear_kstat_irqs(struct irq_desc *desc); | 23 | extern void clear_kstat_irqs(struct irq_desc *desc); |
| 23 | extern raw_spinlock_t sparse_irq_lock; | 24 | extern raw_spinlock_t sparse_irq_lock; |
| 24 | 25 | ||
| 26 | /* Resending of interrupts :*/ | ||
| 27 | void check_irq_resend(struct irq_desc *desc, unsigned int irq); | ||
| 28 | |||
| 25 | #ifdef CONFIG_SPARSE_IRQ | 29 | #ifdef CONFIG_SPARSE_IRQ |
| 26 | void replace_irq_desc(unsigned int irq, struct irq_desc *desc); | 30 | void replace_irq_desc(unsigned int irq, struct irq_desc *desc); |
| 27 | #endif | 31 | #endif |
| @@ -105,3 +109,99 @@ static inline void print_irq_desc(unsigned int irq, struct irq_desc *desc) | |||
| 105 | 109 | ||
| 106 | #undef P | 110 | #undef P |
| 107 | 111 | ||
| 112 | /* Stuff below will be cleaned up after the sparse allocator is done */ | ||
| 113 | |||
| 114 | #ifdef CONFIG_SMP | ||
| 115 | /** | ||
| 116 | * alloc_desc_masks - allocate cpumasks for irq_desc | ||
| 117 | * @desc: pointer to irq_desc struct | ||
| 118 | * @node: node which will be handling the cpumasks | ||
| 119 | * @boot: true if need bootmem | ||
| 120 | * | ||
| 121 | * Allocates affinity and pending_mask cpumask if required. | ||
| 122 | * Returns true if successful (or not required). | ||
| 123 | */ | ||
| 124 | static inline bool alloc_desc_masks(struct irq_desc *desc, int node, | ||
| 125 | bool boot) | ||
| 126 | { | ||
| 127 | gfp_t gfp = GFP_ATOMIC; | ||
| 128 | |||
| 129 | if (boot) | ||
| 130 | gfp = GFP_NOWAIT; | ||
| 131 | |||
| 132 | #ifdef CONFIG_CPUMASK_OFFSTACK | ||
| 133 | if (!alloc_cpumask_var_node(&desc->irq_data.affinity, gfp, node)) | ||
| 134 | return false; | ||
| 135 | |||
| 136 | #ifdef CONFIG_GENERIC_PENDING_IRQ | ||
| 137 | if (!alloc_cpumask_var_node(&desc->pending_mask, gfp, node)) { | ||
| 138 | free_cpumask_var(desc->irq_data.affinity); | ||
| 139 | return false; | ||
| 140 | } | ||
| 141 | #endif | ||
| 142 | #endif | ||
| 143 | return true; | ||
| 144 | } | ||
| 145 | |||
| 146 | static inline void init_desc_masks(struct irq_desc *desc) | ||
| 147 | { | ||
| 148 | cpumask_setall(desc->irq_data.affinity); | ||
| 149 | #ifdef CONFIG_GENERIC_PENDING_IRQ | ||
| 150 | cpumask_clear(desc->pending_mask); | ||
| 151 | #endif | ||
| 152 | } | ||
| 153 | |||
| 154 | /** | ||
| 155 | * init_copy_desc_masks - copy cpumasks for irq_desc | ||
| 156 | * @old_desc: pointer to old irq_desc struct | ||
| 157 | * @new_desc: pointer to new irq_desc struct | ||
| 158 | * | ||
| 159 | * Insures affinity and pending_masks are copied to new irq_desc. | ||
| 160 | * If !CONFIG_CPUMASKS_OFFSTACK the cpumasks are embedded in the | ||
| 161 | * irq_desc struct so the copy is redundant. | ||
| 162 | */ | ||
| 163 | |||
| 164 | static inline void init_copy_desc_masks(struct irq_desc *old_desc, | ||
| 165 | struct irq_desc *new_desc) | ||
| 166 | { | ||
| 167 | #ifdef CONFIG_CPUMASK_OFFSTACK | ||
| 168 | cpumask_copy(new_desc->irq_data.affinity, old_desc->irq_data.affinity); | ||
| 169 | |||
| 170 | #ifdef CONFIG_GENERIC_PENDING_IRQ | ||
| 171 | cpumask_copy(new_desc->pending_mask, old_desc->pending_mask); | ||
| 172 | #endif | ||
| 173 | #endif | ||
| 174 | } | ||
| 175 | |||
| 176 | static inline void free_desc_masks(struct irq_desc *old_desc, | ||
| 177 | struct irq_desc *new_desc) | ||
| 178 | { | ||
| 179 | free_cpumask_var(old_desc->irq_data.affinity); | ||
| 180 | |||
| 181 | #ifdef CONFIG_GENERIC_PENDING_IRQ | ||
| 182 | free_cpumask_var(old_desc->pending_mask); | ||
| 183 | #endif | ||
| 184 | } | ||
| 185 | |||
| 186 | #else /* !CONFIG_SMP */ | ||
| 187 | |||
| 188 | static inline bool alloc_desc_masks(struct irq_desc *desc, int node, | ||
| 189 | bool boot) | ||
| 190 | { | ||
| 191 | return true; | ||
| 192 | } | ||
| 193 | |||
| 194 | static inline void init_desc_masks(struct irq_desc *desc) | ||
| 195 | { | ||
| 196 | } | ||
| 197 | |||
| 198 | static inline void init_copy_desc_masks(struct irq_desc *old_desc, | ||
| 199 | struct irq_desc *new_desc) | ||
| 200 | { | ||
| 201 | } | ||
| 202 | |||
| 203 | static inline void free_desc_masks(struct irq_desc *old_desc, | ||
| 204 | struct irq_desc *new_desc) | ||
| 205 | { | ||
| 206 | } | ||
| 207 | #endif /* CONFIG_SMP */ | ||
