aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/irq/handle.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/irq/handle.c')
-rw-r--r--kernel/irq/handle.c36
1 files changed, 25 insertions, 11 deletions
diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c
index 412370ab9a34..343acecae629 100644
--- a/kernel/irq/handle.c
+++ b/kernel/irq/handle.c
@@ -83,19 +83,21 @@ static struct irq_desc irq_desc_init = {
83 83
84void init_kstat_irqs(struct irq_desc *desc, int cpu, int nr) 84void init_kstat_irqs(struct irq_desc *desc, int cpu, int nr)
85{ 85{
86 unsigned long bytes;
87 char *ptr;
88 int node; 86 int node;
89 87 void *ptr;
90 /* Compute how many bytes we need per irq and allocate them */
91 bytes = nr * sizeof(unsigned int);
92 88
93 node = cpu_to_node(cpu); 89 node = cpu_to_node(cpu);
94 ptr = kzalloc_node(bytes, GFP_ATOMIC, node); 90 ptr = kzalloc_node(nr * sizeof(*desc->kstat_irqs), GFP_ATOMIC, node);
95 printk(KERN_DEBUG " alloc kstat_irqs on cpu %d node %d\n", cpu, node);
96 91
97 if (ptr) 92 /*
98 desc->kstat_irqs = (unsigned int *)ptr; 93 * don't overwite if can not get new one
94 * init_copy_kstat_irqs() could still use old one
95 */
96 if (ptr) {
97 printk(KERN_DEBUG " alloc kstat_irqs on cpu %d node %d\n",
98 cpu, node);
99 desc->kstat_irqs = ptr;
100 }
99} 101}
100 102
101static void init_one_irq_desc(int irq, struct irq_desc *desc, int cpu) 103static void init_one_irq_desc(int irq, struct irq_desc *desc, int cpu)
@@ -238,6 +240,7 @@ struct irq_desc irq_desc[NR_IRQS] __cacheline_aligned_in_smp = {
238 } 240 }
239}; 241};
240 242
243static unsigned int kstat_irqs_all[NR_IRQS][NR_CPUS];
241int __init early_irq_init(void) 244int __init early_irq_init(void)
242{ 245{
243 struct irq_desc *desc; 246 struct irq_desc *desc;
@@ -254,6 +257,7 @@ int __init early_irq_init(void)
254 for (i = 0; i < count; i++) { 257 for (i = 0; i < count; i++) {
255 desc[i].irq = i; 258 desc[i].irq = i;
256 init_alloc_desc_masks(&desc[i], 0, true); 259 init_alloc_desc_masks(&desc[i], 0, true);
260 desc[i].kstat_irqs = kstat_irqs_all[i];
257 } 261 }
258 return arch_early_irq_init(); 262 return arch_early_irq_init();
259} 263}
@@ -269,6 +273,11 @@ struct irq_desc *irq_to_desc_alloc_cpu(unsigned int irq, int cpu)
269} 273}
270#endif /* !CONFIG_SPARSE_IRQ */ 274#endif /* !CONFIG_SPARSE_IRQ */
271 275
276void clear_kstat_irqs(struct irq_desc *desc)
277{
278 memset(desc->kstat_irqs, 0, nr_cpu_ids * sizeof(*(desc->kstat_irqs)));
279}
280
272/* 281/*
273 * What should we do if we get a hw irq event on an illegal vector? 282 * What should we do if we get a hw irq event on an illegal vector?
274 * Each architecture has to answer this themself. 283 * Each architecture has to answer this themself.
@@ -345,6 +354,8 @@ irqreturn_t handle_IRQ_event(unsigned int irq, struct irqaction *action)
345 irqreturn_t ret, retval = IRQ_NONE; 354 irqreturn_t ret, retval = IRQ_NONE;
346 unsigned int status = 0; 355 unsigned int status = 0;
347 356
357 WARN_ONCE(!in_irq(), "BUG: IRQ handler called from non-hardirq context!");
358
348 if (!(action->flags & IRQF_DISABLED)) 359 if (!(action->flags & IRQF_DISABLED))
349 local_irq_enable_in_hardirq(); 360 local_irq_enable_in_hardirq();
350 361
@@ -366,6 +377,11 @@ irqreturn_t handle_IRQ_event(unsigned int irq, struct irqaction *action)
366} 377}
367 378
368#ifndef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ 379#ifndef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ
380
381#ifdef CONFIG_ENABLE_WARN_DEPRECATED
382# warning __do_IRQ is deprecated. Please convert to proper flow handlers
383#endif
384
369/** 385/**
370 * __do_IRQ - original all in one highlevel IRQ handler 386 * __do_IRQ - original all in one highlevel IRQ handler
371 * @irq: the interrupt number 387 * @irq: the interrupt number
@@ -486,12 +502,10 @@ void early_init_irq_lock_class(void)
486 } 502 }
487} 503}
488 504
489#ifdef CONFIG_SPARSE_IRQ
490unsigned int kstat_irqs_cpu(unsigned int irq, int cpu) 505unsigned int kstat_irqs_cpu(unsigned int irq, int cpu)
491{ 506{
492 struct irq_desc *desc = irq_to_desc(irq); 507 struct irq_desc *desc = irq_to_desc(irq);
493 return desc ? desc->kstat_irqs[cpu] : 0; 508 return desc ? desc->kstat_irqs[cpu] : 0;
494} 509}
495#endif
496EXPORT_SYMBOL(kstat_irqs_cpu); 510EXPORT_SYMBOL(kstat_irqs_cpu);
497 511