blob: f6cdda68e5c6c04b4c0da4626db67d05a78af3b0 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * linux/kernel/irq/handle.c
3 *
Ingo Molnara34db9b2006-06-29 02:24:50 -07004 * Copyright (C) 1992, 1998-2006 Linus Torvalds, Ingo Molnar
5 * Copyright (C) 2005-2006, Thomas Gleixner, Russell King
Linus Torvalds1da177e2005-04-16 15:20:36 -07006 *
7 * This file contains the core interrupt handling code.
Ingo Molnara34db9b2006-06-29 02:24:50 -07008 *
9 * Detailed information is available in Documentation/DocBook/genericirq
10 *
Linus Torvalds1da177e2005-04-16 15:20:36 -070011 */
12
13#include <linux/irq.h>
14#include <linux/module.h>
15#include <linux/random.h>
16#include <linux/interrupt.h>
17#include <linux/kernel_stat.h>
Yinghai Lu0b8f1ef2008-12-05 18:58:31 -080018#include <linux/rculist.h>
19#include <linux/hash.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070020
21#include "internals.h"
22
Yinghai Lu0b8f1ef2008-12-05 18:58:31 -080023/*
24 * lockdep: we want to handle all irq_desc locks as a single lock-class:
25 */
Yinghai Lu48a1b102008-12-11 00:15:01 -080026struct lock_class_key irq_desc_lock_class;
Yinghai Lu0b8f1ef2008-12-05 18:58:31 -080027
Thomas Gleixner6a6de9e2006-06-29 02:24:51 -070028/**
29 * handle_bad_irq - handle spurious and unhandled irqs
Henrik Kretzschmar43a1dd52006-08-31 21:27:44 -070030 * @irq: the interrupt number
31 * @desc: description of the interrupt
Henrik Kretzschmar43a1dd52006-08-31 21:27:44 -070032 *
33 * Handles spurious and unhandled IRQ's. It also prints a debugmessage.
Thomas Gleixner6a6de9e2006-06-29 02:24:51 -070034 */
Thomas Gleixnerd6c88a52008-10-15 15:27:23 +020035void handle_bad_irq(unsigned int irq, struct irq_desc *desc)
Thomas Gleixner6a6de9e2006-06-29 02:24:51 -070036{
Ingo Molnar43f77752006-06-29 02:24:58 -070037 print_irq_desc(irq, desc);
Thomas Gleixnerd6c88a52008-10-15 15:27:23 +020038 kstat_incr_irqs_this_cpu(irq, desc);
Thomas Gleixner6a6de9e2006-06-29 02:24:51 -070039 ack_bad_irq(irq);
40}
41
David Daney97179fd2009-01-27 09:53:22 -080042#if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_HARDIRQS)
43static void __init init_irq_default_affinity(void)
44{
45 alloc_bootmem_cpumask_var(&irq_default_affinity);
46 cpumask_setall(irq_default_affinity);
47}
48#else
49static void __init init_irq_default_affinity(void)
50{
51}
52#endif
53
Linus Torvalds1da177e2005-04-16 15:20:36 -070054/*
55 * Linux has a controller-independent interrupt architecture.
56 * Every controller has a 'controller-template', that is used
57 * by the main code to do the right thing. Each driver-visible
Ingo Molnar06fcb0c2006-06-29 02:24:40 -070058 * interrupt source is transparently wired to the appropriate
Linus Torvalds1da177e2005-04-16 15:20:36 -070059 * controller. Thus drivers need not be aware of the
60 * interrupt-controller.
61 *
62 * The code is designed to be easily extended with new/different
63 * interrupt controllers, without having to do assembly magic or
64 * having to touch the generic code.
65 *
66 * Controller mappings for all interrupt sources:
67 */
Yinghai Lu85c0f902008-08-19 20:49:47 -070068int nr_irqs = NR_IRQS;
Ingo Molnarfa42d102008-08-19 20:50:30 -070069EXPORT_SYMBOL_GPL(nr_irqs);
Yinghai Lud60458b2008-08-19 20:50:00 -070070
Yinghai Lu0b8f1ef2008-12-05 18:58:31 -080071#ifdef CONFIG_SPARSE_IRQ
72static struct irq_desc irq_desc_init = {
73 .irq = -1,
74 .status = IRQ_DISABLED,
75 .chip = &no_irq_chip,
76 .handle_irq = handle_bad_irq,
77 .depth = 1,
78 .lock = __SPIN_LOCK_UNLOCKED(irq_desc_init.lock),
79#ifdef CONFIG_SMP
80 .affinity = CPU_MASK_ALL
81#endif
82};
83
Yinghai Lu48a1b102008-12-11 00:15:01 -080084void init_kstat_irqs(struct irq_desc *desc, int cpu, int nr)
Yinghai Lu0b8f1ef2008-12-05 18:58:31 -080085{
Yinghai Lu0b8f1ef2008-12-05 18:58:31 -080086 int node;
Yinghai Lu005bf0e62009-02-08 16:18:03 -080087 void *ptr;
Yinghai Lu0b8f1ef2008-12-05 18:58:31 -080088
89 node = cpu_to_node(cpu);
Yinghai Lu005bf0e62009-02-08 16:18:03 -080090 ptr = kzalloc_node(nr * sizeof(*desc->kstat_irqs), GFP_ATOMIC, node);
Yinghai Lu0b8f1ef2008-12-05 18:58:31 -080091
Yinghai Lu005bf0e62009-02-08 16:18:03 -080092 /*
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 }
Yinghai Lu0b8f1ef2008-12-05 18:58:31 -0800101}
102
Yinghai Lu0b8f1ef2008-12-05 18:58:31 -0800103static void init_one_irq_desc(int irq, struct irq_desc *desc, int cpu)
104{
105 memcpy(desc, &irq_desc_init, sizeof(struct irq_desc));
Ingo Molnar793f7b12008-12-26 19:02:20 +0100106
107 spin_lock_init(&desc->lock);
Yinghai Lu0b8f1ef2008-12-05 18:58:31 -0800108 desc->irq = irq;
109#ifdef CONFIG_SMP
110 desc->cpu = cpu;
111#endif
112 lockdep_set_class(&desc->lock, &irq_desc_lock_class);
113 init_kstat_irqs(desc, cpu, nr_cpu_ids);
114 if (!desc->kstat_irqs) {
115 printk(KERN_ERR "can not alloc kstat_irqs\n");
116 BUG_ON(1);
117 }
118 arch_init_chip_data(desc, cpu);
119}
120
121/*
122 * Protect the sparse_irqs:
123 */
Yinghai Lu48a1b102008-12-11 00:15:01 -0800124DEFINE_SPINLOCK(sparse_irq_lock);
Yinghai Lu0b8f1ef2008-12-05 18:58:31 -0800125
126struct irq_desc *irq_desc_ptrs[NR_IRQS] __read_mostly;
127
Yinghai Lu99d093d2008-12-05 18:58:32 -0800128static struct irq_desc irq_desc_legacy[NR_IRQS_LEGACY] __cacheline_aligned_in_smp = {
129 [0 ... NR_IRQS_LEGACY-1] = {
Yinghai Lu0b8f1ef2008-12-05 18:58:31 -0800130 .irq = -1,
131 .status = IRQ_DISABLED,
132 .chip = &no_irq_chip,
133 .handle_irq = handle_bad_irq,
134 .depth = 1,
135 .lock = __SPIN_LOCK_UNLOCKED(irq_desc_init.lock),
136#ifdef CONFIG_SMP
137 .affinity = CPU_MASK_ALL
138#endif
139 }
140};
141
142/* FIXME: use bootmem alloc ...*/
Yinghai Lu99d093d2008-12-05 18:58:32 -0800143static unsigned int kstat_irqs_legacy[NR_IRQS_LEGACY][NR_CPUS];
Yinghai Lu0b8f1ef2008-12-05 18:58:31 -0800144
Yinghai Lu13a0c3c2008-12-26 02:05:47 -0800145int __init early_irq_init(void)
Yinghai Lu0b8f1ef2008-12-05 18:58:31 -0800146{
147 struct irq_desc *desc;
148 int legacy_count;
149 int i;
150
David Daney97179fd2009-01-27 09:53:22 -0800151 init_irq_default_affinity();
152
Yinghai Lu0b8f1ef2008-12-05 18:58:31 -0800153 desc = irq_desc_legacy;
154 legacy_count = ARRAY_SIZE(irq_desc_legacy);
155
156 for (i = 0; i < legacy_count; i++) {
157 desc[i].irq = i;
158 desc[i].kstat_irqs = kstat_irqs_legacy[i];
Yinghai Lufa6beb32008-12-22 20:24:09 -0800159 lockdep_set_class(&desc[i].lock, &irq_desc_lock_class);
Yinghai Lu0b8f1ef2008-12-05 18:58:31 -0800160
161 irq_desc_ptrs[i] = desc + i;
162 }
163
164 for (i = legacy_count; i < NR_IRQS; i++)
165 irq_desc_ptrs[i] = NULL;
166
Yinghai Lu13a0c3c2008-12-26 02:05:47 -0800167 return arch_early_irq_init();
Yinghai Lu0b8f1ef2008-12-05 18:58:31 -0800168}
169
170struct irq_desc *irq_to_desc(unsigned int irq)
171{
172 return (irq < NR_IRQS) ? irq_desc_ptrs[irq] : NULL;
173}
174
175struct irq_desc *irq_to_desc_alloc_cpu(unsigned int irq, int cpu)
176{
177 struct irq_desc *desc;
178 unsigned long flags;
179 int node;
180
181 if (irq >= NR_IRQS) {
182 printk(KERN_WARNING "irq >= NR_IRQS in irq_to_desc_alloc: %d %d\n",
183 irq, NR_IRQS);
184 WARN_ON(1);
185 return NULL;
186 }
187
188 desc = irq_desc_ptrs[irq];
189 if (desc)
190 return desc;
191
192 spin_lock_irqsave(&sparse_irq_lock, flags);
193
194 /* We have to check it to avoid races with another CPU */
195 desc = irq_desc_ptrs[irq];
196 if (desc)
197 goto out_unlock;
198
199 node = cpu_to_node(cpu);
200 desc = kzalloc_node(sizeof(*desc), GFP_ATOMIC, node);
201 printk(KERN_DEBUG " alloc irq_desc for %d on cpu %d node %d\n",
202 irq, cpu, node);
203 if (!desc) {
204 printk(KERN_ERR "can not alloc irq_desc\n");
205 BUG_ON(1);
206 }
207 init_one_irq_desc(irq, desc, cpu);
208
209 irq_desc_ptrs[irq] = desc;
210
211out_unlock:
212 spin_unlock_irqrestore(&sparse_irq_lock, flags);
213
214 return desc;
215}
216
KOSAKI Motohirof9af0e72008-12-26 12:24:24 +0900217#else /* !CONFIG_SPARSE_IRQ */
Yinghai Lu0b8f1ef2008-12-05 18:58:31 -0800218
Ravikiran G Thirumalaie729aa12007-05-08 00:29:13 -0700219struct irq_desc irq_desc[NR_IRQS] __cacheline_aligned_in_smp = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700220 [0 ... NR_IRQS-1] = {
Zhang, Yanmin4f167fb2005-05-16 21:53:43 -0700221 .status = IRQ_DISABLED,
Ingo Molnarf1c26622006-06-29 02:24:57 -0700222 .chip = &no_irq_chip,
Ingo Molnar7a557132006-06-29 02:24:54 -0700223 .handle_irq = handle_bad_irq,
Thomas Gleixner94d39e12006-06-29 02:24:50 -0700224 .depth = 1,
Yinghai Luaac3f2b2008-09-24 19:04:35 -0700225 .lock = __SPIN_LOCK_UNLOCKED(irq_desc->lock),
Ingo Molnara53da522006-06-29 02:24:38 -0700226#ifdef CONFIG_SMP
227 .affinity = CPU_MASK_ALL
228#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700229 }
230};
Yinghai Lu08678b02008-08-19 20:50:05 -0700231
Yinghai Lud7e51e62009-01-07 15:03:13 -0800232static unsigned int kstat_irqs_all[NR_IRQS][NR_CPUS];
Yinghai Lu12026ea2008-12-26 22:38:15 -0800233int __init early_irq_init(void)
234{
235 struct irq_desc *desc;
236 int count;
237 int i;
238
David Daney97179fd2009-01-27 09:53:22 -0800239 init_irq_default_affinity();
240
Yinghai Lu12026ea2008-12-26 22:38:15 -0800241 desc = irq_desc;
242 count = ARRAY_SIZE(irq_desc);
243
Yinghai Lud7e51e62009-01-07 15:03:13 -0800244 for (i = 0; i < count; i++) {
Yinghai Lu12026ea2008-12-26 22:38:15 -0800245 desc[i].irq = i;
Yinghai Lud7e51e62009-01-07 15:03:13 -0800246 desc[i].kstat_irqs = kstat_irqs_all[i];
247 }
Yinghai Lu12026ea2008-12-26 22:38:15 -0800248
249 return arch_early_irq_init();
250}
251
KOSAKI Motohirof9af0e72008-12-26 12:24:24 +0900252struct irq_desc *irq_to_desc(unsigned int irq)
253{
254 return (irq < NR_IRQS) ? irq_desc + irq : NULL;
255}
256
257struct irq_desc *irq_to_desc_alloc_cpu(unsigned int irq, int cpu)
258{
259 return irq_to_desc(irq);
260}
261#endif /* !CONFIG_SPARSE_IRQ */
Yinghai Lu0b8f1ef2008-12-05 18:58:31 -0800262
Yinghai Lu0f3c2a82009-02-08 16:18:03 -0800263void clear_kstat_irqs(struct irq_desc *desc)
264{
265 memset(desc->kstat_irqs, 0, nr_cpu_ids * sizeof(*(desc->kstat_irqs)));
266}
267
Linus Torvalds1da177e2005-04-16 15:20:36 -0700268/*
Ingo Molnar77a5afe2006-06-29 02:24:46 -0700269 * What should we do if we get a hw irq event on an illegal vector?
270 * Each architecture has to answer this themself.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700271 */
Ingo Molnar77a5afe2006-06-29 02:24:46 -0700272static void ack_bad(unsigned int irq)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700273{
Thomas Gleixnerd3c60042008-10-16 09:55:00 +0200274 struct irq_desc *desc = irq_to_desc(irq);
Yinghai Lu08678b02008-08-19 20:50:05 -0700275
Yinghai Lu08678b02008-08-19 20:50:05 -0700276 print_irq_desc(irq, desc);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700277 ack_bad_irq(irq);
278}
279
Ingo Molnar77a5afe2006-06-29 02:24:46 -0700280/*
281 * NOP functions
282 */
283static void noop(unsigned int irq)
284{
285}
286
287static unsigned int noop_ret(unsigned int irq)
288{
289 return 0;
290}
291
292/*
293 * Generic no controller implementation
294 */
Ingo Molnarf1c26622006-06-29 02:24:57 -0700295struct irq_chip no_irq_chip = {
296 .name = "none",
Ingo Molnar77a5afe2006-06-29 02:24:46 -0700297 .startup = noop_ret,
298 .shutdown = noop,
299 .enable = noop,
300 .disable = noop,
301 .ack = ack_bad,
302 .end = noop,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700303};
304
305/*
Thomas Gleixnerf8b54732006-07-01 22:30:08 +0100306 * Generic dummy implementation which can be used for
307 * real dumb interrupt sources
308 */
309struct irq_chip dummy_irq_chip = {
310 .name = "dummy",
311 .startup = noop_ret,
312 .shutdown = noop,
313 .enable = noop,
314 .disable = noop,
315 .ack = noop,
316 .mask = noop,
317 .unmask = noop,
318 .end = noop,
319};
320
321/*
Linus Torvalds1da177e2005-04-16 15:20:36 -0700322 * Special, empty irq handler:
323 */
David Howells7d12e782006-10-05 14:55:46 +0100324irqreturn_t no_action(int cpl, void *dev_id)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700325{
326 return IRQ_NONE;
327}
328
Ingo Molnar8d28bc72006-06-29 02:24:46 -0700329/**
330 * handle_IRQ_event - irq action chain handler
331 * @irq: the interrupt number
Ingo Molnar8d28bc72006-06-29 02:24:46 -0700332 * @action: the interrupt action chain for this irq
333 *
334 * Handles the action chain of an irq event
Linus Torvalds1da177e2005-04-16 15:20:36 -0700335 */
David Howells7d12e782006-10-05 14:55:46 +0100336irqreturn_t handle_IRQ_event(unsigned int irq, struct irqaction *action)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700337{
Jan Beulich908dcec2006-06-23 02:06:00 -0700338 irqreturn_t ret, retval = IRQ_NONE;
339 unsigned int status = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700340
Peter Zijlstra044d4082009-03-02 16:13:32 +0100341 WARN_ONCE(!in_irq(), "BUG: IRQ handler called from non-hardirq context!");
342
Thomas Gleixner3cca53b2006-07-01 19:29:31 -0700343 if (!(action->flags & IRQF_DISABLED))
Ingo Molnar366c7f52006-07-03 00:25:25 -0700344 local_irq_enable_in_hardirq();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700345
346 do {
David Howells7d12e782006-10-05 14:55:46 +0100347 ret = action->handler(irq, action->dev_id);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700348 if (ret == IRQ_HANDLED)
349 status |= action->flags;
350 retval |= ret;
351 action = action->next;
352 } while (action);
353
Thomas Gleixner3cca53b2006-07-01 19:29:31 -0700354 if (status & IRQF_SAMPLE_RANDOM)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700355 add_interrupt_randomness(irq);
356 local_irq_disable();
357
358 return retval;
359}
360
David Howellsaf8c65b2006-09-25 23:32:07 -0700361#ifndef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ
Thomas Gleixner0e57aa12009-03-13 14:34:05 +0100362
363#ifdef CONFIG_ENABLE_WARN_DEPRECATED
364# warning __do_IRQ is deprecated. Please convert to proper flow handlers
365#endif
366
Ingo Molnar8d28bc72006-06-29 02:24:46 -0700367/**
368 * __do_IRQ - original all in one highlevel IRQ handler
369 * @irq: the interrupt number
Ingo Molnar8d28bc72006-06-29 02:24:46 -0700370 *
371 * __do_IRQ handles all normal device IRQ's (the special
Linus Torvalds1da177e2005-04-16 15:20:36 -0700372 * SMP cross-CPU interrupts have their own specific
373 * handlers).
Ingo Molnar8d28bc72006-06-29 02:24:46 -0700374 *
375 * This is the original x86 implementation which is used for every
376 * interrupt type.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700377 */
Harvey Harrison7ad5b3a2008-02-08 04:19:53 -0800378unsigned int __do_IRQ(unsigned int irq)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700379{
Yinghai Lu08678b02008-08-19 20:50:05 -0700380 struct irq_desc *desc = irq_to_desc(irq);
Ingo Molnar06fcb0c2006-06-29 02:24:40 -0700381 struct irqaction *action;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700382 unsigned int status;
383
Thomas Gleixnerd6c88a52008-10-15 15:27:23 +0200384 kstat_incr_irqs_this_cpu(irq, desc);
385
Karsten Wiesef26fdd52005-09-06 15:17:25 -0700386 if (CHECK_IRQ_PER_CPU(desc->status)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700387 irqreturn_t action_ret;
388
389 /*
390 * No locking required for CPU-local interrupts:
391 */
Yinghai Lu48a1b102008-12-11 00:15:01 -0800392 if (desc->chip->ack) {
Ingo Molnard1bef4e2006-06-29 02:24:36 -0700393 desc->chip->ack(irq);
Yinghai Lu48a1b102008-12-11 00:15:01 -0800394 /* get new one */
395 desc = irq_remap_to_desc(irq, desc);
396 }
Russ Andersonc642b832007-11-14 17:00:15 -0800397 if (likely(!(desc->status & IRQ_DISABLED))) {
398 action_ret = handle_IRQ_event(irq, desc->action);
399 if (!noirqdebug)
400 note_interrupt(irq, desc, action_ret);
401 }
Ingo Molnard1bef4e2006-06-29 02:24:36 -0700402 desc->chip->end(irq);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700403 return 1;
404 }
405
406 spin_lock(&desc->lock);
Yinghai Lu48a1b102008-12-11 00:15:01 -0800407 if (desc->chip->ack) {
Ingo Molnard1bef4e2006-06-29 02:24:36 -0700408 desc->chip->ack(irq);
Yinghai Lu48a1b102008-12-11 00:15:01 -0800409 desc = irq_remap_to_desc(irq, desc);
410 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700411 /*
412 * REPLAY is when Linux resends an IRQ that was dropped earlier
413 * WAITING is used by probe to mark irqs that are being tested
414 */
415 status = desc->status & ~(IRQ_REPLAY | IRQ_WAITING);
416 status |= IRQ_PENDING; /* we _want_ to handle it */
417
418 /*
419 * If the IRQ is disabled for whatever reason, we cannot
420 * use the action we have.
421 */
422 action = NULL;
423 if (likely(!(status & (IRQ_DISABLED | IRQ_INPROGRESS)))) {
424 action = desc->action;
425 status &= ~IRQ_PENDING; /* we commit to handling */
426 status |= IRQ_INPROGRESS; /* we are handling it */
427 }
428 desc->status = status;
429
430 /*
431 * If there is no IRQ handler or it was disabled, exit early.
432 * Since we set PENDING, if another processor is handling
433 * a different instance of this same irq, the other processor
434 * will take care of it.
435 */
436 if (unlikely(!action))
437 goto out;
438
439 /*
440 * Edge triggered interrupts need to remember
441 * pending events.
442 * This applies to any hw interrupts that allow a second
443 * instance of the same irq to arrive while we are in do_IRQ
444 * or in the handler. But the code here only handles the _second_
445 * instance of the irq, not the third or fourth. So it is mostly
446 * useful for irq hardware that does not mask cleanly in an
447 * SMP environment.
448 */
449 for (;;) {
450 irqreturn_t action_ret;
451
452 spin_unlock(&desc->lock);
453
David Howells7d12e782006-10-05 14:55:46 +0100454 action_ret = handle_IRQ_event(irq, action);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700455 if (!noirqdebug)
David Howells7d12e782006-10-05 14:55:46 +0100456 note_interrupt(irq, desc, action_ret);
Linus Torvaldsb42172f2006-11-22 09:32:06 -0800457
458 spin_lock(&desc->lock);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700459 if (likely(!(desc->status & IRQ_PENDING)))
460 break;
461 desc->status &= ~IRQ_PENDING;
462 }
463 desc->status &= ~IRQ_INPROGRESS;
464
465out:
466 /*
467 * The ->end() handler has to deal with interrupts which got
468 * disabled while the handler was running.
469 */
Ingo Molnard1bef4e2006-06-29 02:24:36 -0700470 desc->chip->end(irq);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700471 spin_unlock(&desc->lock);
472
473 return 1;
474}
David Howellsaf8c65b2006-09-25 23:32:07 -0700475#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700476
Ingo Molnar243c7622006-07-03 00:25:06 -0700477void early_init_irq_lock_class(void)
478{
Thomas Gleixner10e58082008-10-16 14:19:04 +0200479 struct irq_desc *desc;
Ingo Molnar243c7622006-07-03 00:25:06 -0700480 int i;
481
Yinghai Lu0b8f1ef2008-12-05 18:58:31 -0800482 for_each_irq_desc(i, desc) {
Thomas Gleixner10e58082008-10-16 14:19:04 +0200483 lockdep_set_class(&desc->lock, &irq_desc_lock_class);
Yinghai Lu0b8f1ef2008-12-05 18:58:31 -0800484 }
Yinghai Lu08678b02008-08-19 20:50:05 -0700485}
Yinghai Lu0b8f1ef2008-12-05 18:58:31 -0800486
Yinghai Lu0b8f1ef2008-12-05 18:58:31 -0800487unsigned int kstat_irqs_cpu(unsigned int irq, int cpu)
488{
489 struct irq_desc *desc = irq_to_desc(irq);
KOSAKI Motohiro26ddd8d2008-12-26 14:24:10 +0900490 return desc ? desc->kstat_irqs[cpu] : 0;
Yinghai Lu0b8f1ef2008-12-05 18:58:31 -0800491}
Yinghai Lu0b8f1ef2008-12-05 18:58:31 -0800492EXPORT_SYMBOL(kstat_irqs_cpu);
493