diff options
Diffstat (limited to 'kernel/irq')
| -rw-r--r-- | kernel/irq/Makefile | 2 | ||||
| -rw-r--r-- | kernel/irq/autoprobe.c | 56 | ||||
| -rw-r--r-- | kernel/irq/chip.c | 525 | ||||
| -rw-r--r-- | kernel/irq/handle.c | 122 | ||||
| -rw-r--r-- | kernel/irq/internals.h | 46 | ||||
| -rw-r--r-- | kernel/irq/manage.c | 179 | ||||
| -rw-r--r-- | kernel/irq/migration.c | 20 | ||||
| -rw-r--r-- | kernel/irq/proc.c | 30 | ||||
| -rw-r--r-- | kernel/irq/resend.c | 78 | ||||
| -rw-r--r-- | kernel/irq/spurious.c | 37 |
10 files changed, 924 insertions, 171 deletions
diff --git a/kernel/irq/Makefile b/kernel/irq/Makefile index 9f77f50d8143..1dab0ac3f797 100644 --- a/kernel/irq/Makefile +++ b/kernel/irq/Makefile | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | 1 | ||
| 2 | obj-y := handle.o manage.o spurious.o | 2 | obj-y := handle.o manage.o spurious.o resend.o chip.o |
| 3 | obj-$(CONFIG_GENERIC_IRQ_PROBE) += autoprobe.o | 3 | obj-$(CONFIG_GENERIC_IRQ_PROBE) += autoprobe.o |
| 4 | obj-$(CONFIG_PROC_FS) += proc.o | 4 | obj-$(CONFIG_PROC_FS) += proc.o |
| 5 | obj-$(CONFIG_GENERIC_PENDING_IRQ) += migration.o | 5 | obj-$(CONFIG_GENERIC_PENDING_IRQ) += migration.o |
diff --git a/kernel/irq/autoprobe.c b/kernel/irq/autoprobe.c index 3467097ca61a..533068cfb607 100644 --- a/kernel/irq/autoprobe.c +++ b/kernel/irq/autoprobe.c | |||
| @@ -11,12 +11,14 @@ | |||
| 11 | #include <linux/interrupt.h> | 11 | #include <linux/interrupt.h> |
| 12 | #include <linux/delay.h> | 12 | #include <linux/delay.h> |
| 13 | 13 | ||
| 14 | #include "internals.h" | ||
| 15 | |||
| 14 | /* | 16 | /* |
| 15 | * Autodetection depends on the fact that any interrupt that | 17 | * Autodetection depends on the fact that any interrupt that |
| 16 | * comes in on to an unassigned handler will get stuck with | 18 | * comes in on to an unassigned handler will get stuck with |
| 17 | * "IRQ_WAITING" cleared and the interrupt disabled. | 19 | * "IRQ_WAITING" cleared and the interrupt disabled. |
| 18 | */ | 20 | */ |
| 19 | static DECLARE_MUTEX(probe_sem); | 21 | static DEFINE_MUTEX(probing_active); |
| 20 | 22 | ||
| 21 | /** | 23 | /** |
| 22 | * probe_irq_on - begin an interrupt autodetect | 24 | * probe_irq_on - begin an interrupt autodetect |
| @@ -27,11 +29,11 @@ static DECLARE_MUTEX(probe_sem); | |||
| 27 | */ | 29 | */ |
| 28 | unsigned long probe_irq_on(void) | 30 | unsigned long probe_irq_on(void) |
| 29 | { | 31 | { |
| 30 | unsigned long val; | 32 | struct irq_desc *desc; |
| 31 | irq_desc_t *desc; | 33 | unsigned long mask; |
| 32 | unsigned int i; | 34 | unsigned int i; |
| 33 | 35 | ||
| 34 | down(&probe_sem); | 36 | mutex_lock(&probing_active); |
| 35 | /* | 37 | /* |
| 36 | * something may have generated an irq long ago and we want to | 38 | * something may have generated an irq long ago and we want to |
| 37 | * flush such a longstanding irq before considering it as spurious. | 39 | * flush such a longstanding irq before considering it as spurious. |
| @@ -40,8 +42,21 @@ unsigned long probe_irq_on(void) | |||
| 40 | desc = irq_desc + i; | 42 | desc = irq_desc + i; |
| 41 | 43 | ||
| 42 | spin_lock_irq(&desc->lock); | 44 | spin_lock_irq(&desc->lock); |
| 43 | if (!irq_desc[i].action) | 45 | if (!desc->action && !(desc->status & IRQ_NOPROBE)) { |
| 44 | irq_desc[i].handler->startup(i); | 46 | /* |
| 47 | * An old-style architecture might still have | ||
| 48 | * the handle_bad_irq handler there: | ||
| 49 | */ | ||
| 50 | compat_irq_chip_set_default_handler(desc); | ||
| 51 | |||
| 52 | /* | ||
| 53 | * Some chips need to know about probing in | ||
| 54 | * progress: | ||
| 55 | */ | ||
| 56 | if (desc->chip->set_type) | ||
| 57 | desc->chip->set_type(i, IRQ_TYPE_PROBE); | ||
| 58 | desc->chip->startup(i); | ||
| 59 | } | ||
| 45 | spin_unlock_irq(&desc->lock); | 60 | spin_unlock_irq(&desc->lock); |
| 46 | } | 61 | } |
| 47 | 62 | ||
| @@ -57,9 +72,9 @@ unsigned long probe_irq_on(void) | |||
| 57 | desc = irq_desc + i; | 72 | desc = irq_desc + i; |
| 58 | 73 | ||
| 59 | spin_lock_irq(&desc->lock); | 74 | spin_lock_irq(&desc->lock); |
| 60 | if (!desc->action) { | 75 | if (!desc->action && !(desc->status & IRQ_NOPROBE)) { |
| 61 | desc->status |= IRQ_AUTODETECT | IRQ_WAITING; | 76 | desc->status |= IRQ_AUTODETECT | IRQ_WAITING; |
| 62 | if (desc->handler->startup(i)) | 77 | if (desc->chip->startup(i)) |
| 63 | desc->status |= IRQ_PENDING; | 78 | desc->status |= IRQ_PENDING; |
| 64 | } | 79 | } |
| 65 | spin_unlock_irq(&desc->lock); | 80 | spin_unlock_irq(&desc->lock); |
| @@ -73,11 +88,11 @@ unsigned long probe_irq_on(void) | |||
| 73 | /* | 88 | /* |
| 74 | * Now filter out any obviously spurious interrupts | 89 | * Now filter out any obviously spurious interrupts |
| 75 | */ | 90 | */ |
| 76 | val = 0; | 91 | mask = 0; |
| 77 | for (i = 0; i < NR_IRQS; i++) { | 92 | for (i = 0; i < NR_IRQS; i++) { |
| 78 | irq_desc_t *desc = irq_desc + i; | ||
| 79 | unsigned int status; | 93 | unsigned int status; |
| 80 | 94 | ||
| 95 | desc = irq_desc + i; | ||
| 81 | spin_lock_irq(&desc->lock); | 96 | spin_lock_irq(&desc->lock); |
| 82 | status = desc->status; | 97 | status = desc->status; |
| 83 | 98 | ||
| @@ -85,17 +100,16 @@ unsigned long probe_irq_on(void) | |||
| 85 | /* It triggered already - consider it spurious. */ | 100 | /* It triggered already - consider it spurious. */ |
| 86 | if (!(status & IRQ_WAITING)) { | 101 | if (!(status & IRQ_WAITING)) { |
| 87 | desc->status = status & ~IRQ_AUTODETECT; | 102 | desc->status = status & ~IRQ_AUTODETECT; |
| 88 | desc->handler->shutdown(i); | 103 | desc->chip->shutdown(i); |
| 89 | } else | 104 | } else |
| 90 | if (i < 32) | 105 | if (i < 32) |
| 91 | val |= 1 << i; | 106 | mask |= 1 << i; |
| 92 | } | 107 | } |
| 93 | spin_unlock_irq(&desc->lock); | 108 | spin_unlock_irq(&desc->lock); |
| 94 | } | 109 | } |
| 95 | 110 | ||
| 96 | return val; | 111 | return mask; |
| 97 | } | 112 | } |
| 98 | |||
| 99 | EXPORT_SYMBOL(probe_irq_on); | 113 | EXPORT_SYMBOL(probe_irq_on); |
| 100 | 114 | ||
| 101 | /** | 115 | /** |
| @@ -117,7 +131,7 @@ unsigned int probe_irq_mask(unsigned long val) | |||
| 117 | 131 | ||
| 118 | mask = 0; | 132 | mask = 0; |
| 119 | for (i = 0; i < NR_IRQS; i++) { | 133 | for (i = 0; i < NR_IRQS; i++) { |
| 120 | irq_desc_t *desc = irq_desc + i; | 134 | struct irq_desc *desc = irq_desc + i; |
| 121 | unsigned int status; | 135 | unsigned int status; |
| 122 | 136 | ||
| 123 | spin_lock_irq(&desc->lock); | 137 | spin_lock_irq(&desc->lock); |
| @@ -128,11 +142,11 @@ unsigned int probe_irq_mask(unsigned long val) | |||
| 128 | mask |= 1 << i; | 142 | mask |= 1 << i; |
| 129 | 143 | ||
| 130 | desc->status = status & ~IRQ_AUTODETECT; | 144 | desc->status = status & ~IRQ_AUTODETECT; |
| 131 | desc->handler->shutdown(i); | 145 | desc->chip->shutdown(i); |
| 132 | } | 146 | } |
| 133 | spin_unlock_irq(&desc->lock); | 147 | spin_unlock_irq(&desc->lock); |
| 134 | } | 148 | } |
| 135 | up(&probe_sem); | 149 | mutex_unlock(&probing_active); |
| 136 | 150 | ||
| 137 | return mask & val; | 151 | return mask & val; |
| 138 | } | 152 | } |
| @@ -160,7 +174,7 @@ int probe_irq_off(unsigned long val) | |||
| 160 | int i, irq_found = 0, nr_irqs = 0; | 174 | int i, irq_found = 0, nr_irqs = 0; |
| 161 | 175 | ||
| 162 | for (i = 0; i < NR_IRQS; i++) { | 176 | for (i = 0; i < NR_IRQS; i++) { |
| 163 | irq_desc_t *desc = irq_desc + i; | 177 | struct irq_desc *desc = irq_desc + i; |
| 164 | unsigned int status; | 178 | unsigned int status; |
| 165 | 179 | ||
| 166 | spin_lock_irq(&desc->lock); | 180 | spin_lock_irq(&desc->lock); |
| @@ -173,16 +187,16 @@ int probe_irq_off(unsigned long val) | |||
| 173 | nr_irqs++; | 187 | nr_irqs++; |
| 174 | } | 188 | } |
| 175 | desc->status = status & ~IRQ_AUTODETECT; | 189 | desc->status = status & ~IRQ_AUTODETECT; |
| 176 | desc->handler->shutdown(i); | 190 | desc->chip->shutdown(i); |
| 177 | } | 191 | } |
| 178 | spin_unlock_irq(&desc->lock); | 192 | spin_unlock_irq(&desc->lock); |
| 179 | } | 193 | } |
| 180 | up(&probe_sem); | 194 | mutex_unlock(&probing_active); |
| 181 | 195 | ||
| 182 | if (nr_irqs > 1) | 196 | if (nr_irqs > 1) |
| 183 | irq_found = -irq_found; | 197 | irq_found = -irq_found; |
| 198 | |||
| 184 | return irq_found; | 199 | return irq_found; |
| 185 | } | 200 | } |
| 186 | |||
| 187 | EXPORT_SYMBOL(probe_irq_off); | 201 | EXPORT_SYMBOL(probe_irq_off); |
| 188 | 202 | ||
diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c new file mode 100644 index 000000000000..4a0952d9458b --- /dev/null +++ b/kernel/irq/chip.c | |||
| @@ -0,0 +1,525 @@ | |||
| 1 | /* | ||
| 2 | * linux/kernel/irq/chip.c | ||
| 3 | * | ||
| 4 | * Copyright (C) 1992, 1998-2006 Linus Torvalds, Ingo Molnar | ||
| 5 | * Copyright (C) 2005-2006, Thomas Gleixner, Russell King | ||
| 6 | * | ||
| 7 | * This file contains the core interrupt handling code, for irq-chip | ||
| 8 | * based architectures. | ||
| 9 | * | ||
| 10 | * Detailed information is available in Documentation/DocBook/genericirq | ||
| 11 | */ | ||
| 12 | |||
| 13 | #include <linux/irq.h> | ||
| 14 | #include <linux/module.h> | ||
| 15 | #include <linux/interrupt.h> | ||
| 16 | #include <linux/kernel_stat.h> | ||
| 17 | |||
| 18 | #include "internals.h" | ||
| 19 | |||
| 20 | /** | ||
| 21 | * set_irq_chip - set the irq chip for an irq | ||
| 22 | * @irq: irq number | ||
| 23 | * @chip: pointer to irq chip description structure | ||
| 24 | */ | ||
| 25 | int set_irq_chip(unsigned int irq, struct irq_chip *chip) | ||
| 26 | { | ||
| 27 | struct irq_desc *desc; | ||
| 28 | unsigned long flags; | ||
| 29 | |||
| 30 | if (irq >= NR_IRQS) { | ||
| 31 | printk(KERN_ERR "Trying to install chip for IRQ%d\n", irq); | ||
| 32 | WARN_ON(1); | ||
| 33 | return -EINVAL; | ||
| 34 | } | ||
| 35 | |||
| 36 | if (!chip) | ||
| 37 | chip = &no_irq_chip; | ||
| 38 | |||
| 39 | desc = irq_desc + irq; | ||
| 40 | spin_lock_irqsave(&desc->lock, flags); | ||
| 41 | irq_chip_set_defaults(chip); | ||
| 42 | desc->chip = chip; | ||
| 43 | /* | ||
| 44 | * For compatibility only: | ||
| 45 | */ | ||
| 46 | desc->chip = chip; | ||
| 47 | spin_unlock_irqrestore(&desc->lock, flags); | ||
| 48 | |||
| 49 | return 0; | ||
| 50 | } | ||
| 51 | EXPORT_SYMBOL(set_irq_chip); | ||
| 52 | |||
| 53 | /** | ||
| 54 | * set_irq_type - set the irq type for an irq | ||
| 55 | * @irq: irq number | ||
| 56 | * @type: interrupt type - see include/linux/interrupt.h | ||
| 57 | */ | ||
| 58 | int set_irq_type(unsigned int irq, unsigned int type) | ||
| 59 | { | ||
| 60 | struct irq_desc *desc; | ||
| 61 | unsigned long flags; | ||
| 62 | int ret = -ENXIO; | ||
| 63 | |||
| 64 | if (irq >= NR_IRQS) { | ||
| 65 | printk(KERN_ERR "Trying to set irq type for IRQ%d\n", irq); | ||
| 66 | return -ENODEV; | ||
| 67 | } | ||
| 68 | |||
| 69 | desc = irq_desc + irq; | ||
| 70 | if (desc->chip->set_type) { | ||
| 71 | spin_lock_irqsave(&desc->lock, flags); | ||
| 72 | ret = desc->chip->set_type(irq, type); | ||
| 73 | spin_unlock_irqrestore(&desc->lock, flags); | ||
| 74 | } | ||
| 75 | return ret; | ||
| 76 | } | ||
| 77 | EXPORT_SYMBOL(set_irq_type); | ||
| 78 | |||
| 79 | /** | ||
| 80 | * set_irq_data - set irq type data for an irq | ||
| 81 | * @irq: Interrupt number | ||
| 82 | * @data: Pointer to interrupt specific data | ||
| 83 | * | ||
| 84 | * Set the hardware irq controller data for an irq | ||
| 85 | */ | ||
| 86 | int set_irq_data(unsigned int irq, void *data) | ||
| 87 | { | ||
| 88 | struct irq_desc *desc; | ||
| 89 | unsigned long flags; | ||
| 90 | |||
| 91 | if (irq >= NR_IRQS) { | ||
| 92 | printk(KERN_ERR | ||
| 93 | "Trying to install controller data for IRQ%d\n", irq); | ||
| 94 | return -EINVAL; | ||
| 95 | } | ||
| 96 | |||
| 97 | desc = irq_desc + irq; | ||
| 98 | spin_lock_irqsave(&desc->lock, flags); | ||
| 99 | desc->handler_data = data; | ||
| 100 | spin_unlock_irqrestore(&desc->lock, flags); | ||
| 101 | return 0; | ||
| 102 | } | ||
| 103 | EXPORT_SYMBOL(set_irq_data); | ||
| 104 | |||
| 105 | /** | ||
| 106 | * set_irq_chip_data - set irq chip data for an irq | ||
| 107 | * @irq: Interrupt number | ||
| 108 | * @data: Pointer to chip specific data | ||
| 109 | * | ||
| 110 | * Set the hardware irq chip data for an irq | ||
| 111 | */ | ||
| 112 | int set_irq_chip_data(unsigned int irq, void *data) | ||
| 113 | { | ||
| 114 | struct irq_desc *desc = irq_desc + irq; | ||
| 115 | unsigned long flags; | ||
| 116 | |||
| 117 | if (irq >= NR_IRQS || !desc->chip) { | ||
| 118 | printk(KERN_ERR "BUG: bad set_irq_chip_data(IRQ#%d)\n", irq); | ||
| 119 | return -EINVAL; | ||
| 120 | } | ||
| 121 | |||
| 122 | spin_lock_irqsave(&desc->lock, flags); | ||
| 123 | desc->chip_data = data; | ||
| 124 | spin_unlock_irqrestore(&desc->lock, flags); | ||
| 125 | |||
| 126 | return 0; | ||
| 127 | } | ||
| 128 | EXPORT_SYMBOL(set_irq_chip_data); | ||
| 129 | |||
| 130 | /* | ||
| 131 | * default enable function | ||
| 132 | */ | ||
| 133 | static void default_enable(unsigned int irq) | ||
| 134 | { | ||
| 135 | struct irq_desc *desc = irq_desc + irq; | ||
| 136 | |||
| 137 | desc->chip->unmask(irq); | ||
| 138 | desc->status &= ~IRQ_MASKED; | ||
| 139 | } | ||
| 140 | |||
| 141 | /* | ||
| 142 | * default disable function | ||
| 143 | */ | ||
| 144 | static void default_disable(unsigned int irq) | ||
| 145 | { | ||
| 146 | struct irq_desc *desc = irq_desc + irq; | ||
| 147 | |||
| 148 | if (!(desc->status & IRQ_DELAYED_DISABLE)) | ||
| 149 | irq_desc[irq].chip->mask(irq); | ||
| 150 | } | ||
| 151 | |||
| 152 | /* | ||
| 153 | * default startup function | ||
| 154 | */ | ||
| 155 | static unsigned int default_startup(unsigned int irq) | ||
| 156 | { | ||
| 157 | irq_desc[irq].chip->enable(irq); | ||
| 158 | |||
| 159 | return 0; | ||
| 160 | } | ||
| 161 | |||
| 162 | /* | ||
| 163 | * Fixup enable/disable function pointers | ||
| 164 | */ | ||
| 165 | void irq_chip_set_defaults(struct irq_chip *chip) | ||
| 166 | { | ||
| 167 | if (!chip->enable) | ||
| 168 | chip->enable = default_enable; | ||
| 169 | if (!chip->disable) | ||
| 170 | chip->disable = default_disable; | ||
| 171 | if (!chip->startup) | ||
| 172 | chip->startup = default_startup; | ||
| 173 | if (!chip->shutdown) | ||
| 174 | chip->shutdown = chip->disable; | ||
| 175 | if (!chip->name) | ||
| 176 | chip->name = chip->typename; | ||
| 177 | } | ||
| 178 | |||
| 179 | static inline void mask_ack_irq(struct irq_desc *desc, int irq) | ||
| 180 | { | ||
| 181 | if (desc->chip->mask_ack) | ||
| 182 | desc->chip->mask_ack(irq); | ||
| 183 | else { | ||
| 184 | desc->chip->mask(irq); | ||
| 185 | desc->chip->ack(irq); | ||
| 186 | } | ||
| 187 | } | ||
| 188 | |||
| 189 | /** | ||
| 190 | * handle_simple_irq - Simple and software-decoded IRQs. | ||
| 191 | * @irq: the interrupt number | ||
| 192 | * @desc: the interrupt description structure for this irq | ||
| 193 | * @regs: pointer to a register structure | ||
| 194 | * | ||
| 195 | * Simple interrupts are either sent from a demultiplexing interrupt | ||
| 196 | * handler or come from hardware, where no interrupt hardware control | ||
| 197 | * is necessary. | ||
| 198 | * | ||
| 199 | * Note: The caller is expected to handle the ack, clear, mask and | ||
| 200 | * unmask issues if necessary. | ||
| 201 | */ | ||
| 202 | void fastcall | ||
| 203 | handle_simple_irq(unsigned int irq, struct irq_desc *desc, struct pt_regs *regs) | ||
| 204 | { | ||
| 205 | struct irqaction *action; | ||
| 206 | irqreturn_t action_ret; | ||
| 207 | const unsigned int cpu = smp_processor_id(); | ||
| 208 | |||
| 209 | spin_lock(&desc->lock); | ||
| 210 | |||
| 211 | if (unlikely(desc->status & IRQ_INPROGRESS)) | ||
| 212 | goto out_unlock; | ||
| 213 | desc->status &= ~(IRQ_REPLAY | IRQ_WAITING); | ||
| 214 | kstat_cpu(cpu).irqs[irq]++; | ||
| 215 | |||
| 216 | action = desc->action; | ||
| 217 | if (unlikely(!action || (desc->status & IRQ_DISABLED))) | ||
| 218 | goto out_unlock; | ||
| 219 | |||
| 220 | desc->status |= IRQ_INPROGRESS; | ||
| 221 | spin_unlock(&desc->lock); | ||
| 222 | |||
| 223 | action_ret = handle_IRQ_event(irq, regs, action); | ||
| 224 | if (!noirqdebug) | ||
| 225 | note_interrupt(irq, desc, action_ret, regs); | ||
| 226 | |||
| 227 | spin_lock(&desc->lock); | ||
| 228 | desc->status &= ~IRQ_INPROGRESS; | ||
| 229 | out_unlock: | ||
| 230 | spin_unlock(&desc->lock); | ||
| 231 | } | ||
| 232 | |||
| 233 | /** | ||
| 234 | * handle_level_irq - Level type irq handler | ||
| 235 | * @irq: the interrupt number | ||
| 236 | * @desc: the interrupt description structure for this irq | ||
| 237 | * @regs: pointer to a register structure | ||
| 238 | * | ||
| 239 | * Level type interrupts are active as long as the hardware line has | ||
| 240 | * the active level. This may require to mask the interrupt and unmask | ||
| 241 | * it after the associated handler has acknowledged the device, so the | ||
| 242 | * interrupt line is back to inactive. | ||
| 243 | */ | ||
| 244 | void fastcall | ||
| 245 | handle_level_irq(unsigned int irq, struct irq_desc *desc, struct pt_regs *regs) | ||
| 246 | { | ||
| 247 | unsigned int cpu = smp_processor_id(); | ||
| 248 | struct irqaction *action; | ||
| 249 | irqreturn_t action_ret; | ||
| 250 | |||
| 251 | spin_lock(&desc->lock); | ||
| 252 | mask_ack_irq(desc, irq); | ||
| 253 | |||
| 254 | if (unlikely(desc->status & IRQ_INPROGRESS)) | ||
| 255 | goto out; | ||
| 256 | desc->status &= ~(IRQ_REPLAY | IRQ_WAITING); | ||
| 257 | kstat_cpu(cpu).irqs[irq]++; | ||
| 258 | |||
| 259 | /* | ||
| 260 | * If its disabled or no action available | ||
| 261 | * keep it masked and get out of here | ||
| 262 | */ | ||
| 263 | action = desc->action; | ||
| 264 | if (unlikely(!action || (desc->status & IRQ_DISABLED))) | ||
| 265 | goto out; | ||
| 266 | |||
| 267 | desc->status |= IRQ_INPROGRESS; | ||
| 268 | spin_unlock(&desc->lock); | ||
| 269 | |||
| 270 | action_ret = handle_IRQ_event(irq, regs, action); | ||
| 271 | if (!noirqdebug) | ||
| 272 | note_interrupt(irq, desc, action_ret, regs); | ||
| 273 | |||
| 274 | spin_lock(&desc->lock); | ||
| 275 | desc->status &= ~IRQ_INPROGRESS; | ||
| 276 | out: | ||
| 277 | if (!(desc->status & IRQ_DISABLED) && desc->chip->unmask) | ||
| 278 | desc->chip->unmask(irq); | ||
| 279 | spin_unlock(&desc->lock); | ||
| 280 | } | ||
| 281 | |||
| 282 | /** | ||
| 283 | * handle_fasteoi_irq - irq handler for transparent controllers | ||
| 284 | * @irq: the interrupt number | ||
| 285 | * @desc: the interrupt description structure for this irq | ||
| 286 | * @regs: pointer to a register structure | ||
| 287 | * | ||
| 288 | * Only a single callback will be issued to the chip: an ->eoi() | ||
| 289 | * call when the interrupt has been serviced. This enables support | ||
| 290 | * for modern forms of interrupt handlers, which handle the flow | ||
| 291 | * details in hardware, transparently. | ||
| 292 | */ | ||
| 293 | void fastcall | ||
| 294 | handle_fasteoi_irq(unsigned int irq, struct irq_desc *desc, | ||
| 295 | struct pt_regs *regs) | ||
| 296 | { | ||
| 297 | unsigned int cpu = smp_processor_id(); | ||
| 298 | struct irqaction *action; | ||
| 299 | irqreturn_t action_ret; | ||
| 300 | |||
| 301 | spin_lock(&desc->lock); | ||
| 302 | |||
| 303 | if (unlikely(desc->status & IRQ_INPROGRESS)) | ||
| 304 | goto out; | ||
| 305 | |||
| 306 | desc->status &= ~(IRQ_REPLAY | IRQ_WAITING); | ||
| 307 | kstat_cpu(cpu).irqs[irq]++; | ||
| 308 | |||
| 309 | /* | ||
| 310 | * If its disabled or no action available | ||
| 311 | * keep it masked and get out of here | ||
| 312 | */ | ||
| 313 | action = desc->action; | ||
| 314 | if (unlikely(!action || (desc->status & IRQ_DISABLED))) { | ||
| 315 | desc->status |= IRQ_PENDING; | ||
| 316 | goto out; | ||
| 317 | } | ||
| 318 | |||
| 319 | desc->status |= IRQ_INPROGRESS; | ||
| 320 | desc->status &= ~IRQ_PENDING; | ||
| 321 | spin_unlock(&desc->lock); | ||
| 322 | |||
| 323 | action_ret = handle_IRQ_event(irq, regs, action); | ||
| 324 | if (!noirqdebug) | ||
| 325 | note_interrupt(irq, desc, action_ret, regs); | ||
| 326 | |||
| 327 | spin_lock(&desc->lock); | ||
| 328 | desc->status &= ~IRQ_INPROGRESS; | ||
| 329 | out: | ||
| 330 | desc->chip->eoi(irq); | ||
| 331 | |||
| 332 | spin_unlock(&desc->lock); | ||
| 333 | } | ||
| 334 | |||
| 335 | /** | ||
| 336 | * handle_edge_irq - edge type IRQ handler | ||
| 337 | * @irq: the interrupt number | ||
| 338 | * @desc: the interrupt description structure for this irq | ||
| 339 | * @regs: pointer to a register structure | ||
| 340 | * | ||
| 341 | * Interrupt occures on the falling and/or rising edge of a hardware | ||
| 342 | * signal. The occurence is latched into the irq controller hardware | ||
| 343 | * and must be acked in order to be reenabled. After the ack another | ||
| 344 | * interrupt can happen on the same source even before the first one | ||
| 345 | * is handled by the assosiacted event handler. If this happens it | ||
| 346 | * might be necessary to disable (mask) the interrupt depending on the | ||
| 347 | * controller hardware. This requires to reenable the interrupt inside | ||
| 348 | * of the loop which handles the interrupts which have arrived while | ||
| 349 | * the handler was running. If all pending interrupts are handled, the | ||
| 350 | * loop is left. | ||
| 351 | */ | ||
| 352 | void fastcall | ||
| 353 | handle_edge_irq(unsigned int irq, struct irq_desc *desc, struct pt_regs *regs) | ||
| 354 | { | ||
| 355 | const unsigned int cpu = smp_processor_id(); | ||
| 356 | |||
| 357 | spin_lock(&desc->lock); | ||
| 358 | |||
| 359 | desc->status &= ~(IRQ_REPLAY | IRQ_WAITING); | ||
| 360 | |||
| 361 | /* | ||
| 362 | * If we're currently running this IRQ, or its disabled, | ||
| 363 | * we shouldn't process the IRQ. Mark it pending, handle | ||
| 364 | * the necessary masking and go out | ||
| 365 | */ | ||
| 366 | if (unlikely((desc->status & (IRQ_INPROGRESS | IRQ_DISABLED)) || | ||
| 367 | !desc->action)) { | ||
| 368 | desc->status |= (IRQ_PENDING | IRQ_MASKED); | ||
| 369 | mask_ack_irq(desc, irq); | ||
| 370 | goto out_unlock; | ||
| 371 | } | ||
| 372 | |||
| 373 | kstat_cpu(cpu).irqs[irq]++; | ||
| 374 | |||
| 375 | /* Start handling the irq */ | ||
| 376 | desc->chip->ack(irq); | ||
| 377 | |||
| 378 | /* Mark the IRQ currently in progress.*/ | ||
| 379 | desc->status |= IRQ_INPROGRESS; | ||
| 380 | |||
| 381 | do { | ||
| 382 | struct irqaction *action = desc->action; | ||
| 383 | irqreturn_t action_ret; | ||
| 384 | |||
| 385 | if (unlikely(!action)) { | ||
| 386 | desc->chip->mask(irq); | ||
| 387 | goto out_unlock; | ||
| 388 | } | ||
| 389 | |||
| 390 | /* | ||
| 391 | * When another irq arrived while we were handling | ||
| 392 | * one, we could have masked the irq. | ||
| 393 | * Renable it, if it was not disabled in meantime. | ||
| 394 | */ | ||
| 395 | if (unlikely((desc->status & | ||
| 396 | (IRQ_PENDING | IRQ_MASKED | IRQ_DISABLED)) == | ||
| 397 | (IRQ_PENDING | IRQ_MASKED))) { | ||
| 398 | desc->chip->unmask(irq); | ||
| 399 | desc->status &= ~IRQ_MASKED; | ||
| 400 | } | ||
| 401 | |||
| 402 | desc->status &= ~IRQ_PENDING; | ||
| 403 | spin_unlock(&desc->lock); | ||
| 404 | action_ret = handle_IRQ_event(irq, regs, action); | ||
| 405 | if (!noirqdebug) | ||
| 406 | note_interrupt(irq, desc, action_ret, regs); | ||
| 407 | spin_lock(&desc->lock); | ||
| 408 | |||
| 409 | } while ((desc->status & (IRQ_PENDING | IRQ_DISABLED)) == IRQ_PENDING); | ||
| 410 | |||
| 411 | desc->status &= ~IRQ_INPROGRESS; | ||
| 412 | out_unlock: | ||
| 413 | spin_unlock(&desc->lock); | ||
| 414 | } | ||
| 415 | |||
| 416 | #ifdef CONFIG_SMP | ||
| 417 | /** | ||
| 418 | * handle_percpu_IRQ - Per CPU local irq handler | ||
| 419 | * @irq: the interrupt number | ||
| 420 | * @desc: the interrupt description structure for this irq | ||
| 421 | * @regs: pointer to a register structure | ||
| 422 | * | ||
| 423 | * Per CPU interrupts on SMP machines without locking requirements | ||
| 424 | */ | ||
| 425 | void fastcall | ||
| 426 | handle_percpu_irq(unsigned int irq, struct irq_desc *desc, struct pt_regs *regs) | ||
| 427 | { | ||
| 428 | irqreturn_t action_ret; | ||
| 429 | |||
| 430 | kstat_this_cpu.irqs[irq]++; | ||
| 431 | |||
| 432 | if (desc->chip->ack) | ||
| 433 | desc->chip->ack(irq); | ||
| 434 | |||
| 435 | action_ret = handle_IRQ_event(irq, regs, desc->action); | ||
| 436 | if (!noirqdebug) | ||
| 437 | note_interrupt(irq, desc, action_ret, regs); | ||
| 438 | |||
| 439 | if (desc->chip->eoi) | ||
| 440 | desc->chip->eoi(irq); | ||
| 441 | } | ||
| 442 | |||
| 443 | #endif /* CONFIG_SMP */ | ||
| 444 | |||
| 445 | void | ||
| 446 | __set_irq_handler(unsigned int irq, | ||
| 447 | void fastcall (*handle)(unsigned int, irq_desc_t *, | ||
| 448 | struct pt_regs *), | ||
| 449 | int is_chained) | ||
| 450 | { | ||
| 451 | struct irq_desc *desc; | ||
| 452 | unsigned long flags; | ||
| 453 | |||
| 454 | if (irq >= NR_IRQS) { | ||
| 455 | printk(KERN_ERR | ||
| 456 | "Trying to install type control for IRQ%d\n", irq); | ||
| 457 | return; | ||
| 458 | } | ||
| 459 | |||
| 460 | desc = irq_desc + irq; | ||
| 461 | |||
| 462 | if (!handle) | ||
| 463 | handle = handle_bad_irq; | ||
| 464 | |||
| 465 | if (is_chained && desc->chip == &no_irq_chip) | ||
| 466 | printk(KERN_WARNING "Trying to install " | ||
| 467 | "chained interrupt type for IRQ%d\n", irq); | ||
| 468 | |||
| 469 | spin_lock_irqsave(&desc->lock, flags); | ||
| 470 | |||
| 471 | /* Uninstall? */ | ||
| 472 | if (handle == handle_bad_irq) { | ||
| 473 | if (desc->chip != &no_irq_chip) { | ||
| 474 | desc->chip->mask(irq); | ||
| 475 | desc->chip->ack(irq); | ||
| 476 | } | ||
| 477 | desc->status |= IRQ_DISABLED; | ||
| 478 | desc->depth = 1; | ||
| 479 | } | ||
| 480 | desc->handle_irq = handle; | ||
| 481 | |||
| 482 | if (handle != handle_bad_irq && is_chained) { | ||
| 483 | desc->status &= ~IRQ_DISABLED; | ||
| 484 | desc->status |= IRQ_NOREQUEST | IRQ_NOPROBE; | ||
| 485 | desc->depth = 0; | ||
| 486 | desc->chip->unmask(irq); | ||
| 487 | } | ||
| 488 | spin_unlock_irqrestore(&desc->lock, flags); | ||
| 489 | } | ||
| 490 | |||
| 491 | void | ||
| 492 | set_irq_chip_and_handler(unsigned int irq, struct irq_chip *chip, | ||
| 493 | void fastcall (*handle)(unsigned int, | ||
| 494 | struct irq_desc *, | ||
| 495 | struct pt_regs *)) | ||
| 496 | { | ||
| 497 | set_irq_chip(irq, chip); | ||
| 498 | __set_irq_handler(irq, handle, 0); | ||
| 499 | } | ||
| 500 | |||
| 501 | /* | ||
| 502 | * Get a descriptive string for the highlevel handler, for | ||
| 503 | * /proc/interrupts output: | ||
| 504 | */ | ||
| 505 | const char * | ||
| 506 | handle_irq_name(void fastcall (*handle)(unsigned int, struct irq_desc *, | ||
| 507 | struct pt_regs *)) | ||
| 508 | { | ||
| 509 | if (handle == handle_level_irq) | ||
| 510 | return "level "; | ||
| 511 | if (handle == handle_fasteoi_irq) | ||
| 512 | return "fasteoi"; | ||
| 513 | if (handle == handle_edge_irq) | ||
| 514 | return "edge "; | ||
| 515 | if (handle == handle_simple_irq) | ||
| 516 | return "simple "; | ||
| 517 | #ifdef CONFIG_SMP | ||
| 518 | if (handle == handle_percpu_irq) | ||
| 519 | return "percpu "; | ||
| 520 | #endif | ||
| 521 | if (handle == handle_bad_irq) | ||
| 522 | return "bad "; | ||
| 523 | |||
| 524 | return NULL; | ||
| 525 | } | ||
diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c index 0f6530117105..6070e0464690 100644 --- a/kernel/irq/handle.c +++ b/kernel/irq/handle.c | |||
| @@ -1,9 +1,13 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * linux/kernel/irq/handle.c | 2 | * linux/kernel/irq/handle.c |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 1992, 1998-2004 Linus Torvalds, Ingo Molnar | 4 | * Copyright (C) 1992, 1998-2006 Linus Torvalds, Ingo Molnar |
| 5 | * Copyright (C) 2005-2006, Thomas Gleixner, Russell King | ||
| 5 | * | 6 | * |
| 6 | * This file contains the core interrupt handling code. | 7 | * This file contains the core interrupt handling code. |
| 8 | * | ||
| 9 | * Detailed information is available in Documentation/DocBook/genericirq | ||
| 10 | * | ||
| 7 | */ | 11 | */ |
| 8 | 12 | ||
| 9 | #include <linux/irq.h> | 13 | #include <linux/irq.h> |
| @@ -14,11 +18,22 @@ | |||
| 14 | 18 | ||
| 15 | #include "internals.h" | 19 | #include "internals.h" |
| 16 | 20 | ||
| 21 | /** | ||
| 22 | * handle_bad_irq - handle spurious and unhandled irqs | ||
| 23 | */ | ||
| 24 | void fastcall | ||
| 25 | handle_bad_irq(unsigned int irq, struct irq_desc *desc, struct pt_regs *regs) | ||
| 26 | { | ||
| 27 | print_irq_desc(irq, desc); | ||
| 28 | kstat_this_cpu.irqs[irq]++; | ||
| 29 | ack_bad_irq(irq); | ||
| 30 | } | ||
| 31 | |||
| 17 | /* | 32 | /* |
| 18 | * Linux has a controller-independent interrupt architecture. | 33 | * Linux has a controller-independent interrupt architecture. |
| 19 | * Every controller has a 'controller-template', that is used | 34 | * Every controller has a 'controller-template', that is used |
| 20 | * by the main code to do the right thing. Each driver-visible | 35 | * by the main code to do the right thing. Each driver-visible |
| 21 | * interrupt source is transparently wired to the apropriate | 36 | * interrupt source is transparently wired to the appropriate |
| 22 | * controller. Thus drivers need not be aware of the | 37 | * controller. Thus drivers need not be aware of the |
| 23 | * interrupt-controller. | 38 | * interrupt-controller. |
| 24 | * | 39 | * |
| @@ -28,41 +43,52 @@ | |||
| 28 | * | 43 | * |
| 29 | * Controller mappings for all interrupt sources: | 44 | * Controller mappings for all interrupt sources: |
| 30 | */ | 45 | */ |
| 31 | irq_desc_t irq_desc[NR_IRQS] __cacheline_aligned = { | 46 | struct irq_desc irq_desc[NR_IRQS] __cacheline_aligned = { |
| 32 | [0 ... NR_IRQS-1] = { | 47 | [0 ... NR_IRQS-1] = { |
| 33 | .status = IRQ_DISABLED, | 48 | .status = IRQ_DISABLED, |
| 34 | .handler = &no_irq_type, | 49 | .chip = &no_irq_chip, |
| 35 | .lock = SPIN_LOCK_UNLOCKED | 50 | .handle_irq = handle_bad_irq, |
| 51 | .depth = 1, | ||
| 52 | .lock = SPIN_LOCK_UNLOCKED, | ||
| 53 | #ifdef CONFIG_SMP | ||
| 54 | .affinity = CPU_MASK_ALL | ||
| 55 | #endif | ||
| 36 | } | 56 | } |
| 37 | }; | 57 | }; |
| 38 | 58 | ||
| 39 | /* | 59 | /* |
| 40 | * Generic 'no controller' code | 60 | * What should we do if we get a hw irq event on an illegal vector? |
| 61 | * Each architecture has to answer this themself. | ||
| 41 | */ | 62 | */ |
| 42 | static void end_none(unsigned int irq) { } | 63 | static void ack_bad(unsigned int irq) |
| 43 | static void enable_none(unsigned int irq) { } | ||
| 44 | static void disable_none(unsigned int irq) { } | ||
| 45 | static void shutdown_none(unsigned int irq) { } | ||
| 46 | static unsigned int startup_none(unsigned int irq) { return 0; } | ||
| 47 | |||
| 48 | static void ack_none(unsigned int irq) | ||
| 49 | { | 64 | { |
| 50 | /* | 65 | print_irq_desc(irq, irq_desc + irq); |
| 51 | * 'what should we do if we get a hw irq event on an illegal vector'. | ||
| 52 | * each architecture has to answer this themself. | ||
| 53 | */ | ||
| 54 | ack_bad_irq(irq); | 66 | ack_bad_irq(irq); |
| 55 | } | 67 | } |
| 56 | 68 | ||
| 57 | struct hw_interrupt_type no_irq_type = { | 69 | /* |
| 58 | .typename = "none", | 70 | * NOP functions |
| 59 | .startup = startup_none, | 71 | */ |
| 60 | .shutdown = shutdown_none, | 72 | static void noop(unsigned int irq) |
| 61 | .enable = enable_none, | 73 | { |
| 62 | .disable = disable_none, | 74 | } |
| 63 | .ack = ack_none, | 75 | |
| 64 | .end = end_none, | 76 | static unsigned int noop_ret(unsigned int irq) |
| 65 | .set_affinity = NULL | 77 | { |
| 78 | return 0; | ||
| 79 | } | ||
| 80 | |||
| 81 | /* | ||
| 82 | * Generic no controller implementation | ||
| 83 | */ | ||
| 84 | struct irq_chip no_irq_chip = { | ||
| 85 | .name = "none", | ||
| 86 | .startup = noop_ret, | ||
| 87 | .shutdown = noop, | ||
| 88 | .enable = noop, | ||
| 89 | .disable = noop, | ||
| 90 | .ack = ack_bad, | ||
| 91 | .end = noop, | ||
| 66 | }; | 92 | }; |
| 67 | 93 | ||
| 68 | /* | 94 | /* |
| @@ -73,16 +99,21 @@ irqreturn_t no_action(int cpl, void *dev_id, struct pt_regs *regs) | |||
| 73 | return IRQ_NONE; | 99 | return IRQ_NONE; |
| 74 | } | 100 | } |
| 75 | 101 | ||
| 76 | /* | 102 | /** |
| 77 | * Have got an event to handle: | 103 | * handle_IRQ_event - irq action chain handler |
| 104 | * @irq: the interrupt number | ||
| 105 | * @regs: pointer to a register structure | ||
| 106 | * @action: the interrupt action chain for this irq | ||
| 107 | * | ||
| 108 | * Handles the action chain of an irq event | ||
| 78 | */ | 109 | */ |
| 79 | fastcall irqreturn_t handle_IRQ_event(unsigned int irq, struct pt_regs *regs, | 110 | irqreturn_t handle_IRQ_event(unsigned int irq, struct pt_regs *regs, |
| 80 | struct irqaction *action) | 111 | struct irqaction *action) |
| 81 | { | 112 | { |
| 82 | irqreturn_t ret, retval = IRQ_NONE; | 113 | irqreturn_t ret, retval = IRQ_NONE; |
| 83 | unsigned int status = 0; | 114 | unsigned int status = 0; |
| 84 | 115 | ||
| 85 | if (!(action->flags & SA_INTERRUPT)) | 116 | if (!(action->flags & IRQF_DISABLED)) |
| 86 | local_irq_enable(); | 117 | local_irq_enable(); |
| 87 | 118 | ||
| 88 | do { | 119 | do { |
| @@ -93,22 +124,29 @@ fastcall irqreturn_t handle_IRQ_event(unsigned int irq, struct pt_regs *regs, | |||
| 93 | action = action->next; | 124 | action = action->next; |
| 94 | } while (action); | 125 | } while (action); |
| 95 | 126 | ||
| 96 | if (status & SA_SAMPLE_RANDOM) | 127 | if (status & IRQF_SAMPLE_RANDOM) |
| 97 | add_interrupt_randomness(irq); | 128 | add_interrupt_randomness(irq); |
| 98 | local_irq_disable(); | 129 | local_irq_disable(); |
| 99 | 130 | ||
| 100 | return retval; | 131 | return retval; |
| 101 | } | 132 | } |
| 102 | 133 | ||
| 103 | /* | 134 | /** |
| 104 | * do_IRQ handles all normal device IRQ's (the special | 135 | * __do_IRQ - original all in one highlevel IRQ handler |
| 136 | * @irq: the interrupt number | ||
| 137 | * @regs: pointer to a register structure | ||
| 138 | * | ||
| 139 | * __do_IRQ handles all normal device IRQ's (the special | ||
| 105 | * SMP cross-CPU interrupts have their own specific | 140 | * SMP cross-CPU interrupts have their own specific |
| 106 | * handlers). | 141 | * handlers). |
| 142 | * | ||
| 143 | * This is the original x86 implementation which is used for every | ||
| 144 | * interrupt type. | ||
| 107 | */ | 145 | */ |
| 108 | fastcall unsigned int __do_IRQ(unsigned int irq, struct pt_regs *regs) | 146 | fastcall unsigned int __do_IRQ(unsigned int irq, struct pt_regs *regs) |
| 109 | { | 147 | { |
| 110 | irq_desc_t *desc = irq_desc + irq; | 148 | struct irq_desc *desc = irq_desc + irq; |
| 111 | struct irqaction * action; | 149 | struct irqaction *action; |
| 112 | unsigned int status; | 150 | unsigned int status; |
| 113 | 151 | ||
| 114 | kstat_this_cpu.irqs[irq]++; | 152 | kstat_this_cpu.irqs[irq]++; |
| @@ -118,16 +156,16 @@ fastcall unsigned int __do_IRQ(unsigned int irq, struct pt_regs *regs) | |||
| 118 | /* | 156 | /* |
| 119 | * No locking required for CPU-local interrupts: | 157 | * No locking required for CPU-local interrupts: |
| 120 | */ | 158 | */ |
| 121 | if (desc->handler->ack) | 159 | if (desc->chip->ack) |
| 122 | desc->handler->ack(irq); | 160 | desc->chip->ack(irq); |
| 123 | action_ret = handle_IRQ_event(irq, regs, desc->action); | 161 | action_ret = handle_IRQ_event(irq, regs, desc->action); |
| 124 | desc->handler->end(irq); | 162 | desc->chip->end(irq); |
| 125 | return 1; | 163 | return 1; |
| 126 | } | 164 | } |
| 127 | 165 | ||
| 128 | spin_lock(&desc->lock); | 166 | spin_lock(&desc->lock); |
| 129 | if (desc->handler->ack) | 167 | if (desc->chip->ack) |
| 130 | desc->handler->ack(irq); | 168 | desc->chip->ack(irq); |
| 131 | /* | 169 | /* |
| 132 | * REPLAY is when Linux resends an IRQ that was dropped earlier | 170 | * REPLAY is when Linux resends an IRQ that was dropped earlier |
| 133 | * WAITING is used by probe to mark irqs that are being tested | 171 | * WAITING is used by probe to mark irqs that are being tested |
| @@ -187,7 +225,7 @@ out: | |||
| 187 | * The ->end() handler has to deal with interrupts which got | 225 | * The ->end() handler has to deal with interrupts which got |
| 188 | * disabled while the handler was running. | 226 | * disabled while the handler was running. |
| 189 | */ | 227 | */ |
| 190 | desc->handler->end(irq); | 228 | desc->chip->end(irq); |
| 191 | spin_unlock(&desc->lock); | 229 | spin_unlock(&desc->lock); |
| 192 | 230 | ||
| 193 | return 1; | 231 | return 1; |
diff --git a/kernel/irq/internals.h b/kernel/irq/internals.h index 46feba630266..08a849a22447 100644 --- a/kernel/irq/internals.h +++ b/kernel/irq/internals.h | |||
| @@ -4,6 +4,12 @@ | |||
| 4 | 4 | ||
| 5 | extern int noirqdebug; | 5 | extern int noirqdebug; |
| 6 | 6 | ||
| 7 | /* Set default functions for irq_chip structures: */ | ||
| 8 | extern void irq_chip_set_defaults(struct irq_chip *chip); | ||
| 9 | |||
| 10 | /* Set default handler: */ | ||
| 11 | extern void compat_irq_chip_set_default_handler(struct irq_desc *desc); | ||
| 12 | |||
| 7 | #ifdef CONFIG_PROC_FS | 13 | #ifdef CONFIG_PROC_FS |
| 8 | extern void register_irq_proc(unsigned int irq); | 14 | extern void register_irq_proc(unsigned int irq); |
| 9 | extern void register_handler_proc(unsigned int irq, struct irqaction *action); | 15 | extern void register_handler_proc(unsigned int irq, struct irqaction *action); |
| @@ -16,3 +22,43 @@ static inline void unregister_handler_proc(unsigned int irq, | |||
| 16 | struct irqaction *action) { } | 22 | struct irqaction *action) { } |
| 17 | #endif | 23 | #endif |
| 18 | 24 | ||
| 25 | /* | ||
| 26 | * Debugging printout: | ||
| 27 | */ | ||
| 28 | |||
| 29 | #include <linux/kallsyms.h> | ||
| 30 | |||
| 31 | #define P(f) if (desc->status & f) printk("%14s set\n", #f) | ||
| 32 | |||
| 33 | static inline void print_irq_desc(unsigned int irq, struct irq_desc *desc) | ||
| 34 | { | ||
| 35 | printk("irq %d, desc: %p, depth: %d, count: %d, unhandled: %d\n", | ||
| 36 | irq, desc, desc->depth, desc->irq_count, desc->irqs_unhandled); | ||
| 37 | printk("->handle_irq(): %p, ", desc->handle_irq); | ||
| 38 | print_symbol("%s\n", (unsigned long)desc->handle_irq); | ||
| 39 | printk("->chip(): %p, ", desc->chip); | ||
| 40 | print_symbol("%s\n", (unsigned long)desc->chip); | ||
| 41 | printk("->action(): %p\n", desc->action); | ||
| 42 | if (desc->action) { | ||
| 43 | printk("->action->handler(): %p, ", desc->action->handler); | ||
| 44 | print_symbol("%s\n", (unsigned long)desc->action->handler); | ||
| 45 | } | ||
| 46 | |||
| 47 | P(IRQ_INPROGRESS); | ||
| 48 | P(IRQ_DISABLED); | ||
| 49 | P(IRQ_PENDING); | ||
| 50 | P(IRQ_REPLAY); | ||
| 51 | P(IRQ_AUTODETECT); | ||
| 52 | P(IRQ_WAITING); | ||
| 53 | P(IRQ_LEVEL); | ||
| 54 | P(IRQ_MASKED); | ||
| 55 | #ifdef CONFIG_IRQ_PER_CPU | ||
| 56 | P(IRQ_PER_CPU); | ||
| 57 | #endif | ||
| 58 | P(IRQ_NOPROBE); | ||
| 59 | P(IRQ_NOREQUEST); | ||
| 60 | P(IRQ_NOAUTOEN); | ||
| 61 | } | ||
| 62 | |||
| 63 | #undef P | ||
| 64 | |||
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c index 1279e3499534..fede5fa351df 100644 --- a/kernel/irq/manage.c +++ b/kernel/irq/manage.c | |||
| @@ -1,12 +1,12 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * linux/kernel/irq/manage.c | 2 | * linux/kernel/irq/manage.c |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 1992, 1998-2004 Linus Torvalds, Ingo Molnar | 4 | * Copyright (C) 1992, 1998-2006 Linus Torvalds, Ingo Molnar |
| 5 | * Copyright (C) 2005-2006 Thomas Gleixner | ||
| 5 | * | 6 | * |
| 6 | * This file contains driver APIs to the irq subsystem. | 7 | * This file contains driver APIs to the irq subsystem. |
| 7 | */ | 8 | */ |
| 8 | 9 | ||
| 9 | #include <linux/config.h> | ||
| 10 | #include <linux/irq.h> | 10 | #include <linux/irq.h> |
| 11 | #include <linux/module.h> | 11 | #include <linux/module.h> |
| 12 | #include <linux/random.h> | 12 | #include <linux/random.h> |
| @@ -16,12 +16,6 @@ | |||
| 16 | 16 | ||
| 17 | #ifdef CONFIG_SMP | 17 | #ifdef CONFIG_SMP |
| 18 | 18 | ||
| 19 | cpumask_t irq_affinity[NR_IRQS] = { [0 ... NR_IRQS-1] = CPU_MASK_ALL }; | ||
| 20 | |||
| 21 | #if defined (CONFIG_GENERIC_PENDING_IRQ) || defined (CONFIG_IRQBALANCE) | ||
| 22 | cpumask_t __cacheline_aligned pending_irq_cpumask[NR_IRQS]; | ||
| 23 | #endif | ||
| 24 | |||
| 25 | /** | 19 | /** |
| 26 | * synchronize_irq - wait for pending IRQ handlers (on other CPUs) | 20 | * synchronize_irq - wait for pending IRQ handlers (on other CPUs) |
| 27 | * @irq: interrupt number to wait for | 21 | * @irq: interrupt number to wait for |
| @@ -42,7 +36,6 @@ void synchronize_irq(unsigned int irq) | |||
| 42 | while (desc->status & IRQ_INPROGRESS) | 36 | while (desc->status & IRQ_INPROGRESS) |
| 43 | cpu_relax(); | 37 | cpu_relax(); |
| 44 | } | 38 | } |
| 45 | |||
| 46 | EXPORT_SYMBOL(synchronize_irq); | 39 | EXPORT_SYMBOL(synchronize_irq); |
| 47 | 40 | ||
| 48 | #endif | 41 | #endif |
| @@ -60,7 +53,7 @@ EXPORT_SYMBOL(synchronize_irq); | |||
| 60 | */ | 53 | */ |
| 61 | void disable_irq_nosync(unsigned int irq) | 54 | void disable_irq_nosync(unsigned int irq) |
| 62 | { | 55 | { |
| 63 | irq_desc_t *desc = irq_desc + irq; | 56 | struct irq_desc *desc = irq_desc + irq; |
| 64 | unsigned long flags; | 57 | unsigned long flags; |
| 65 | 58 | ||
| 66 | if (irq >= NR_IRQS) | 59 | if (irq >= NR_IRQS) |
| @@ -69,11 +62,10 @@ void disable_irq_nosync(unsigned int irq) | |||
| 69 | spin_lock_irqsave(&desc->lock, flags); | 62 | spin_lock_irqsave(&desc->lock, flags); |
| 70 | if (!desc->depth++) { | 63 | if (!desc->depth++) { |
| 71 | desc->status |= IRQ_DISABLED; | 64 | desc->status |= IRQ_DISABLED; |
| 72 | desc->handler->disable(irq); | 65 | desc->chip->disable(irq); |
| 73 | } | 66 | } |
| 74 | spin_unlock_irqrestore(&desc->lock, flags); | 67 | spin_unlock_irqrestore(&desc->lock, flags); |
| 75 | } | 68 | } |
| 76 | |||
| 77 | EXPORT_SYMBOL(disable_irq_nosync); | 69 | EXPORT_SYMBOL(disable_irq_nosync); |
| 78 | 70 | ||
| 79 | /** | 71 | /** |
| @@ -90,7 +82,7 @@ EXPORT_SYMBOL(disable_irq_nosync); | |||
| 90 | */ | 82 | */ |
| 91 | void disable_irq(unsigned int irq) | 83 | void disable_irq(unsigned int irq) |
| 92 | { | 84 | { |
| 93 | irq_desc_t *desc = irq_desc + irq; | 85 | struct irq_desc *desc = irq_desc + irq; |
| 94 | 86 | ||
| 95 | if (irq >= NR_IRQS) | 87 | if (irq >= NR_IRQS) |
| 96 | return; | 88 | return; |
| @@ -99,7 +91,6 @@ void disable_irq(unsigned int irq) | |||
| 99 | if (desc->action) | 91 | if (desc->action) |
| 100 | synchronize_irq(irq); | 92 | synchronize_irq(irq); |
| 101 | } | 93 | } |
| 102 | |||
| 103 | EXPORT_SYMBOL(disable_irq); | 94 | EXPORT_SYMBOL(disable_irq); |
| 104 | 95 | ||
| 105 | /** | 96 | /** |
| @@ -114,7 +105,7 @@ EXPORT_SYMBOL(disable_irq); | |||
| 114 | */ | 105 | */ |
| 115 | void enable_irq(unsigned int irq) | 106 | void enable_irq(unsigned int irq) |
| 116 | { | 107 | { |
| 117 | irq_desc_t *desc = irq_desc + irq; | 108 | struct irq_desc *desc = irq_desc + irq; |
| 118 | unsigned long flags; | 109 | unsigned long flags; |
| 119 | 110 | ||
| 120 | if (irq >= NR_IRQS) | 111 | if (irq >= NR_IRQS) |
| @@ -123,17 +114,15 @@ void enable_irq(unsigned int irq) | |||
| 123 | spin_lock_irqsave(&desc->lock, flags); | 114 | spin_lock_irqsave(&desc->lock, flags); |
| 124 | switch (desc->depth) { | 115 | switch (desc->depth) { |
| 125 | case 0: | 116 | case 0: |
| 117 | printk(KERN_WARNING "Unbalanced enable for IRQ %d\n", irq); | ||
| 126 | WARN_ON(1); | 118 | WARN_ON(1); |
| 127 | break; | 119 | break; |
| 128 | case 1: { | 120 | case 1: { |
| 129 | unsigned int status = desc->status & ~IRQ_DISABLED; | 121 | unsigned int status = desc->status & ~IRQ_DISABLED; |
| 130 | 122 | ||
| 131 | desc->status = status; | 123 | /* Prevent probing on this irq: */ |
| 132 | if ((status & (IRQ_PENDING | IRQ_REPLAY)) == IRQ_PENDING) { | 124 | desc->status = status | IRQ_NOPROBE; |
| 133 | desc->status = status | IRQ_REPLAY; | 125 | check_irq_resend(desc, irq); |
| 134 | hw_resend_irq(desc->handler,irq); | ||
| 135 | } | ||
| 136 | desc->handler->enable(irq); | ||
| 137 | /* fall-through */ | 126 | /* fall-through */ |
| 138 | } | 127 | } |
| 139 | default: | 128 | default: |
| @@ -141,9 +130,29 @@ void enable_irq(unsigned int irq) | |||
| 141 | } | 130 | } |
| 142 | spin_unlock_irqrestore(&desc->lock, flags); | 131 | spin_unlock_irqrestore(&desc->lock, flags); |
| 143 | } | 132 | } |
| 144 | |||
| 145 | EXPORT_SYMBOL(enable_irq); | 133 | EXPORT_SYMBOL(enable_irq); |
| 146 | 134 | ||
| 135 | /** | ||
| 136 | * set_irq_wake - control irq power management wakeup | ||
| 137 | * @irq: interrupt to control | ||
| 138 | * @on: enable/disable power management wakeup | ||
| 139 | * | ||
| 140 | * Enable/disable power management wakeup mode | ||
| 141 | */ | ||
| 142 | int set_irq_wake(unsigned int irq, unsigned int on) | ||
| 143 | { | ||
| 144 | struct irq_desc *desc = irq_desc + irq; | ||
| 145 | unsigned long flags; | ||
| 146 | int ret = -ENXIO; | ||
| 147 | |||
| 148 | spin_lock_irqsave(&desc->lock, flags); | ||
| 149 | if (desc->chip->set_wake) | ||
| 150 | ret = desc->chip->set_wake(irq, on); | ||
| 151 | spin_unlock_irqrestore(&desc->lock, flags); | ||
| 152 | return ret; | ||
| 153 | } | ||
| 154 | EXPORT_SYMBOL(set_irq_wake); | ||
| 155 | |||
| 147 | /* | 156 | /* |
| 148 | * Internal function that tells the architecture code whether a | 157 | * Internal function that tells the architecture code whether a |
| 149 | * particular irq has been exclusively allocated or is available | 158 | * particular irq has been exclusively allocated or is available |
| @@ -153,22 +162,33 @@ int can_request_irq(unsigned int irq, unsigned long irqflags) | |||
| 153 | { | 162 | { |
| 154 | struct irqaction *action; | 163 | struct irqaction *action; |
| 155 | 164 | ||
| 156 | if (irq >= NR_IRQS) | 165 | if (irq >= NR_IRQS || irq_desc[irq].status & IRQ_NOREQUEST) |
| 157 | return 0; | 166 | return 0; |
| 158 | 167 | ||
| 159 | action = irq_desc[irq].action; | 168 | action = irq_desc[irq].action; |
| 160 | if (action) | 169 | if (action) |
| 161 | if (irqflags & action->flags & SA_SHIRQ) | 170 | if (irqflags & action->flags & IRQF_SHARED) |
| 162 | action = NULL; | 171 | action = NULL; |
| 163 | 172 | ||
| 164 | return !action; | 173 | return !action; |
| 165 | } | 174 | } |
| 166 | 175 | ||
| 176 | void compat_irq_chip_set_default_handler(struct irq_desc *desc) | ||
| 177 | { | ||
| 178 | /* | ||
| 179 | * If the architecture still has not overriden | ||
| 180 | * the flow handler then zap the default. This | ||
| 181 | * should catch incorrect flow-type setting. | ||
| 182 | */ | ||
| 183 | if (desc->handle_irq == &handle_bad_irq) | ||
| 184 | desc->handle_irq = NULL; | ||
| 185 | } | ||
| 186 | |||
| 167 | /* | 187 | /* |
| 168 | * Internal function to register an irqaction - typically used to | 188 | * Internal function to register an irqaction - typically used to |
| 169 | * allocate special interrupts that are part of the architecture. | 189 | * allocate special interrupts that are part of the architecture. |
| 170 | */ | 190 | */ |
| 171 | int setup_irq(unsigned int irq, struct irqaction * new) | 191 | int setup_irq(unsigned int irq, struct irqaction *new) |
| 172 | { | 192 | { |
| 173 | struct irq_desc *desc = irq_desc + irq; | 193 | struct irq_desc *desc = irq_desc + irq; |
| 174 | struct irqaction *old, **p; | 194 | struct irqaction *old, **p; |
| @@ -178,14 +198,14 @@ int setup_irq(unsigned int irq, struct irqaction * new) | |||
| 178 | if (irq >= NR_IRQS) | 198 | if (irq >= NR_IRQS) |
| 179 | return -EINVAL; | 199 | return -EINVAL; |
| 180 | 200 | ||
| 181 | if (desc->handler == &no_irq_type) | 201 | if (desc->chip == &no_irq_chip) |
| 182 | return -ENOSYS; | 202 | return -ENOSYS; |
| 183 | /* | 203 | /* |
| 184 | * Some drivers like serial.c use request_irq() heavily, | 204 | * Some drivers like serial.c use request_irq() heavily, |
| 185 | * so we have to be careful not to interfere with a | 205 | * so we have to be careful not to interfere with a |
| 186 | * running system. | 206 | * running system. |
| 187 | */ | 207 | */ |
| 188 | if (new->flags & SA_SAMPLE_RANDOM) { | 208 | if (new->flags & IRQF_SAMPLE_RANDOM) { |
| 189 | /* | 209 | /* |
| 190 | * This function might sleep, we want to call it first, | 210 | * This function might sleep, we want to call it first, |
| 191 | * outside of the atomic block. | 211 | * outside of the atomic block. |
| @@ -200,16 +220,24 @@ int setup_irq(unsigned int irq, struct irqaction * new) | |||
| 200 | /* | 220 | /* |
| 201 | * The following block of code has to be executed atomically | 221 | * The following block of code has to be executed atomically |
| 202 | */ | 222 | */ |
| 203 | spin_lock_irqsave(&desc->lock,flags); | 223 | spin_lock_irqsave(&desc->lock, flags); |
| 204 | p = &desc->action; | 224 | p = &desc->action; |
| 205 | if ((old = *p) != NULL) { | 225 | old = *p; |
| 206 | /* Can't share interrupts unless both agree to */ | 226 | if (old) { |
| 207 | if (!(old->flags & new->flags & SA_SHIRQ)) | 227 | /* |
| 228 | * Can't share interrupts unless both agree to and are | ||
| 229 | * the same type (level, edge, polarity). So both flag | ||
| 230 | * fields must have IRQF_SHARED set and the bits which | ||
| 231 | * set the trigger type must match. | ||
| 232 | */ | ||
| 233 | if (!((old->flags & new->flags) & IRQF_SHARED) || | ||
| 234 | ((old->flags ^ new->flags) & IRQF_TRIGGER_MASK)) | ||
| 208 | goto mismatch; | 235 | goto mismatch; |
| 209 | 236 | ||
| 210 | #if defined(ARCH_HAS_IRQ_PER_CPU) && defined(SA_PERCPU_IRQ) | 237 | #if defined(CONFIG_IRQ_PER_CPU) && defined(IRQF_PERCPU) |
| 211 | /* All handlers must agree on per-cpuness */ | 238 | /* All handlers must agree on per-cpuness */ |
| 212 | if ((old->flags & IRQ_PER_CPU) != (new->flags & IRQ_PER_CPU)) | 239 | if ((old->flags & IRQF_PERCPU) != |
| 240 | (new->flags & IRQF_PERCPU)) | ||
| 213 | goto mismatch; | 241 | goto mismatch; |
| 214 | #endif | 242 | #endif |
| 215 | 243 | ||
| @@ -222,20 +250,45 @@ int setup_irq(unsigned int irq, struct irqaction * new) | |||
| 222 | } | 250 | } |
| 223 | 251 | ||
| 224 | *p = new; | 252 | *p = new; |
| 225 | #if defined(ARCH_HAS_IRQ_PER_CPU) && defined(SA_PERCPU_IRQ) | 253 | #if defined(CONFIG_IRQ_PER_CPU) && defined(IRQF_PERCPU) |
| 226 | if (new->flags & SA_PERCPU_IRQ) | 254 | if (new->flags & IRQF_PERCPU) |
| 227 | desc->status |= IRQ_PER_CPU; | 255 | desc->status |= IRQ_PER_CPU; |
| 228 | #endif | 256 | #endif |
| 229 | if (!shared) { | 257 | if (!shared) { |
| 230 | desc->depth = 0; | 258 | irq_chip_set_defaults(desc->chip); |
| 231 | desc->status &= ~(IRQ_DISABLED | IRQ_AUTODETECT | | 259 | |
| 232 | IRQ_WAITING | IRQ_INPROGRESS); | 260 | /* Setup the type (level, edge polarity) if configured: */ |
| 233 | if (desc->handler->startup) | 261 | if (new->flags & IRQF_TRIGGER_MASK) { |
| 234 | desc->handler->startup(irq); | 262 | if (desc->chip && desc->chip->set_type) |
| 235 | else | 263 | desc->chip->set_type(irq, |
| 236 | desc->handler->enable(irq); | 264 | new->flags & IRQF_TRIGGER_MASK); |
| 265 | else | ||
| 266 | /* | ||
| 267 | * IRQF_TRIGGER_* but the PIC does not support | ||
| 268 | * multiple flow-types? | ||
| 269 | */ | ||
| 270 | printk(KERN_WARNING "No IRQF_TRIGGER set_type " | ||
| 271 | "function for IRQ %d (%s)\n", irq, | ||
| 272 | desc->chip ? desc->chip->name : | ||
| 273 | "unknown"); | ||
| 274 | } else | ||
| 275 | compat_irq_chip_set_default_handler(desc); | ||
| 276 | |||
| 277 | desc->status &= ~(IRQ_AUTODETECT | IRQ_WAITING | | ||
| 278 | IRQ_INPROGRESS); | ||
| 279 | |||
| 280 | if (!(desc->status & IRQ_NOAUTOEN)) { | ||
| 281 | desc->depth = 0; | ||
| 282 | desc->status &= ~IRQ_DISABLED; | ||
| 283 | if (desc->chip->startup) | ||
| 284 | desc->chip->startup(irq); | ||
| 285 | else | ||
| 286 | desc->chip->enable(irq); | ||
| 287 | } else | ||
| 288 | /* Undo nested disables: */ | ||
| 289 | desc->depth = 1; | ||
| 237 | } | 290 | } |
| 238 | spin_unlock_irqrestore(&desc->lock,flags); | 291 | spin_unlock_irqrestore(&desc->lock, flags); |
| 239 | 292 | ||
| 240 | new->irq = irq; | 293 | new->irq = irq; |
| 241 | register_irq_proc(irq); | 294 | register_irq_proc(irq); |
| @@ -246,8 +299,8 @@ int setup_irq(unsigned int irq, struct irqaction * new) | |||
| 246 | 299 | ||
| 247 | mismatch: | 300 | mismatch: |
| 248 | spin_unlock_irqrestore(&desc->lock, flags); | 301 | spin_unlock_irqrestore(&desc->lock, flags); |
| 249 | if (!(new->flags & SA_PROBEIRQ)) { | 302 | if (!(new->flags & IRQF_PROBE_SHARED)) { |
| 250 | printk(KERN_ERR "%s: irq handler mismatch\n", __FUNCTION__); | 303 | printk(KERN_ERR "IRQ handler type mismatch for IRQ %d\n", irq); |
| 251 | dump_stack(); | 304 | dump_stack(); |
| 252 | } | 305 | } |
| 253 | return -EBUSY; | 306 | return -EBUSY; |
| @@ -278,10 +331,10 @@ void free_irq(unsigned int irq, void *dev_id) | |||
| 278 | return; | 331 | return; |
| 279 | 332 | ||
| 280 | desc = irq_desc + irq; | 333 | desc = irq_desc + irq; |
| 281 | spin_lock_irqsave(&desc->lock,flags); | 334 | spin_lock_irqsave(&desc->lock, flags); |
| 282 | p = &desc->action; | 335 | p = &desc->action; |
| 283 | for (;;) { | 336 | for (;;) { |
| 284 | struct irqaction * action = *p; | 337 | struct irqaction *action = *p; |
| 285 | 338 | ||
| 286 | if (action) { | 339 | if (action) { |
| 287 | struct irqaction **pp = p; | 340 | struct irqaction **pp = p; |
| @@ -295,18 +348,18 @@ void free_irq(unsigned int irq, void *dev_id) | |||
| 295 | 348 | ||
| 296 | /* Currently used only by UML, might disappear one day.*/ | 349 | /* Currently used only by UML, might disappear one day.*/ |
| 297 | #ifdef CONFIG_IRQ_RELEASE_METHOD | 350 | #ifdef CONFIG_IRQ_RELEASE_METHOD |
| 298 | if (desc->handler->release) | 351 | if (desc->chip->release) |
| 299 | desc->handler->release(irq, dev_id); | 352 | desc->chip->release(irq, dev_id); |
| 300 | #endif | 353 | #endif |
| 301 | 354 | ||
| 302 | if (!desc->action) { | 355 | if (!desc->action) { |
| 303 | desc->status |= IRQ_DISABLED; | 356 | desc->status |= IRQ_DISABLED; |
| 304 | if (desc->handler->shutdown) | 357 | if (desc->chip->shutdown) |
| 305 | desc->handler->shutdown(irq); | 358 | desc->chip->shutdown(irq); |
| 306 | else | 359 | else |
| 307 | desc->handler->disable(irq); | 360 | desc->chip->disable(irq); |
| 308 | } | 361 | } |
| 309 | spin_unlock_irqrestore(&desc->lock,flags); | 362 | spin_unlock_irqrestore(&desc->lock, flags); |
| 310 | unregister_handler_proc(irq, action); | 363 | unregister_handler_proc(irq, action); |
| 311 | 364 | ||
| 312 | /* Make sure it's not being used on another CPU */ | 365 | /* Make sure it's not being used on another CPU */ |
| @@ -314,12 +367,11 @@ void free_irq(unsigned int irq, void *dev_id) | |||
| 314 | kfree(action); | 367 | kfree(action); |
| 315 | return; | 368 | return; |
| 316 | } | 369 | } |
| 317 | printk(KERN_ERR "Trying to free free IRQ%d\n",irq); | 370 | printk(KERN_ERR "Trying to free already-free IRQ %d\n", irq); |
| 318 | spin_unlock_irqrestore(&desc->lock,flags); | 371 | spin_unlock_irqrestore(&desc->lock, flags); |
| 319 | return; | 372 | return; |
| 320 | } | 373 | } |
| 321 | } | 374 | } |
| 322 | |||
| 323 | EXPORT_SYMBOL(free_irq); | 375 | EXPORT_SYMBOL(free_irq); |
| 324 | 376 | ||
| 325 | /** | 377 | /** |
| @@ -346,16 +398,16 @@ EXPORT_SYMBOL(free_irq); | |||
| 346 | * | 398 | * |
| 347 | * Flags: | 399 | * Flags: |
| 348 | * | 400 | * |
| 349 | * SA_SHIRQ Interrupt is shared | 401 | * IRQF_SHARED Interrupt is shared |
| 350 | * SA_INTERRUPT Disable local interrupts while processing | 402 | * IRQF_DISABLED Disable local interrupts while processing |
| 351 | * SA_SAMPLE_RANDOM The interrupt can be used for entropy | 403 | * IRQF_SAMPLE_RANDOM The interrupt can be used for entropy |
| 352 | * | 404 | * |
| 353 | */ | 405 | */ |
| 354 | int request_irq(unsigned int irq, | 406 | int request_irq(unsigned int irq, |
| 355 | irqreturn_t (*handler)(int, void *, struct pt_regs *), | 407 | irqreturn_t (*handler)(int, void *, struct pt_regs *), |
| 356 | unsigned long irqflags, const char * devname, void *dev_id) | 408 | unsigned long irqflags, const char *devname, void *dev_id) |
| 357 | { | 409 | { |
| 358 | struct irqaction * action; | 410 | struct irqaction *action; |
| 359 | int retval; | 411 | int retval; |
| 360 | 412 | ||
| 361 | /* | 413 | /* |
| @@ -364,10 +416,12 @@ int request_irq(unsigned int irq, | |||
| 364 | * which interrupt is which (messes up the interrupt freeing | 416 | * which interrupt is which (messes up the interrupt freeing |
| 365 | * logic etc). | 417 | * logic etc). |
| 366 | */ | 418 | */ |
| 367 | if ((irqflags & SA_SHIRQ) && !dev_id) | 419 | if ((irqflags & IRQF_SHARED) && !dev_id) |
| 368 | return -EINVAL; | 420 | return -EINVAL; |
| 369 | if (irq >= NR_IRQS) | 421 | if (irq >= NR_IRQS) |
| 370 | return -EINVAL; | 422 | return -EINVAL; |
| 423 | if (irq_desc[irq].status & IRQ_NOREQUEST) | ||
| 424 | return -EINVAL; | ||
| 371 | if (!handler) | 425 | if (!handler) |
| 372 | return -EINVAL; | 426 | return -EINVAL; |
| 373 | 427 | ||
| @@ -390,6 +444,5 @@ int request_irq(unsigned int irq, | |||
| 390 | 444 | ||
| 391 | return retval; | 445 | return retval; |
| 392 | } | 446 | } |
| 393 | |||
| 394 | EXPORT_SYMBOL(request_irq); | 447 | EXPORT_SYMBOL(request_irq); |
| 395 | 448 | ||
diff --git a/kernel/irq/migration.c b/kernel/irq/migration.c index a12d00eb5e7c..a57ebe9fa6f6 100644 --- a/kernel/irq/migration.c +++ b/kernel/irq/migration.c | |||
| @@ -3,19 +3,19 @@ | |||
| 3 | 3 | ||
| 4 | void set_pending_irq(unsigned int irq, cpumask_t mask) | 4 | void set_pending_irq(unsigned int irq, cpumask_t mask) |
| 5 | { | 5 | { |
| 6 | irq_desc_t *desc = irq_desc + irq; | 6 | struct irq_desc *desc = irq_desc + irq; |
| 7 | unsigned long flags; | 7 | unsigned long flags; |
| 8 | 8 | ||
| 9 | spin_lock_irqsave(&desc->lock, flags); | 9 | spin_lock_irqsave(&desc->lock, flags); |
| 10 | desc->move_irq = 1; | 10 | desc->move_irq = 1; |
| 11 | pending_irq_cpumask[irq] = mask; | 11 | irq_desc[irq].pending_mask = mask; |
| 12 | spin_unlock_irqrestore(&desc->lock, flags); | 12 | spin_unlock_irqrestore(&desc->lock, flags); |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | void move_native_irq(int irq) | 15 | void move_native_irq(int irq) |
| 16 | { | 16 | { |
| 17 | struct irq_desc *desc = irq_desc + irq; | ||
| 17 | cpumask_t tmp; | 18 | cpumask_t tmp; |
| 18 | irq_desc_t *desc = irq_descp(irq); | ||
| 19 | 19 | ||
| 20 | if (likely(!desc->move_irq)) | 20 | if (likely(!desc->move_irq)) |
| 21 | return; | 21 | return; |
| @@ -30,15 +30,15 @@ void move_native_irq(int irq) | |||
| 30 | 30 | ||
| 31 | desc->move_irq = 0; | 31 | desc->move_irq = 0; |
| 32 | 32 | ||
| 33 | if (unlikely(cpus_empty(pending_irq_cpumask[irq]))) | 33 | if (unlikely(cpus_empty(irq_desc[irq].pending_mask))) |
| 34 | return; | 34 | return; |
| 35 | 35 | ||
| 36 | if (!desc->handler->set_affinity) | 36 | if (!desc->chip->set_affinity) |
| 37 | return; | 37 | return; |
| 38 | 38 | ||
| 39 | assert_spin_locked(&desc->lock); | 39 | assert_spin_locked(&desc->lock); |
| 40 | 40 | ||
| 41 | cpus_and(tmp, pending_irq_cpumask[irq], cpu_online_map); | 41 | cpus_and(tmp, irq_desc[irq].pending_mask, cpu_online_map); |
| 42 | 42 | ||
| 43 | /* | 43 | /* |
| 44 | * If there was a valid mask to work with, please | 44 | * If there was a valid mask to work with, please |
| @@ -51,12 +51,12 @@ void move_native_irq(int irq) | |||
| 51 | */ | 51 | */ |
| 52 | if (likely(!cpus_empty(tmp))) { | 52 | if (likely(!cpus_empty(tmp))) { |
| 53 | if (likely(!(desc->status & IRQ_DISABLED))) | 53 | if (likely(!(desc->status & IRQ_DISABLED))) |
| 54 | desc->handler->disable(irq); | 54 | desc->chip->disable(irq); |
| 55 | 55 | ||
| 56 | desc->handler->set_affinity(irq,tmp); | 56 | desc->chip->set_affinity(irq,tmp); |
| 57 | 57 | ||
| 58 | if (likely(!(desc->status & IRQ_DISABLED))) | 58 | if (likely(!(desc->status & IRQ_DISABLED))) |
| 59 | desc->handler->enable(irq); | 59 | desc->chip->enable(irq); |
| 60 | } | 60 | } |
| 61 | cpus_clear(pending_irq_cpumask[irq]); | 61 | cpus_clear(irq_desc[irq].pending_mask); |
| 62 | } | 62 | } |
diff --git a/kernel/irq/proc.c b/kernel/irq/proc.c index afacd6f585fa..607c7809ad01 100644 --- a/kernel/irq/proc.c +++ b/kernel/irq/proc.c | |||
| @@ -12,15 +12,10 @@ | |||
| 12 | 12 | ||
| 13 | #include "internals.h" | 13 | #include "internals.h" |
| 14 | 14 | ||
| 15 | static struct proc_dir_entry *root_irq_dir, *irq_dir[NR_IRQS]; | 15 | static struct proc_dir_entry *root_irq_dir; |
| 16 | 16 | ||
| 17 | #ifdef CONFIG_SMP | 17 | #ifdef CONFIG_SMP |
| 18 | 18 | ||
| 19 | /* | ||
| 20 | * The /proc/irq/<irq>/smp_affinity values: | ||
| 21 | */ | ||
| 22 | static struct proc_dir_entry *smp_affinity_entry[NR_IRQS]; | ||
| 23 | |||
| 24 | #ifdef CONFIG_GENERIC_PENDING_IRQ | 19 | #ifdef CONFIG_GENERIC_PENDING_IRQ |
| 25 | void proc_set_irq_affinity(unsigned int irq, cpumask_t mask_val) | 20 | void proc_set_irq_affinity(unsigned int irq, cpumask_t mask_val) |
| 26 | { | 21 | { |
| @@ -36,15 +31,15 @@ void proc_set_irq_affinity(unsigned int irq, cpumask_t mask_val) | |||
| 36 | void proc_set_irq_affinity(unsigned int irq, cpumask_t mask_val) | 31 | void proc_set_irq_affinity(unsigned int irq, cpumask_t mask_val) |
| 37 | { | 32 | { |
| 38 | set_balance_irq_affinity(irq, mask_val); | 33 | set_balance_irq_affinity(irq, mask_val); |
| 39 | irq_affinity[irq] = mask_val; | 34 | irq_desc[irq].affinity = mask_val; |
| 40 | irq_desc[irq].handler->set_affinity(irq, mask_val); | 35 | irq_desc[irq].chip->set_affinity(irq, mask_val); |
| 41 | } | 36 | } |
| 42 | #endif | 37 | #endif |
| 43 | 38 | ||
| 44 | static int irq_affinity_read_proc(char *page, char **start, off_t off, | 39 | static int irq_affinity_read_proc(char *page, char **start, off_t off, |
| 45 | int count, int *eof, void *data) | 40 | int count, int *eof, void *data) |
| 46 | { | 41 | { |
| 47 | int len = cpumask_scnprintf(page, count, irq_affinity[(long)data]); | 42 | int len = cpumask_scnprintf(page, count, irq_desc[(long)data].affinity); |
| 48 | 43 | ||
| 49 | if (count - len < 2) | 44 | if (count - len < 2) |
| 50 | return -EINVAL; | 45 | return -EINVAL; |
| @@ -59,7 +54,7 @@ static int irq_affinity_write_proc(struct file *file, const char __user *buffer, | |||
| 59 | unsigned int irq = (int)(long)data, full_count = count, err; | 54 | unsigned int irq = (int)(long)data, full_count = count, err; |
| 60 | cpumask_t new_value, tmp; | 55 | cpumask_t new_value, tmp; |
| 61 | 56 | ||
| 62 | if (!irq_desc[irq].handler->set_affinity || no_irq_affinity) | 57 | if (!irq_desc[irq].chip->set_affinity || no_irq_affinity) |
| 63 | return -EIO; | 58 | return -EIO; |
| 64 | 59 | ||
| 65 | err = cpumask_parse(buffer, count, new_value); | 60 | err = cpumask_parse(buffer, count, new_value); |
| @@ -102,7 +97,7 @@ void register_handler_proc(unsigned int irq, struct irqaction *action) | |||
| 102 | { | 97 | { |
| 103 | char name [MAX_NAMELEN]; | 98 | char name [MAX_NAMELEN]; |
| 104 | 99 | ||
| 105 | if (!irq_dir[irq] || action->dir || !action->name || | 100 | if (!irq_desc[irq].dir || action->dir || !action->name || |
| 106 | !name_unique(irq, action)) | 101 | !name_unique(irq, action)) |
| 107 | return; | 102 | return; |
| 108 | 103 | ||
| @@ -110,7 +105,7 @@ void register_handler_proc(unsigned int irq, struct irqaction *action) | |||
| 110 | snprintf(name, MAX_NAMELEN, "%s", action->name); | 105 | snprintf(name, MAX_NAMELEN, "%s", action->name); |
| 111 | 106 | ||
| 112 | /* create /proc/irq/1234/handler/ */ | 107 | /* create /proc/irq/1234/handler/ */ |
| 113 | action->dir = proc_mkdir(name, irq_dir[irq]); | 108 | action->dir = proc_mkdir(name, irq_desc[irq].dir); |
| 114 | } | 109 | } |
| 115 | 110 | ||
| 116 | #undef MAX_NAMELEN | 111 | #undef MAX_NAMELEN |
| @@ -122,22 +117,22 @@ void register_irq_proc(unsigned int irq) | |||
| 122 | char name [MAX_NAMELEN]; | 117 | char name [MAX_NAMELEN]; |
| 123 | 118 | ||
| 124 | if (!root_irq_dir || | 119 | if (!root_irq_dir || |
| 125 | (irq_desc[irq].handler == &no_irq_type) || | 120 | (irq_desc[irq].chip == &no_irq_chip) || |
| 126 | irq_dir[irq]) | 121 | irq_desc[irq].dir) |
| 127 | return; | 122 | return; |
| 128 | 123 | ||
| 129 | memset(name, 0, MAX_NAMELEN); | 124 | memset(name, 0, MAX_NAMELEN); |
| 130 | sprintf(name, "%d", irq); | 125 | sprintf(name, "%d", irq); |
| 131 | 126 | ||
| 132 | /* create /proc/irq/1234 */ | 127 | /* create /proc/irq/1234 */ |
| 133 | irq_dir[irq] = proc_mkdir(name, root_irq_dir); | 128 | irq_desc[irq].dir = proc_mkdir(name, root_irq_dir); |
| 134 | 129 | ||
| 135 | #ifdef CONFIG_SMP | 130 | #ifdef CONFIG_SMP |
| 136 | { | 131 | { |
| 137 | struct proc_dir_entry *entry; | 132 | struct proc_dir_entry *entry; |
| 138 | 133 | ||
| 139 | /* create /proc/irq/<irq>/smp_affinity */ | 134 | /* create /proc/irq/<irq>/smp_affinity */ |
| 140 | entry = create_proc_entry("smp_affinity", 0600, irq_dir[irq]); | 135 | entry = create_proc_entry("smp_affinity", 0600, irq_desc[irq].dir); |
| 141 | 136 | ||
| 142 | if (entry) { | 137 | if (entry) { |
| 143 | entry->nlink = 1; | 138 | entry->nlink = 1; |
| @@ -145,7 +140,6 @@ void register_irq_proc(unsigned int irq) | |||
| 145 | entry->read_proc = irq_affinity_read_proc; | 140 | entry->read_proc = irq_affinity_read_proc; |
| 146 | entry->write_proc = irq_affinity_write_proc; | 141 | entry->write_proc = irq_affinity_write_proc; |
| 147 | } | 142 | } |
| 148 | smp_affinity_entry[irq] = entry; | ||
| 149 | } | 143 | } |
| 150 | #endif | 144 | #endif |
| 151 | } | 145 | } |
| @@ -155,7 +149,7 @@ void register_irq_proc(unsigned int irq) | |||
| 155 | void unregister_handler_proc(unsigned int irq, struct irqaction *action) | 149 | void unregister_handler_proc(unsigned int irq, struct irqaction *action) |
| 156 | { | 150 | { |
| 157 | if (action->dir) | 151 | if (action->dir) |
| 158 | remove_proc_entry(action->dir->name, irq_dir[irq]); | 152 | remove_proc_entry(action->dir->name, irq_desc[irq].dir); |
| 159 | } | 153 | } |
| 160 | 154 | ||
| 161 | void init_irq_proc(void) | 155 | void init_irq_proc(void) |
diff --git a/kernel/irq/resend.c b/kernel/irq/resend.c new file mode 100644 index 000000000000..872f91ba2ce8 --- /dev/null +++ b/kernel/irq/resend.c | |||
| @@ -0,0 +1,78 @@ | |||
| 1 | /* | ||
| 2 | * linux/kernel/irq/resend.c | ||
| 3 | * | ||
| 4 | * Copyright (C) 1992, 1998-2006 Linus Torvalds, Ingo Molnar | ||
| 5 | * Copyright (C) 2005-2006, Thomas Gleixner | ||
| 6 | * | ||
| 7 | * This file contains the IRQ-resend code | ||
| 8 | * | ||
| 9 | * If the interrupt is waiting to be processed, we try to re-run it. | ||
| 10 | * We can't directly run it from here since the caller might be in an | ||
| 11 | * interrupt-protected region. Not all irq controller chips can | ||
| 12 | * retrigger interrupts at the hardware level, so in those cases | ||
| 13 | * we allow the resending of IRQs via a tasklet. | ||
| 14 | */ | ||
| 15 | |||
| 16 | #include <linux/irq.h> | ||
| 17 | #include <linux/module.h> | ||
| 18 | #include <linux/random.h> | ||
| 19 | #include <linux/interrupt.h> | ||
| 20 | |||
| 21 | #include "internals.h" | ||
| 22 | |||
| 23 | #ifdef CONFIG_HARDIRQS_SW_RESEND | ||
| 24 | |||
| 25 | /* Bitmap to handle software resend of interrupts: */ | ||
| 26 | static DECLARE_BITMAP(irqs_resend, NR_IRQS); | ||
| 27 | |||
| 28 | /* | ||
| 29 | * Run software resends of IRQ's | ||
| 30 | */ | ||
| 31 | static void resend_irqs(unsigned long arg) | ||
| 32 | { | ||
| 33 | struct irq_desc *desc; | ||
| 34 | int irq; | ||
| 35 | |||
| 36 | while (!bitmap_empty(irqs_resend, NR_IRQS)) { | ||
| 37 | irq = find_first_bit(irqs_resend, NR_IRQS); | ||
| 38 | clear_bit(irq, irqs_resend); | ||
| 39 | desc = irq_desc + irq; | ||
| 40 | local_irq_disable(); | ||
| 41 | desc->handle_irq(irq, desc, NULL); | ||
| 42 | local_irq_enable(); | ||
| 43 | } | ||
| 44 | } | ||
| 45 | |||
| 46 | /* Tasklet to handle resend: */ | ||
| 47 | static DECLARE_TASKLET(resend_tasklet, resend_irqs, 0); | ||
| 48 | |||
| 49 | #endif | ||
| 50 | |||
| 51 | /* | ||
| 52 | * IRQ resend | ||
| 53 | * | ||
| 54 | * Is called with interrupts disabled and desc->lock held. | ||
| 55 | */ | ||
| 56 | void check_irq_resend(struct irq_desc *desc, unsigned int irq) | ||
| 57 | { | ||
| 58 | unsigned int status = desc->status; | ||
| 59 | |||
| 60 | /* | ||
| 61 | * Make sure the interrupt is enabled, before resending it: | ||
| 62 | */ | ||
| 63 | desc->chip->enable(irq); | ||
| 64 | |||
| 65 | if ((status & (IRQ_PENDING | IRQ_REPLAY)) == IRQ_PENDING) { | ||
| 66 | desc->status &= ~IRQ_PENDING; | ||
| 67 | desc->status = status | IRQ_REPLAY; | ||
| 68 | |||
| 69 | if (!desc->chip || !desc->chip->retrigger || | ||
| 70 | !desc->chip->retrigger(irq)) { | ||
| 71 | #ifdef CONFIG_HARDIRQS_SW_RESEND | ||
| 72 | /* Set it pending and activate the softirq: */ | ||
| 73 | set_bit(irq, irqs_resend); | ||
| 74 | tasklet_schedule(&resend_tasklet); | ||
| 75 | #endif | ||
| 76 | } | ||
| 77 | } | ||
| 78 | } | ||
diff --git a/kernel/irq/spurious.c b/kernel/irq/spurious.c index b2fb3c18d06b..417e98092cf2 100644 --- a/kernel/irq/spurious.c +++ b/kernel/irq/spurious.c | |||
| @@ -16,39 +16,39 @@ static int irqfixup __read_mostly; | |||
| 16 | /* | 16 | /* |
| 17 | * Recovery handler for misrouted interrupts. | 17 | * Recovery handler for misrouted interrupts. |
| 18 | */ | 18 | */ |
| 19 | |||
| 20 | static int misrouted_irq(int irq, struct pt_regs *regs) | 19 | static int misrouted_irq(int irq, struct pt_regs *regs) |
| 21 | { | 20 | { |
| 22 | int i; | 21 | int i; |
| 23 | irq_desc_t *desc; | ||
| 24 | int ok = 0; | 22 | int ok = 0; |
| 25 | int work = 0; /* Did we do work for a real IRQ */ | 23 | int work = 0; /* Did we do work for a real IRQ */ |
| 26 | 24 | ||
| 27 | for(i = 1; i < NR_IRQS; i++) { | 25 | for (i = 1; i < NR_IRQS; i++) { |
| 26 | struct irq_desc *desc = irq_desc + i; | ||
| 28 | struct irqaction *action; | 27 | struct irqaction *action; |
| 29 | 28 | ||
| 30 | if (i == irq) /* Already tried */ | 29 | if (i == irq) /* Already tried */ |
| 31 | continue; | 30 | continue; |
| 32 | desc = &irq_desc[i]; | 31 | |
| 33 | spin_lock(&desc->lock); | 32 | spin_lock(&desc->lock); |
| 34 | action = desc->action; | ||
| 35 | /* Already running on another processor */ | 33 | /* Already running on another processor */ |
| 36 | if (desc->status & IRQ_INPROGRESS) { | 34 | if (desc->status & IRQ_INPROGRESS) { |
| 37 | /* | 35 | /* |
| 38 | * Already running: If it is shared get the other | 36 | * Already running: If it is shared get the other |
| 39 | * CPU to go looking for our mystery interrupt too | 37 | * CPU to go looking for our mystery interrupt too |
| 40 | */ | 38 | */ |
| 41 | if (desc->action && (desc->action->flags & SA_SHIRQ)) | 39 | if (desc->action && (desc->action->flags & IRQF_SHARED)) |
| 42 | desc->status |= IRQ_PENDING; | 40 | desc->status |= IRQ_PENDING; |
| 43 | spin_unlock(&desc->lock); | 41 | spin_unlock(&desc->lock); |
| 44 | continue; | 42 | continue; |
| 45 | } | 43 | } |
| 46 | /* Honour the normal IRQ locking */ | 44 | /* Honour the normal IRQ locking */ |
| 47 | desc->status |= IRQ_INPROGRESS; | 45 | desc->status |= IRQ_INPROGRESS; |
| 46 | action = desc->action; | ||
| 48 | spin_unlock(&desc->lock); | 47 | spin_unlock(&desc->lock); |
| 48 | |||
| 49 | while (action) { | 49 | while (action) { |
| 50 | /* Only shared IRQ handlers are safe to call */ | 50 | /* Only shared IRQ handlers are safe to call */ |
| 51 | if (action->flags & SA_SHIRQ) { | 51 | if (action->flags & IRQF_SHARED) { |
| 52 | if (action->handler(i, action->dev_id, regs) == | 52 | if (action->handler(i, action->dev_id, regs) == |
| 53 | IRQ_HANDLED) | 53 | IRQ_HANDLED) |
| 54 | ok = 1; | 54 | ok = 1; |
| @@ -62,9 +62,8 @@ static int misrouted_irq(int irq, struct pt_regs *regs) | |||
| 62 | 62 | ||
| 63 | /* | 63 | /* |
| 64 | * While we were looking for a fixup someone queued a real | 64 | * While we were looking for a fixup someone queued a real |
| 65 | * IRQ clashing with our walk | 65 | * IRQ clashing with our walk: |
| 66 | */ | 66 | */ |
| 67 | |||
| 68 | while ((desc->status & IRQ_PENDING) && action) { | 67 | while ((desc->status & IRQ_PENDING) && action) { |
| 69 | /* | 68 | /* |
| 70 | * Perform real IRQ processing for the IRQ we deferred | 69 | * Perform real IRQ processing for the IRQ we deferred |
| @@ -80,8 +79,8 @@ static int misrouted_irq(int irq, struct pt_regs *regs) | |||
| 80 | * If we did actual work for the real IRQ line we must let the | 79 | * If we did actual work for the real IRQ line we must let the |
| 81 | * IRQ controller clean up too | 80 | * IRQ controller clean up too |
| 82 | */ | 81 | */ |
| 83 | if(work) | 82 | if (work && desc->chip && desc->chip->end) |
| 84 | desc->handler->end(i); | 83 | desc->chip->end(i); |
| 85 | spin_unlock(&desc->lock); | 84 | spin_unlock(&desc->lock); |
| 86 | } | 85 | } |
| 87 | /* So the caller can adjust the irq error counts */ | 86 | /* So the caller can adjust the irq error counts */ |
| @@ -100,7 +99,8 @@ static int misrouted_irq(int irq, struct pt_regs *regs) | |||
| 100 | */ | 99 | */ |
| 101 | 100 | ||
| 102 | static void | 101 | static void |
| 103 | __report_bad_irq(unsigned int irq, irq_desc_t *desc, irqreturn_t action_ret) | 102 | __report_bad_irq(unsigned int irq, struct irq_desc *desc, |
| 103 | irqreturn_t action_ret) | ||
| 104 | { | 104 | { |
| 105 | struct irqaction *action; | 105 | struct irqaction *action; |
| 106 | 106 | ||
| @@ -113,6 +113,7 @@ __report_bad_irq(unsigned int irq, irq_desc_t *desc, irqreturn_t action_ret) | |||
| 113 | } | 113 | } |
| 114 | dump_stack(); | 114 | dump_stack(); |
| 115 | printk(KERN_ERR "handlers:\n"); | 115 | printk(KERN_ERR "handlers:\n"); |
| 116 | |||
| 116 | action = desc->action; | 117 | action = desc->action; |
| 117 | while (action) { | 118 | while (action) { |
| 118 | printk(KERN_ERR "[<%p>]", action->handler); | 119 | printk(KERN_ERR "[<%p>]", action->handler); |
| @@ -123,7 +124,8 @@ __report_bad_irq(unsigned int irq, irq_desc_t *desc, irqreturn_t action_ret) | |||
| 123 | } | 124 | } |
| 124 | } | 125 | } |
| 125 | 126 | ||
| 126 | static void report_bad_irq(unsigned int irq, irq_desc_t *desc, irqreturn_t action_ret) | 127 | static void |
| 128 | report_bad_irq(unsigned int irq, struct irq_desc *desc, irqreturn_t action_ret) | ||
| 127 | { | 129 | { |
| 128 | static int count = 100; | 130 | static int count = 100; |
| 129 | 131 | ||
| @@ -133,8 +135,8 @@ static void report_bad_irq(unsigned int irq, irq_desc_t *desc, irqreturn_t actio | |||
| 133 | } | 135 | } |
| 134 | } | 136 | } |
| 135 | 137 | ||
| 136 | void note_interrupt(unsigned int irq, irq_desc_t *desc, irqreturn_t action_ret, | 138 | void note_interrupt(unsigned int irq, struct irq_desc *desc, |
| 137 | struct pt_regs *regs) | 139 | irqreturn_t action_ret, struct pt_regs *regs) |
| 138 | { | 140 | { |
| 139 | if (unlikely(action_ret != IRQ_HANDLED)) { | 141 | if (unlikely(action_ret != IRQ_HANDLED)) { |
| 140 | desc->irqs_unhandled++; | 142 | desc->irqs_unhandled++; |
| @@ -166,7 +168,8 @@ void note_interrupt(unsigned int irq, irq_desc_t *desc, irqreturn_t action_ret, | |||
| 166 | */ | 168 | */ |
| 167 | printk(KERN_EMERG "Disabling IRQ #%d\n", irq); | 169 | printk(KERN_EMERG "Disabling IRQ #%d\n", irq); |
| 168 | desc->status |= IRQ_DISABLED; | 170 | desc->status |= IRQ_DISABLED; |
| 169 | desc->handler->disable(irq); | 171 | desc->depth = 1; |
| 172 | desc->chip->disable(irq); | ||
| 170 | } | 173 | } |
| 171 | desc->irqs_unhandled = 0; | 174 | desc->irqs_unhandled = 0; |
| 172 | } | 175 | } |
| @@ -177,6 +180,7 @@ int __init noirqdebug_setup(char *str) | |||
| 177 | { | 180 | { |
| 178 | noirqdebug = 1; | 181 | noirqdebug = 1; |
| 179 | printk(KERN_INFO "IRQ lockup detection disabled\n"); | 182 | printk(KERN_INFO "IRQ lockup detection disabled\n"); |
| 183 | |||
| 180 | return 1; | 184 | return 1; |
| 181 | } | 185 | } |
| 182 | 186 | ||
| @@ -187,6 +191,7 @@ static int __init irqfixup_setup(char *str) | |||
| 187 | irqfixup = 1; | 191 | irqfixup = 1; |
| 188 | printk(KERN_WARNING "Misrouted IRQ fixup support enabled.\n"); | 192 | printk(KERN_WARNING "Misrouted IRQ fixup support enabled.\n"); |
| 189 | printk(KERN_WARNING "This may impact system performance.\n"); | 193 | printk(KERN_WARNING "This may impact system performance.\n"); |
| 194 | |||
| 190 | return 1; | 195 | return 1; |
| 191 | } | 196 | } |
| 192 | 197 | ||
