| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* | 
|  | 2 | * linux/kernel/irq/handle.c | 
|  | 3 | * | 
| Ingo Molnar | a34db9b | 2006-06-29 02:24:50 -0700 | [diff] [blame] | 4 | * Copyright (C) 1992, 1998-2006 Linus Torvalds, Ingo Molnar | 
|  | 5 | * Copyright (C) 2005-2006, Thomas Gleixner, Russell King | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6 | * | 
|  | 7 | * This file contains the core interrupt handling code. | 
| Ingo Molnar | a34db9b | 2006-06-29 02:24:50 -0700 | [diff] [blame] | 8 | * | 
|  | 9 | * Detailed information is available in Documentation/DocBook/genericirq | 
|  | 10 | * | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 11 | */ | 
|  | 12 |  | 
|  | 13 | #include <linux/irq.h> | 
| Paul Mundt | 948cd52 | 2009-05-22 10:40:09 +0900 | [diff] [blame] | 14 | #include <linux/slab.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 15 | #include <linux/module.h> | 
|  | 16 | #include <linux/random.h> | 
|  | 17 | #include <linux/interrupt.h> | 
|  | 18 | #include <linux/kernel_stat.h> | 
| Yinghai Lu | 0b8f1ef | 2008-12-05 18:58:31 -0800 | [diff] [blame] | 19 | #include <linux/rculist.h> | 
|  | 20 | #include <linux/hash.h> | 
| Mike Travis | 0fa0ebb | 2009-01-10 22:24:06 -0800 | [diff] [blame] | 21 | #include <linux/bootmem.h> | 
| Steven Rostedt | ad8d75f | 2009-04-14 19:39:12 -0400 | [diff] [blame] | 22 | #include <trace/events/irq.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 23 |  | 
|  | 24 | #include "internals.h" | 
|  | 25 |  | 
| Yinghai Lu | 0b8f1ef | 2008-12-05 18:58:31 -0800 | [diff] [blame] | 26 | /* | 
|  | 27 | * lockdep: we want to handle all irq_desc locks as a single lock-class: | 
|  | 28 | */ | 
| Yinghai Lu | 48a1b10 | 2008-12-11 00:15:01 -0800 | [diff] [blame] | 29 | struct lock_class_key irq_desc_lock_class; | 
| Yinghai Lu | 0b8f1ef | 2008-12-05 18:58:31 -0800 | [diff] [blame] | 30 |  | 
| Thomas Gleixner | 6a6de9e | 2006-06-29 02:24:51 -0700 | [diff] [blame] | 31 | /** | 
|  | 32 | * handle_bad_irq - handle spurious and unhandled irqs | 
| Henrik Kretzschmar | 43a1dd5 | 2006-08-31 21:27:44 -0700 | [diff] [blame] | 33 | * @irq:       the interrupt number | 
|  | 34 | * @desc:      description of the interrupt | 
| Henrik Kretzschmar | 43a1dd5 | 2006-08-31 21:27:44 -0700 | [diff] [blame] | 35 | * | 
|  | 36 | * Handles spurious and unhandled IRQ's. It also prints a debugmessage. | 
| Thomas Gleixner | 6a6de9e | 2006-06-29 02:24:51 -0700 | [diff] [blame] | 37 | */ | 
| Thomas Gleixner | d6c88a5 | 2008-10-15 15:27:23 +0200 | [diff] [blame] | 38 | void handle_bad_irq(unsigned int irq, struct irq_desc *desc) | 
| Thomas Gleixner | 6a6de9e | 2006-06-29 02:24:51 -0700 | [diff] [blame] | 39 | { | 
| Ingo Molnar | 43f7775 | 2006-06-29 02:24:58 -0700 | [diff] [blame] | 40 | print_irq_desc(irq, desc); | 
| Thomas Gleixner | d6c88a5 | 2008-10-15 15:27:23 +0200 | [diff] [blame] | 41 | kstat_incr_irqs_this_cpu(irq, desc); | 
| Thomas Gleixner | 6a6de9e | 2006-06-29 02:24:51 -0700 | [diff] [blame] | 42 | ack_bad_irq(irq); | 
|  | 43 | } | 
|  | 44 |  | 
| David Daney | 97179fd | 2009-01-27 09:53:22 -0800 | [diff] [blame] | 45 | #if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_HARDIRQS) | 
|  | 46 | static void __init init_irq_default_affinity(void) | 
|  | 47 | { | 
| Yinghai Lu | 28be225 | 2009-06-12 11:33:02 +0300 | [diff] [blame] | 48 | alloc_cpumask_var(&irq_default_affinity, GFP_NOWAIT); | 
| David Daney | 97179fd | 2009-01-27 09:53:22 -0800 | [diff] [blame] | 49 | cpumask_setall(irq_default_affinity); | 
|  | 50 | } | 
|  | 51 | #else | 
|  | 52 | static void __init init_irq_default_affinity(void) | 
|  | 53 | { | 
|  | 54 | } | 
|  | 55 | #endif | 
|  | 56 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 57 | /* | 
|  | 58 | * Linux has a controller-independent interrupt architecture. | 
|  | 59 | * Every controller has a 'controller-template', that is used | 
|  | 60 | * by the main code to do the right thing. Each driver-visible | 
| Ingo Molnar | 06fcb0c | 2006-06-29 02:24:40 -0700 | [diff] [blame] | 61 | * interrupt source is transparently wired to the appropriate | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 62 | * controller. Thus drivers need not be aware of the | 
|  | 63 | * interrupt-controller. | 
|  | 64 | * | 
|  | 65 | * The code is designed to be easily extended with new/different | 
|  | 66 | * interrupt controllers, without having to do assembly magic or | 
|  | 67 | * having to touch the generic code. | 
|  | 68 | * | 
|  | 69 | * Controller mappings for all interrupt sources: | 
|  | 70 | */ | 
| Yinghai Lu | 85c0f90 | 2008-08-19 20:49:47 -0700 | [diff] [blame] | 71 | int nr_irqs = NR_IRQS; | 
| Ingo Molnar | fa42d10 | 2008-08-19 20:50:30 -0700 | [diff] [blame] | 72 | EXPORT_SYMBOL_GPL(nr_irqs); | 
| Yinghai Lu | d60458b | 2008-08-19 20:50:00 -0700 | [diff] [blame] | 73 |  | 
| Yinghai Lu | 0b8f1ef | 2008-12-05 18:58:31 -0800 | [diff] [blame] | 74 | #ifdef CONFIG_SPARSE_IRQ | 
| Mike Travis | 92296c6 | 2009-01-11 09:22:58 -0800 | [diff] [blame] | 75 |  | 
| Yinghai Lu | 0b8f1ef | 2008-12-05 18:58:31 -0800 | [diff] [blame] | 76 | static struct irq_desc irq_desc_init = { | 
|  | 77 | .irq	    = -1, | 
|  | 78 | .status	    = IRQ_DISABLED, | 
|  | 79 | .chip	    = &no_irq_chip, | 
|  | 80 | .handle_irq = handle_bad_irq, | 
|  | 81 | .depth      = 1, | 
|  | 82 | .lock       = __SPIN_LOCK_UNLOCKED(irq_desc_init.lock), | 
| Yinghai Lu | 0b8f1ef | 2008-12-05 18:58:31 -0800 | [diff] [blame] | 83 | }; | 
|  | 84 |  | 
| Paul Mundt | 948cd52 | 2009-05-22 10:40:09 +0900 | [diff] [blame] | 85 | void __ref init_kstat_irqs(struct irq_desc *desc, int node, int nr) | 
| Yinghai Lu | 0b8f1ef | 2008-12-05 18:58:31 -0800 | [diff] [blame] | 86 | { | 
| Yinghai Lu | 005bf0e6 | 2009-02-08 16:18:03 -0800 | [diff] [blame] | 87 | void *ptr; | 
| Yinghai Lu | 0b8f1ef | 2008-12-05 18:58:31 -0800 | [diff] [blame] | 88 |  | 
| Paul Mundt | 948cd52 | 2009-05-22 10:40:09 +0900 | [diff] [blame] | 89 | if (slab_is_available()) | 
|  | 90 | ptr = kzalloc_node(nr * sizeof(*desc->kstat_irqs), | 
|  | 91 | GFP_ATOMIC, node); | 
|  | 92 | else | 
|  | 93 | ptr = alloc_bootmem_node(NODE_DATA(node), | 
|  | 94 | nr * sizeof(*desc->kstat_irqs)); | 
| Yinghai Lu | 0b8f1ef | 2008-12-05 18:58:31 -0800 | [diff] [blame] | 95 |  | 
| Yinghai Lu | 005bf0e6 | 2009-02-08 16:18:03 -0800 | [diff] [blame] | 96 | /* | 
|  | 97 | * don't overwite if can not get new one | 
|  | 98 | * init_copy_kstat_irqs() could still use old one | 
|  | 99 | */ | 
|  | 100 | if (ptr) { | 
| Yinghai Lu | 85ac16d | 2009-04-27 18:00:38 -0700 | [diff] [blame] | 101 | printk(KERN_DEBUG "  alloc kstat_irqs on node %d\n", node); | 
| Yinghai Lu | 005bf0e6 | 2009-02-08 16:18:03 -0800 | [diff] [blame] | 102 | desc->kstat_irqs = ptr; | 
|  | 103 | } | 
| Yinghai Lu | 0b8f1ef | 2008-12-05 18:58:31 -0800 | [diff] [blame] | 104 | } | 
|  | 105 |  | 
| Yinghai Lu | 85ac16d | 2009-04-27 18:00:38 -0700 | [diff] [blame] | 106 | static void init_one_irq_desc(int irq, struct irq_desc *desc, int node) | 
| Yinghai Lu | 0b8f1ef | 2008-12-05 18:58:31 -0800 | [diff] [blame] | 107 | { | 
|  | 108 | memcpy(desc, &irq_desc_init, sizeof(struct irq_desc)); | 
| Ingo Molnar | 793f7b1 | 2008-12-26 19:02:20 +0100 | [diff] [blame] | 109 |  | 
|  | 110 | spin_lock_init(&desc->lock); | 
| Yinghai Lu | 0b8f1ef | 2008-12-05 18:58:31 -0800 | [diff] [blame] | 111 | desc->irq = irq; | 
|  | 112 | #ifdef CONFIG_SMP | 
| Yinghai Lu | 85ac16d | 2009-04-27 18:00:38 -0700 | [diff] [blame] | 113 | desc->node = node; | 
| Yinghai Lu | 0b8f1ef | 2008-12-05 18:58:31 -0800 | [diff] [blame] | 114 | #endif | 
|  | 115 | lockdep_set_class(&desc->lock, &irq_desc_lock_class); | 
| Yinghai Lu | 85ac16d | 2009-04-27 18:00:38 -0700 | [diff] [blame] | 116 | init_kstat_irqs(desc, node, nr_cpu_ids); | 
| Yinghai Lu | 0b8f1ef | 2008-12-05 18:58:31 -0800 | [diff] [blame] | 117 | if (!desc->kstat_irqs) { | 
|  | 118 | printk(KERN_ERR "can not alloc kstat_irqs\n"); | 
|  | 119 | BUG_ON(1); | 
|  | 120 | } | 
| Yinghai Lu | 85ac16d | 2009-04-27 18:00:38 -0700 | [diff] [blame] | 121 | if (!alloc_desc_masks(desc, node, false)) { | 
| Mike Travis | 7f7ace0 | 2009-01-10 21:58:08 -0800 | [diff] [blame] | 122 | printk(KERN_ERR "can not alloc irq_desc cpumasks\n"); | 
|  | 123 | BUG_ON(1); | 
|  | 124 | } | 
| Yinghai Lu | 9ec4fa2 | 2009-04-27 17:57:18 -0700 | [diff] [blame] | 125 | init_desc_masks(desc); | 
| Yinghai Lu | 85ac16d | 2009-04-27 18:00:38 -0700 | [diff] [blame] | 126 | arch_init_chip_data(desc, node); | 
| Yinghai Lu | 0b8f1ef | 2008-12-05 18:58:31 -0800 | [diff] [blame] | 127 | } | 
|  | 128 |  | 
|  | 129 | /* | 
|  | 130 | * Protect the sparse_irqs: | 
|  | 131 | */ | 
| Yinghai Lu | 48a1b10 | 2008-12-11 00:15:01 -0800 | [diff] [blame] | 132 | DEFINE_SPINLOCK(sparse_irq_lock); | 
| Yinghai Lu | 0b8f1ef | 2008-12-05 18:58:31 -0800 | [diff] [blame] | 133 |  | 
| Mike Travis | 0fa0ebb | 2009-01-10 22:24:06 -0800 | [diff] [blame] | 134 | struct irq_desc **irq_desc_ptrs __read_mostly; | 
| Yinghai Lu | 0b8f1ef | 2008-12-05 18:58:31 -0800 | [diff] [blame] | 135 |  | 
| Yinghai Lu | 99d093d | 2008-12-05 18:58:32 -0800 | [diff] [blame] | 136 | static struct irq_desc irq_desc_legacy[NR_IRQS_LEGACY] __cacheline_aligned_in_smp = { | 
|  | 137 | [0 ... NR_IRQS_LEGACY-1] = { | 
| Yinghai Lu | 0b8f1ef | 2008-12-05 18:58:31 -0800 | [diff] [blame] | 138 | .irq	    = -1, | 
|  | 139 | .status	    = IRQ_DISABLED, | 
|  | 140 | .chip	    = &no_irq_chip, | 
|  | 141 | .handle_irq = handle_bad_irq, | 
|  | 142 | .depth	    = 1, | 
|  | 143 | .lock	    = __SPIN_LOCK_UNLOCKED(irq_desc_init.lock), | 
| Yinghai Lu | 0b8f1ef | 2008-12-05 18:58:31 -0800 | [diff] [blame] | 144 | } | 
|  | 145 | }; | 
|  | 146 |  | 
| Mike Travis | 542d865 | 2009-01-10 22:24:07 -0800 | [diff] [blame] | 147 | static unsigned int *kstat_irqs_legacy; | 
| Yinghai Lu | 0b8f1ef | 2008-12-05 18:58:31 -0800 | [diff] [blame] | 148 |  | 
| Yinghai Lu | 13a0c3c | 2008-12-26 02:05:47 -0800 | [diff] [blame] | 149 | int __init early_irq_init(void) | 
| Yinghai Lu | 0b8f1ef | 2008-12-05 18:58:31 -0800 | [diff] [blame] | 150 | { | 
|  | 151 | struct irq_desc *desc; | 
|  | 152 | int legacy_count; | 
| Yinghai Lu | dad213a | 2009-05-28 18:14:40 -0700 | [diff] [blame] | 153 | int node; | 
| Yinghai Lu | 0b8f1ef | 2008-12-05 18:58:31 -0800 | [diff] [blame] | 154 | int i; | 
|  | 155 |  | 
| David Daney | 97179fd | 2009-01-27 09:53:22 -0800 | [diff] [blame] | 156 | init_irq_default_affinity(); | 
|  | 157 |  | 
| Yinghai Lu | 4a046d1 | 2009-01-12 17:39:24 -0800 | [diff] [blame] | 158 | /* initialize nr_irqs based on nr_cpu_ids */ | 
|  | 159 | arch_probe_nr_irqs(); | 
| Mike Travis | 9594949 | 2009-01-10 22:24:06 -0800 | [diff] [blame] | 160 | printk(KERN_INFO "NR_IRQS:%d nr_irqs:%d\n", NR_IRQS, nr_irqs); | 
|  | 161 |  | 
| Yinghai Lu | 0b8f1ef | 2008-12-05 18:58:31 -0800 | [diff] [blame] | 162 | desc = irq_desc_legacy; | 
|  | 163 | legacy_count = ARRAY_SIZE(irq_desc_legacy); | 
| Yinghai Lu | dad213a | 2009-05-28 18:14:40 -0700 | [diff] [blame] | 164 | node = first_online_node; | 
| Yinghai Lu | 0b8f1ef | 2008-12-05 18:58:31 -0800 | [diff] [blame] | 165 |  | 
| Mike Travis | 0fa0ebb | 2009-01-10 22:24:06 -0800 | [diff] [blame] | 166 | /* allocate irq_desc_ptrs array based on nr_irqs */ | 
| Pekka Enberg | 22fb4e7 | 2009-06-11 14:46:49 +0300 | [diff] [blame] | 167 | irq_desc_ptrs = kcalloc(nr_irqs, sizeof(void *), GFP_NOWAIT); | 
| Mike Travis | 0fa0ebb | 2009-01-10 22:24:06 -0800 | [diff] [blame] | 168 |  | 
| Mike Travis | 542d865 | 2009-01-10 22:24:07 -0800 | [diff] [blame] | 169 | /* allocate based on nr_cpu_ids */ | 
| Yinghai Lu | dad213a | 2009-05-28 18:14:40 -0700 | [diff] [blame] | 170 | kstat_irqs_legacy = kzalloc_node(NR_IRQS_LEGACY * nr_cpu_ids * | 
|  | 171 | sizeof(int), GFP_NOWAIT, node); | 
| Mike Travis | 542d865 | 2009-01-10 22:24:07 -0800 | [diff] [blame] | 172 |  | 
| Yinghai Lu | 0b8f1ef | 2008-12-05 18:58:31 -0800 | [diff] [blame] | 173 | for (i = 0; i < legacy_count; i++) { | 
|  | 174 | desc[i].irq = i; | 
| Mike Travis | 542d865 | 2009-01-10 22:24:07 -0800 | [diff] [blame] | 175 | desc[i].kstat_irqs = kstat_irqs_legacy + i * nr_cpu_ids; | 
| Yinghai Lu | fa6beb3 | 2008-12-22 20:24:09 -0800 | [diff] [blame] | 176 | lockdep_set_class(&desc[i].lock, &irq_desc_lock_class); | 
| Yinghai Lu | dad213a | 2009-05-28 18:14:40 -0700 | [diff] [blame] | 177 | alloc_desc_masks(&desc[i], node, true); | 
| Yinghai Lu | 9ec4fa2 | 2009-04-27 17:57:18 -0700 | [diff] [blame] | 178 | init_desc_masks(&desc[i]); | 
| Yinghai Lu | 0b8f1ef | 2008-12-05 18:58:31 -0800 | [diff] [blame] | 179 | irq_desc_ptrs[i] = desc + i; | 
|  | 180 | } | 
|  | 181 |  | 
| Mike Travis | 9594949 | 2009-01-10 22:24:06 -0800 | [diff] [blame] | 182 | for (i = legacy_count; i < nr_irqs; i++) | 
| Yinghai Lu | 0b8f1ef | 2008-12-05 18:58:31 -0800 | [diff] [blame] | 183 | irq_desc_ptrs[i] = NULL; | 
|  | 184 |  | 
| Yinghai Lu | 13a0c3c | 2008-12-26 02:05:47 -0800 | [diff] [blame] | 185 | return arch_early_irq_init(); | 
| Yinghai Lu | 0b8f1ef | 2008-12-05 18:58:31 -0800 | [diff] [blame] | 186 | } | 
|  | 187 |  | 
|  | 188 | struct irq_desc *irq_to_desc(unsigned int irq) | 
|  | 189 | { | 
| Mike Travis | 0fa0ebb | 2009-01-10 22:24:06 -0800 | [diff] [blame] | 190 | if (irq_desc_ptrs && irq < nr_irqs) | 
|  | 191 | return irq_desc_ptrs[irq]; | 
|  | 192 |  | 
|  | 193 | return NULL; | 
| Yinghai Lu | 0b8f1ef | 2008-12-05 18:58:31 -0800 | [diff] [blame] | 194 | } | 
|  | 195 |  | 
| Paul Mundt | 948cd52 | 2009-05-22 10:40:09 +0900 | [diff] [blame] | 196 | struct irq_desc * __ref irq_to_desc_alloc_node(unsigned int irq, int node) | 
| Yinghai Lu | 0b8f1ef | 2008-12-05 18:58:31 -0800 | [diff] [blame] | 197 | { | 
|  | 198 | struct irq_desc *desc; | 
|  | 199 | unsigned long flags; | 
| Yinghai Lu | 0b8f1ef | 2008-12-05 18:58:31 -0800 | [diff] [blame] | 200 |  | 
| Mike Travis | 9594949 | 2009-01-10 22:24:06 -0800 | [diff] [blame] | 201 | if (irq >= nr_irqs) { | 
| Mike Travis | e2f4d06 | 2009-01-10 22:24:06 -0800 | [diff] [blame] | 202 | WARN(1, "irq (%d) >= nr_irqs (%d) in irq_to_desc_alloc\n", | 
|  | 203 | irq, nr_irqs); | 
| Yinghai Lu | 0b8f1ef | 2008-12-05 18:58:31 -0800 | [diff] [blame] | 204 | return NULL; | 
|  | 205 | } | 
|  | 206 |  | 
|  | 207 | desc = irq_desc_ptrs[irq]; | 
|  | 208 | if (desc) | 
|  | 209 | return desc; | 
|  | 210 |  | 
|  | 211 | spin_lock_irqsave(&sparse_irq_lock, flags); | 
|  | 212 |  | 
|  | 213 | /* We have to check it to avoid races with another CPU */ | 
|  | 214 | desc = irq_desc_ptrs[irq]; | 
|  | 215 | if (desc) | 
|  | 216 | goto out_unlock; | 
|  | 217 |  | 
| Paul Mundt | 948cd52 | 2009-05-22 10:40:09 +0900 | [diff] [blame] | 218 | if (slab_is_available()) | 
|  | 219 | desc = kzalloc_node(sizeof(*desc), GFP_ATOMIC, node); | 
|  | 220 | else | 
|  | 221 | desc = alloc_bootmem_node(NODE_DATA(node), sizeof(*desc)); | 
|  | 222 |  | 
| Yinghai Lu | 85ac16d | 2009-04-27 18:00:38 -0700 | [diff] [blame] | 223 | printk(KERN_DEBUG "  alloc irq_desc for %d on node %d\n", irq, node); | 
| Yinghai Lu | 0b8f1ef | 2008-12-05 18:58:31 -0800 | [diff] [blame] | 224 | if (!desc) { | 
|  | 225 | printk(KERN_ERR "can not alloc irq_desc\n"); | 
|  | 226 | BUG_ON(1); | 
|  | 227 | } | 
| Yinghai Lu | 85ac16d | 2009-04-27 18:00:38 -0700 | [diff] [blame] | 228 | init_one_irq_desc(irq, desc, node); | 
| Yinghai Lu | 0b8f1ef | 2008-12-05 18:58:31 -0800 | [diff] [blame] | 229 |  | 
|  | 230 | irq_desc_ptrs[irq] = desc; | 
|  | 231 |  | 
|  | 232 | out_unlock: | 
|  | 233 | spin_unlock_irqrestore(&sparse_irq_lock, flags); | 
|  | 234 |  | 
|  | 235 | return desc; | 
|  | 236 | } | 
|  | 237 |  | 
| KOSAKI Motohiro | f9af0e7 | 2008-12-26 12:24:24 +0900 | [diff] [blame] | 238 | #else /* !CONFIG_SPARSE_IRQ */ | 
| Yinghai Lu | 0b8f1ef | 2008-12-05 18:58:31 -0800 | [diff] [blame] | 239 |  | 
| Ravikiran G Thirumalai | e729aa1 | 2007-05-08 00:29:13 -0700 | [diff] [blame] | 240 | struct irq_desc irq_desc[NR_IRQS] __cacheline_aligned_in_smp = { | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 241 | [0 ... NR_IRQS-1] = { | 
| Zhang, Yanmin | 4f167fb | 2005-05-16 21:53:43 -0700 | [diff] [blame] | 242 | .status = IRQ_DISABLED, | 
| Ingo Molnar | f1c2662 | 2006-06-29 02:24:57 -0700 | [diff] [blame] | 243 | .chip = &no_irq_chip, | 
| Ingo Molnar | 7a55713 | 2006-06-29 02:24:54 -0700 | [diff] [blame] | 244 | .handle_irq = handle_bad_irq, | 
| Thomas Gleixner | 94d39e1 | 2006-06-29 02:24:50 -0700 | [diff] [blame] | 245 | .depth = 1, | 
| Yinghai Lu | aac3f2b | 2008-09-24 19:04:35 -0700 | [diff] [blame] | 246 | .lock = __SPIN_LOCK_UNLOCKED(irq_desc->lock), | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 247 | } | 
|  | 248 | }; | 
| Yinghai Lu | 08678b0 | 2008-08-19 20:50:05 -0700 | [diff] [blame] | 249 |  | 
| Yinghai Lu | d7e51e6 | 2009-01-07 15:03:13 -0800 | [diff] [blame] | 250 | static unsigned int kstat_irqs_all[NR_IRQS][NR_CPUS]; | 
| Yinghai Lu | 12026ea | 2008-12-26 22:38:15 -0800 | [diff] [blame] | 251 | int __init early_irq_init(void) | 
|  | 252 | { | 
|  | 253 | struct irq_desc *desc; | 
|  | 254 | int count; | 
|  | 255 | int i; | 
|  | 256 |  | 
| David Daney | 97179fd | 2009-01-27 09:53:22 -0800 | [diff] [blame] | 257 | init_irq_default_affinity(); | 
|  | 258 |  | 
| Mike Travis | 9594949 | 2009-01-10 22:24:06 -0800 | [diff] [blame] | 259 | printk(KERN_INFO "NR_IRQS:%d\n", NR_IRQS); | 
|  | 260 |  | 
| Yinghai Lu | 12026ea | 2008-12-26 22:38:15 -0800 | [diff] [blame] | 261 | desc = irq_desc; | 
|  | 262 | count = ARRAY_SIZE(irq_desc); | 
|  | 263 |  | 
| Yinghai Lu | d7e51e6 | 2009-01-07 15:03:13 -0800 | [diff] [blame] | 264 | for (i = 0; i < count; i++) { | 
| Yinghai Lu | 12026ea | 2008-12-26 22:38:15 -0800 | [diff] [blame] | 265 | desc[i].irq = i; | 
| Yinghai Lu | 9ec4fa2 | 2009-04-27 17:57:18 -0700 | [diff] [blame] | 266 | alloc_desc_masks(&desc[i], 0, true); | 
|  | 267 | init_desc_masks(&desc[i]); | 
| Yinghai Lu | d7e51e6 | 2009-01-07 15:03:13 -0800 | [diff] [blame] | 268 | desc[i].kstat_irqs = kstat_irqs_all[i]; | 
|  | 269 | } | 
| Yinghai Lu | 12026ea | 2008-12-26 22:38:15 -0800 | [diff] [blame] | 270 | return arch_early_irq_init(); | 
|  | 271 | } | 
|  | 272 |  | 
| KOSAKI Motohiro | f9af0e7 | 2008-12-26 12:24:24 +0900 | [diff] [blame] | 273 | struct irq_desc *irq_to_desc(unsigned int irq) | 
|  | 274 | { | 
|  | 275 | return (irq < NR_IRQS) ? irq_desc + irq : NULL; | 
|  | 276 | } | 
|  | 277 |  | 
| Yinghai Lu | 85ac16d | 2009-04-27 18:00:38 -0700 | [diff] [blame] | 278 | struct irq_desc *irq_to_desc_alloc_node(unsigned int irq, int node) | 
| KOSAKI Motohiro | f9af0e7 | 2008-12-26 12:24:24 +0900 | [diff] [blame] | 279 | { | 
|  | 280 | return irq_to_desc(irq); | 
|  | 281 | } | 
|  | 282 | #endif /* !CONFIG_SPARSE_IRQ */ | 
| Yinghai Lu | 0b8f1ef | 2008-12-05 18:58:31 -0800 | [diff] [blame] | 283 |  | 
| Yinghai Lu | 0f3c2a8 | 2009-02-08 16:18:03 -0800 | [diff] [blame] | 284 | void clear_kstat_irqs(struct irq_desc *desc) | 
|  | 285 | { | 
|  | 286 | memset(desc->kstat_irqs, 0, nr_cpu_ids * sizeof(*(desc->kstat_irqs))); | 
|  | 287 | } | 
|  | 288 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 289 | /* | 
| Ingo Molnar | 77a5afe | 2006-06-29 02:24:46 -0700 | [diff] [blame] | 290 | * What should we do if we get a hw irq event on an illegal vector? | 
|  | 291 | * Each architecture has to answer this themself. | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 292 | */ | 
| Ingo Molnar | 77a5afe | 2006-06-29 02:24:46 -0700 | [diff] [blame] | 293 | static void ack_bad(unsigned int irq) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 294 | { | 
| Thomas Gleixner | d3c6004 | 2008-10-16 09:55:00 +0200 | [diff] [blame] | 295 | struct irq_desc *desc = irq_to_desc(irq); | 
| Yinghai Lu | 08678b0 | 2008-08-19 20:50:05 -0700 | [diff] [blame] | 296 |  | 
| Yinghai Lu | 08678b0 | 2008-08-19 20:50:05 -0700 | [diff] [blame] | 297 | print_irq_desc(irq, desc); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 298 | ack_bad_irq(irq); | 
|  | 299 | } | 
|  | 300 |  | 
| Ingo Molnar | 77a5afe | 2006-06-29 02:24:46 -0700 | [diff] [blame] | 301 | /* | 
|  | 302 | * NOP functions | 
|  | 303 | */ | 
|  | 304 | static void noop(unsigned int irq) | 
|  | 305 | { | 
|  | 306 | } | 
|  | 307 |  | 
|  | 308 | static unsigned int noop_ret(unsigned int irq) | 
|  | 309 | { | 
|  | 310 | return 0; | 
|  | 311 | } | 
|  | 312 |  | 
|  | 313 | /* | 
|  | 314 | * Generic no controller implementation | 
|  | 315 | */ | 
| Ingo Molnar | f1c2662 | 2006-06-29 02:24:57 -0700 | [diff] [blame] | 316 | struct irq_chip no_irq_chip = { | 
|  | 317 | .name		= "none", | 
| Ingo Molnar | 77a5afe | 2006-06-29 02:24:46 -0700 | [diff] [blame] | 318 | .startup	= noop_ret, | 
|  | 319 | .shutdown	= noop, | 
|  | 320 | .enable		= noop, | 
|  | 321 | .disable	= noop, | 
|  | 322 | .ack		= ack_bad, | 
|  | 323 | .end		= noop, | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 324 | }; | 
|  | 325 |  | 
|  | 326 | /* | 
| Thomas Gleixner | f8b5473 | 2006-07-01 22:30:08 +0100 | [diff] [blame] | 327 | * Generic dummy implementation which can be used for | 
|  | 328 | * real dumb interrupt sources | 
|  | 329 | */ | 
|  | 330 | struct irq_chip dummy_irq_chip = { | 
|  | 331 | .name		= "dummy", | 
|  | 332 | .startup	= noop_ret, | 
|  | 333 | .shutdown	= noop, | 
|  | 334 | .enable		= noop, | 
|  | 335 | .disable	= noop, | 
|  | 336 | .ack		= noop, | 
|  | 337 | .mask		= noop, | 
|  | 338 | .unmask		= noop, | 
|  | 339 | .end		= noop, | 
|  | 340 | }; | 
|  | 341 |  | 
|  | 342 | /* | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 343 | * Special, empty irq handler: | 
|  | 344 | */ | 
| David Howells | 7d12e78 | 2006-10-05 14:55:46 +0100 | [diff] [blame] | 345 | irqreturn_t no_action(int cpl, void *dev_id) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 346 | { | 
|  | 347 | return IRQ_NONE; | 
|  | 348 | } | 
|  | 349 |  | 
| Thomas Gleixner | f48fe81 | 2009-03-24 11:46:22 +0100 | [diff] [blame] | 350 | static void warn_no_thread(unsigned int irq, struct irqaction *action) | 
|  | 351 | { | 
|  | 352 | if (test_and_set_bit(IRQTF_WARNED, &action->thread_flags)) | 
|  | 353 | return; | 
|  | 354 |  | 
|  | 355 | printk(KERN_WARNING "IRQ %d device %s returned IRQ_WAKE_THREAD " | 
|  | 356 | "but no thread function available.", irq, action->name); | 
|  | 357 | } | 
|  | 358 |  | 
| Ingo Molnar | 8d28bc7 | 2006-06-29 02:24:46 -0700 | [diff] [blame] | 359 | /** | 
|  | 360 | * handle_IRQ_event - irq action chain handler | 
|  | 361 | * @irq:	the interrupt number | 
| Ingo Molnar | 8d28bc7 | 2006-06-29 02:24:46 -0700 | [diff] [blame] | 362 | * @action:	the interrupt action chain for this irq | 
|  | 363 | * | 
|  | 364 | * Handles the action chain of an irq event | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 365 | */ | 
| David Howells | 7d12e78 | 2006-10-05 14:55:46 +0100 | [diff] [blame] | 366 | irqreturn_t handle_IRQ_event(unsigned int irq, struct irqaction *action) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 367 | { | 
| Jan Beulich | 908dcec | 2006-06-23 02:06:00 -0700 | [diff] [blame] | 368 | irqreturn_t ret, retval = IRQ_NONE; | 
|  | 369 | unsigned int status = 0; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 370 |  | 
| Thomas Gleixner | 3cca53b | 2006-07-01 19:29:31 -0700 | [diff] [blame] | 371 | if (!(action->flags & IRQF_DISABLED)) | 
| Ingo Molnar | 366c7f5 | 2006-07-03 00:25:25 -0700 | [diff] [blame] | 372 | local_irq_enable_in_hardirq(); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 373 |  | 
|  | 374 | do { | 
| Jason Baron | af39241 | 2009-02-26 10:11:05 -0500 | [diff] [blame] | 375 | trace_irq_handler_entry(irq, action); | 
| David Howells | 7d12e78 | 2006-10-05 14:55:46 +0100 | [diff] [blame] | 376 | ret = action->handler(irq, action->dev_id); | 
| Jason Baron | af39241 | 2009-02-26 10:11:05 -0500 | [diff] [blame] | 377 | trace_irq_handler_exit(irq, action, ret); | 
| Thomas Gleixner | 3aa551c | 2009-03-23 18:28:15 +0100 | [diff] [blame] | 378 |  | 
|  | 379 | switch (ret) { | 
|  | 380 | case IRQ_WAKE_THREAD: | 
|  | 381 | /* | 
| Thomas Gleixner | f48fe81 | 2009-03-24 11:46:22 +0100 | [diff] [blame] | 382 | * Set result to handled so the spurious check | 
|  | 383 | * does not trigger. | 
|  | 384 | */ | 
|  | 385 | ret = IRQ_HANDLED; | 
|  | 386 |  | 
|  | 387 | /* | 
|  | 388 | * Catch drivers which return WAKE_THREAD but | 
|  | 389 | * did not set up a thread function | 
|  | 390 | */ | 
|  | 391 | if (unlikely(!action->thread_fn)) { | 
|  | 392 | warn_no_thread(irq, action); | 
|  | 393 | break; | 
|  | 394 | } | 
|  | 395 |  | 
|  | 396 | /* | 
| Thomas Gleixner | 3aa551c | 2009-03-23 18:28:15 +0100 | [diff] [blame] | 397 | * Wake up the handler thread for this | 
|  | 398 | * action. In case the thread crashed and was | 
|  | 399 | * killed we just pretend that we handled the | 
|  | 400 | * interrupt. The hardirq handler above has | 
|  | 401 | * disabled the device interrupt, so no irq | 
|  | 402 | * storm is lurking. | 
|  | 403 | */ | 
|  | 404 | if (likely(!test_bit(IRQTF_DIED, | 
|  | 405 | &action->thread_flags))) { | 
|  | 406 | set_bit(IRQTF_RUNTHREAD, &action->thread_flags); | 
|  | 407 | wake_up_process(action->thread); | 
|  | 408 | } | 
|  | 409 |  | 
| Thomas Gleixner | 3aa551c | 2009-03-23 18:28:15 +0100 | [diff] [blame] | 410 | /* Fall through to add to randomness */ | 
|  | 411 | case IRQ_HANDLED: | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 412 | status |= action->flags; | 
| Thomas Gleixner | 3aa551c | 2009-03-23 18:28:15 +0100 | [diff] [blame] | 413 | break; | 
|  | 414 |  | 
|  | 415 | default: | 
|  | 416 | break; | 
|  | 417 | } | 
|  | 418 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 419 | retval |= ret; | 
|  | 420 | action = action->next; | 
|  | 421 | } while (action); | 
|  | 422 |  | 
| Thomas Gleixner | 3cca53b | 2006-07-01 19:29:31 -0700 | [diff] [blame] | 423 | if (status & IRQF_SAMPLE_RANDOM) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 424 | add_interrupt_randomness(irq); | 
|  | 425 | local_irq_disable(); | 
|  | 426 |  | 
|  | 427 | return retval; | 
|  | 428 | } | 
|  | 429 |  | 
| David Howells | af8c65b | 2006-09-25 23:32:07 -0700 | [diff] [blame] | 430 | #ifndef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ | 
| Thomas Gleixner | 0e57aa1 | 2009-03-13 14:34:05 +0100 | [diff] [blame] | 431 |  | 
|  | 432 | #ifdef CONFIG_ENABLE_WARN_DEPRECATED | 
|  | 433 | # warning __do_IRQ is deprecated. Please convert to proper flow handlers | 
|  | 434 | #endif | 
|  | 435 |  | 
| Ingo Molnar | 8d28bc7 | 2006-06-29 02:24:46 -0700 | [diff] [blame] | 436 | /** | 
|  | 437 | * __do_IRQ - original all in one highlevel IRQ handler | 
|  | 438 | * @irq:	the interrupt number | 
| Ingo Molnar | 8d28bc7 | 2006-06-29 02:24:46 -0700 | [diff] [blame] | 439 | * | 
|  | 440 | * __do_IRQ handles all normal device IRQ's (the special | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 441 | * SMP cross-CPU interrupts have their own specific | 
|  | 442 | * handlers). | 
| Ingo Molnar | 8d28bc7 | 2006-06-29 02:24:46 -0700 | [diff] [blame] | 443 | * | 
|  | 444 | * This is the original x86 implementation which is used for every | 
|  | 445 | * interrupt type. | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 446 | */ | 
| Harvey Harrison | 7ad5b3a | 2008-02-08 04:19:53 -0800 | [diff] [blame] | 447 | unsigned int __do_IRQ(unsigned int irq) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 448 | { | 
| Yinghai Lu | 08678b0 | 2008-08-19 20:50:05 -0700 | [diff] [blame] | 449 | struct irq_desc *desc = irq_to_desc(irq); | 
| Ingo Molnar | 06fcb0c | 2006-06-29 02:24:40 -0700 | [diff] [blame] | 450 | struct irqaction *action; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 451 | unsigned int status; | 
|  | 452 |  | 
| Thomas Gleixner | d6c88a5 | 2008-10-15 15:27:23 +0200 | [diff] [blame] | 453 | kstat_incr_irqs_this_cpu(irq, desc); | 
|  | 454 |  | 
| Karsten Wiese | f26fdd5 | 2005-09-06 15:17:25 -0700 | [diff] [blame] | 455 | if (CHECK_IRQ_PER_CPU(desc->status)) { | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 456 | irqreturn_t action_ret; | 
|  | 457 |  | 
|  | 458 | /* | 
|  | 459 | * No locking required for CPU-local interrupts: | 
|  | 460 | */ | 
| Yinghai Lu | fcef591 | 2009-04-27 17:58:23 -0700 | [diff] [blame] | 461 | if (desc->chip->ack) | 
| Ingo Molnar | d1bef4e | 2006-06-29 02:24:36 -0700 | [diff] [blame] | 462 | desc->chip->ack(irq); | 
| Russ Anderson | c642b83 | 2007-11-14 17:00:15 -0800 | [diff] [blame] | 463 | if (likely(!(desc->status & IRQ_DISABLED))) { | 
|  | 464 | action_ret = handle_IRQ_event(irq, desc->action); | 
|  | 465 | if (!noirqdebug) | 
|  | 466 | note_interrupt(irq, desc, action_ret); | 
|  | 467 | } | 
| Ingo Molnar | d1bef4e | 2006-06-29 02:24:36 -0700 | [diff] [blame] | 468 | desc->chip->end(irq); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 469 | return 1; | 
|  | 470 | } | 
|  | 471 |  | 
|  | 472 | spin_lock(&desc->lock); | 
| Yinghai Lu | fcef591 | 2009-04-27 17:58:23 -0700 | [diff] [blame] | 473 | if (desc->chip->ack) | 
| Ingo Molnar | d1bef4e | 2006-06-29 02:24:36 -0700 | [diff] [blame] | 474 | desc->chip->ack(irq); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 475 | /* | 
|  | 476 | * REPLAY is when Linux resends an IRQ that was dropped earlier | 
|  | 477 | * WAITING is used by probe to mark irqs that are being tested | 
|  | 478 | */ | 
|  | 479 | status = desc->status & ~(IRQ_REPLAY | IRQ_WAITING); | 
|  | 480 | status |= IRQ_PENDING; /* we _want_ to handle it */ | 
|  | 481 |  | 
|  | 482 | /* | 
|  | 483 | * If the IRQ is disabled for whatever reason, we cannot | 
|  | 484 | * use the action we have. | 
|  | 485 | */ | 
|  | 486 | action = NULL; | 
|  | 487 | if (likely(!(status & (IRQ_DISABLED | IRQ_INPROGRESS)))) { | 
|  | 488 | action = desc->action; | 
|  | 489 | status &= ~IRQ_PENDING; /* we commit to handling */ | 
|  | 490 | status |= IRQ_INPROGRESS; /* we are handling it */ | 
|  | 491 | } | 
|  | 492 | desc->status = status; | 
|  | 493 |  | 
|  | 494 | /* | 
|  | 495 | * If there is no IRQ handler or it was disabled, exit early. | 
|  | 496 | * Since we set PENDING, if another processor is handling | 
|  | 497 | * a different instance of this same irq, the other processor | 
|  | 498 | * will take care of it. | 
|  | 499 | */ | 
|  | 500 | if (unlikely(!action)) | 
|  | 501 | goto out; | 
|  | 502 |  | 
|  | 503 | /* | 
|  | 504 | * Edge triggered interrupts need to remember | 
|  | 505 | * pending events. | 
|  | 506 | * This applies to any hw interrupts that allow a second | 
|  | 507 | * instance of the same irq to arrive while we are in do_IRQ | 
|  | 508 | * or in the handler. But the code here only handles the _second_ | 
|  | 509 | * instance of the irq, not the third or fourth. So it is mostly | 
|  | 510 | * useful for irq hardware that does not mask cleanly in an | 
|  | 511 | * SMP environment. | 
|  | 512 | */ | 
|  | 513 | for (;;) { | 
|  | 514 | irqreturn_t action_ret; | 
|  | 515 |  | 
|  | 516 | spin_unlock(&desc->lock); | 
|  | 517 |  | 
| David Howells | 7d12e78 | 2006-10-05 14:55:46 +0100 | [diff] [blame] | 518 | action_ret = handle_IRQ_event(irq, action); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 519 | if (!noirqdebug) | 
| David Howells | 7d12e78 | 2006-10-05 14:55:46 +0100 | [diff] [blame] | 520 | note_interrupt(irq, desc, action_ret); | 
| Linus Torvalds | b42172f | 2006-11-22 09:32:06 -0800 | [diff] [blame] | 521 |  | 
|  | 522 | spin_lock(&desc->lock); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 523 | if (likely(!(desc->status & IRQ_PENDING))) | 
|  | 524 | break; | 
|  | 525 | desc->status &= ~IRQ_PENDING; | 
|  | 526 | } | 
|  | 527 | desc->status &= ~IRQ_INPROGRESS; | 
|  | 528 |  | 
|  | 529 | out: | 
|  | 530 | /* | 
|  | 531 | * The ->end() handler has to deal with interrupts which got | 
|  | 532 | * disabled while the handler was running. | 
|  | 533 | */ | 
| Ingo Molnar | d1bef4e | 2006-06-29 02:24:36 -0700 | [diff] [blame] | 534 | desc->chip->end(irq); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 535 | spin_unlock(&desc->lock); | 
|  | 536 |  | 
|  | 537 | return 1; | 
|  | 538 | } | 
| David Howells | af8c65b | 2006-09-25 23:32:07 -0700 | [diff] [blame] | 539 | #endif | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 540 |  | 
| Ingo Molnar | 243c762 | 2006-07-03 00:25:06 -0700 | [diff] [blame] | 541 | void early_init_irq_lock_class(void) | 
|  | 542 | { | 
| Thomas Gleixner | 10e5808 | 2008-10-16 14:19:04 +0200 | [diff] [blame] | 543 | struct irq_desc *desc; | 
| Ingo Molnar | 243c762 | 2006-07-03 00:25:06 -0700 | [diff] [blame] | 544 | int i; | 
|  | 545 |  | 
| Yinghai Lu | 0b8f1ef | 2008-12-05 18:58:31 -0800 | [diff] [blame] | 546 | for_each_irq_desc(i, desc) { | 
| Thomas Gleixner | 10e5808 | 2008-10-16 14:19:04 +0200 | [diff] [blame] | 547 | lockdep_set_class(&desc->lock, &irq_desc_lock_class); | 
| Yinghai Lu | 0b8f1ef | 2008-12-05 18:58:31 -0800 | [diff] [blame] | 548 | } | 
| Yinghai Lu | 08678b0 | 2008-08-19 20:50:05 -0700 | [diff] [blame] | 549 | } | 
| Yinghai Lu | 0b8f1ef | 2008-12-05 18:58:31 -0800 | [diff] [blame] | 550 |  | 
| Yinghai Lu | 0b8f1ef | 2008-12-05 18:58:31 -0800 | [diff] [blame] | 551 | unsigned int kstat_irqs_cpu(unsigned int irq, int cpu) | 
|  | 552 | { | 
|  | 553 | struct irq_desc *desc = irq_to_desc(irq); | 
| KOSAKI Motohiro | 26ddd8d | 2008-12-26 14:24:10 +0900 | [diff] [blame] | 554 | return desc ? desc->kstat_irqs[cpu] : 0; | 
| Yinghai Lu | 0b8f1ef | 2008-12-05 18:58:31 -0800 | [diff] [blame] | 555 | } | 
| Yinghai Lu | 0b8f1ef | 2008-12-05 18:58:31 -0800 | [diff] [blame] | 556 | EXPORT_SYMBOL(kstat_irqs_cpu); | 
|  | 557 |  |