diff options
Diffstat (limited to 'kernel/irq/handle.c')
| -rw-r--r-- | kernel/irq/handle.c | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c index 3aba8d12f328..f6cdda68e5c6 100644 --- a/kernel/irq/handle.c +++ b/kernel/irq/handle.c | |||
| @@ -83,19 +83,21 @@ static struct irq_desc irq_desc_init = { | |||
| 83 | 83 | ||
| 84 | void init_kstat_irqs(struct irq_desc *desc, int cpu, int nr) | 84 | void 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 | ||
| 101 | static void init_one_irq_desc(int irq, struct irq_desc *desc, int cpu) | 103 | static void init_one_irq_desc(int irq, struct irq_desc *desc, int cpu) |
| @@ -227,6 +229,7 @@ struct irq_desc irq_desc[NR_IRQS] __cacheline_aligned_in_smp = { | |||
| 227 | } | 229 | } |
| 228 | }; | 230 | }; |
| 229 | 231 | ||
| 232 | static unsigned int kstat_irqs_all[NR_IRQS][NR_CPUS]; | ||
| 230 | int __init early_irq_init(void) | 233 | int __init early_irq_init(void) |
| 231 | { | 234 | { |
| 232 | struct irq_desc *desc; | 235 | struct irq_desc *desc; |
| @@ -238,8 +241,10 @@ int __init early_irq_init(void) | |||
| 238 | desc = irq_desc; | 241 | desc = irq_desc; |
| 239 | count = ARRAY_SIZE(irq_desc); | 242 | count = ARRAY_SIZE(irq_desc); |
| 240 | 243 | ||
| 241 | for (i = 0; i < count; i++) | 244 | for (i = 0; i < count; i++) { |
| 242 | desc[i].irq = i; | 245 | desc[i].irq = i; |
| 246 | desc[i].kstat_irqs = kstat_irqs_all[i]; | ||
| 247 | } | ||
| 243 | 248 | ||
| 244 | return arch_early_irq_init(); | 249 | return arch_early_irq_init(); |
| 245 | } | 250 | } |
| @@ -255,6 +260,11 @@ struct irq_desc *irq_to_desc_alloc_cpu(unsigned int irq, int cpu) | |||
| 255 | } | 260 | } |
| 256 | #endif /* !CONFIG_SPARSE_IRQ */ | 261 | #endif /* !CONFIG_SPARSE_IRQ */ |
| 257 | 262 | ||
| 263 | void clear_kstat_irqs(struct irq_desc *desc) | ||
| 264 | { | ||
| 265 | memset(desc->kstat_irqs, 0, nr_cpu_ids * sizeof(*(desc->kstat_irqs))); | ||
| 266 | } | ||
| 267 | |||
| 258 | /* | 268 | /* |
| 259 | * What should we do if we get a hw irq event on an illegal vector? | 269 | * What should we do if we get a hw irq event on an illegal vector? |
| 260 | * Each architecture has to answer this themself. | 270 | * Each architecture has to answer this themself. |
| @@ -328,6 +338,8 @@ irqreturn_t handle_IRQ_event(unsigned int irq, struct irqaction *action) | |||
| 328 | irqreturn_t ret, retval = IRQ_NONE; | 338 | irqreturn_t ret, retval = IRQ_NONE; |
| 329 | unsigned int status = 0; | 339 | unsigned int status = 0; |
| 330 | 340 | ||
| 341 | WARN_ONCE(!in_irq(), "BUG: IRQ handler called from non-hardirq context!"); | ||
| 342 | |||
| 331 | if (!(action->flags & IRQF_DISABLED)) | 343 | if (!(action->flags & IRQF_DISABLED)) |
| 332 | local_irq_enable_in_hardirq(); | 344 | local_irq_enable_in_hardirq(); |
| 333 | 345 | ||
| @@ -347,6 +359,11 @@ irqreturn_t handle_IRQ_event(unsigned int irq, struct irqaction *action) | |||
| 347 | } | 359 | } |
| 348 | 360 | ||
| 349 | #ifndef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ | 361 | #ifndef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ |
| 362 | |||
| 363 | #ifdef CONFIG_ENABLE_WARN_DEPRECATED | ||
| 364 | # warning __do_IRQ is deprecated. Please convert to proper flow handlers | ||
| 365 | #endif | ||
| 366 | |||
| 350 | /** | 367 | /** |
| 351 | * __do_IRQ - original all in one highlevel IRQ handler | 368 | * __do_IRQ - original all in one highlevel IRQ handler |
| 352 | * @irq: the interrupt number | 369 | * @irq: the interrupt number |
| @@ -467,12 +484,10 @@ void early_init_irq_lock_class(void) | |||
| 467 | } | 484 | } |
| 468 | } | 485 | } |
| 469 | 486 | ||
| 470 | #ifdef CONFIG_SPARSE_IRQ | ||
| 471 | unsigned int kstat_irqs_cpu(unsigned int irq, int cpu) | 487 | unsigned int kstat_irqs_cpu(unsigned int irq, int cpu) |
| 472 | { | 488 | { |
| 473 | struct irq_desc *desc = irq_to_desc(irq); | 489 | struct irq_desc *desc = irq_to_desc(irq); |
| 474 | return desc ? desc->kstat_irqs[cpu] : 0; | 490 | return desc ? desc->kstat_irqs[cpu] : 0; |
| 475 | } | 491 | } |
| 476 | #endif | ||
| 477 | EXPORT_SYMBOL(kstat_irqs_cpu); | 492 | EXPORT_SYMBOL(kstat_irqs_cpu); |
| 478 | 493 | ||
