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.h69
1 files changed, 60 insertions, 9 deletions
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 838a977885e1..98564dc64476 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -63,7 +63,8 @@ typedef void (*irq_flow_handler_t)(unsigned int irq,
63#define IRQ_MOVE_PENDING 0x00200000 /* need to re-target IRQ destination */ 63#define IRQ_MOVE_PENDING 0x00200000 /* need to re-target IRQ destination */
64#define IRQ_NO_BALANCING 0x00400000 /* IRQ is excluded from balancing */ 64#define IRQ_NO_BALANCING 0x00400000 /* IRQ is excluded from balancing */
65#define IRQ_SPURIOUS_DISABLED 0x00800000 /* IRQ was disabled by the spurious trap */ 65#define IRQ_SPURIOUS_DISABLED 0x00800000 /* IRQ was disabled by the spurious trap */
66#define IRQ_MOVE_PCNTXT 0x01000000 /* IRQ migration from process context */ 66#define IRQ_MOVE_PCNTXT 0x01000000 /* IRQ migration from process context */
67#define IRQ_AFFINITY_SET 0x02000000 /* IRQ affinity was set from userspace*/
67 68
68#ifdef CONFIG_IRQ_PER_CPU 69#ifdef CONFIG_IRQ_PER_CPU
69# define CHECK_IRQ_PER_CPU(var) ((var) & IRQ_PER_CPU) 70# define CHECK_IRQ_PER_CPU(var) ((var) & IRQ_PER_CPU)
@@ -128,9 +129,14 @@ struct irq_chip {
128 const char *typename; 129 const char *typename;
129}; 130};
130 131
132struct timer_rand_state;
133struct irq_2_iommu;
131/** 134/**
132 * struct irq_desc - interrupt descriptor 135 * struct irq_desc - interrupt descriptor
133 * 136 * @irq: interrupt number for this descriptor
137 * @timer_rand_state: pointer to timer rand state struct
138 * @kstat_irqs: irq stats per cpu
139 * @irq_2_iommu: iommu with this irq
134 * @handle_irq: highlevel irq-events handler [if NULL, __do_IRQ()] 140 * @handle_irq: highlevel irq-events handler [if NULL, __do_IRQ()]
135 * @chip: low level interrupt hardware access 141 * @chip: low level interrupt hardware access
136 * @msi_desc: MSI descriptor 142 * @msi_desc: MSI descriptor
@@ -149,11 +155,17 @@ struct irq_chip {
149 * @cpu: cpu index useful for balancing 155 * @cpu: cpu index useful for balancing
150 * @pending_mask: pending rebalanced interrupts 156 * @pending_mask: pending rebalanced interrupts
151 * @dir: /proc/irq/ procfs entry 157 * @dir: /proc/irq/ procfs entry
152 * @affinity_entry: /proc/irq/smp_affinity procfs entry on SMP
153 * @name: flow handler name for /proc/interrupts output 158 * @name: flow handler name for /proc/interrupts output
154 */ 159 */
155struct irq_desc { 160struct irq_desc {
156 unsigned int irq; 161 unsigned int irq;
162#ifdef CONFIG_SPARSE_IRQ
163 struct timer_rand_state *timer_rand_state;
164 unsigned int *kstat_irqs;
165# ifdef CONFIG_INTR_REMAP
166 struct irq_2_iommu *irq_2_iommu;
167# endif
168#endif
157 irq_flow_handler_t handle_irq; 169 irq_flow_handler_t handle_irq;
158 struct irq_chip *chip; 170 struct irq_chip *chip;
159 struct msi_desc *msi_desc; 171 struct msi_desc *msi_desc;
@@ -181,12 +193,51 @@ struct irq_desc {
181 const char *name; 193 const char *name;
182} ____cacheline_internodealigned_in_smp; 194} ____cacheline_internodealigned_in_smp;
183 195
196extern void early_irq_init(void);
197extern void arch_early_irq_init(void);
198extern void arch_init_chip_data(struct irq_desc *desc, int cpu);
199extern void arch_init_copy_chip_data(struct irq_desc *old_desc,
200 struct irq_desc *desc, int cpu);
201extern void arch_free_chip_data(struct irq_desc *old_desc, struct irq_desc *desc);
184 202
203#ifndef CONFIG_SPARSE_IRQ
185extern struct irq_desc irq_desc[NR_IRQS]; 204extern struct irq_desc irq_desc[NR_IRQS];
186 205
187static inline struct irq_desc *irq_to_desc(unsigned int irq) 206static inline struct irq_desc *irq_to_desc(unsigned int irq)
188{ 207{
189 return (irq < nr_irqs) ? irq_desc + irq : NULL; 208 return (irq < NR_IRQS) ? irq_desc + irq : NULL;
209}
210static inline struct irq_desc *irq_to_desc_alloc_cpu(unsigned int irq, int cpu)
211{
212 return irq_to_desc(irq);
213}
214
215#else
216
217extern struct irq_desc *irq_to_desc(unsigned int irq);
218extern struct irq_desc *irq_to_desc_alloc_cpu(unsigned int irq, int cpu);
219extern struct irq_desc *move_irq_desc(struct irq_desc *old_desc, int cpu);
220
221# define for_each_irq_desc(irq, desc) \
222 for (irq = 0, desc = irq_to_desc(irq); irq < nr_irqs; irq++, desc = irq_to_desc(irq))
223# define for_each_irq_desc_reverse(irq, desc) \
224 for (irq = nr_irqs - 1, desc = irq_to_desc(irq); irq >= 0; irq--, desc = irq_to_desc(irq))
225
226#define kstat_irqs_this_cpu(DESC) \
227 ((DESC)->kstat_irqs[smp_processor_id()])
228#define kstat_incr_irqs_this_cpu(irqno, DESC) \
229 ((DESC)->kstat_irqs[smp_processor_id()]++)
230
231#endif
232
233static inline struct irq_desc *
234irq_remap_to_desc(unsigned int irq, struct irq_desc *desc)
235{
236#ifdef CONFIG_NUMA_MIGRATE_IRQ_DESC
237 return irq_to_desc(irq);
238#else
239 return desc;
240#endif
190} 241}
191 242
192/* 243/*
@@ -210,7 +261,6 @@ extern int setup_irq(unsigned int irq, struct irqaction *new);
210 261
211#ifdef CONFIG_GENERIC_PENDING_IRQ 262#ifdef CONFIG_GENERIC_PENDING_IRQ
212 263
213void set_pending_irq(unsigned int irq, cpumask_t mask);
214void move_native_irq(int irq); 264void move_native_irq(int irq);
215void move_masked_irq(int irq); 265void move_masked_irq(int irq);
216 266
@@ -228,10 +278,6 @@ static inline void move_masked_irq(int irq)
228{ 278{
229} 279}
230 280
231static inline void set_pending_irq(unsigned int irq, cpumask_t mask)
232{
233}
234
235#endif /* CONFIG_GENERIC_PENDING_IRQ */ 281#endif /* CONFIG_GENERIC_PENDING_IRQ */
236 282
237#else /* CONFIG_SMP */ 283#else /* CONFIG_SMP */
@@ -385,6 +431,11 @@ extern int set_irq_msi(unsigned int irq, struct msi_desc *entry);
385#define get_irq_data(irq) (irq_to_desc(irq)->handler_data) 431#define get_irq_data(irq) (irq_to_desc(irq)->handler_data)
386#define get_irq_msi(irq) (irq_to_desc(irq)->msi_desc) 432#define get_irq_msi(irq) (irq_to_desc(irq)->msi_desc)
387 433
434#define get_irq_desc_chip(desc) ((desc)->chip)
435#define get_irq_desc_chip_data(desc) ((desc)->chip_data)
436#define get_irq_desc_data(desc) ((desc)->handler_data)
437#define get_irq_desc_msi(desc) ((desc)->msi_desc)
438
388#endif /* CONFIG_GENERIC_HARDIRQS */ 439#endif /* CONFIG_GENERIC_HARDIRQS */
389 440
390#endif /* !CONFIG_S390 */ 441#endif /* !CONFIG_S390 */