diff options
author | oftedal <oftedal@gmail.com> | 2011-06-01 07:04:20 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-06-07 19:06:33 -0400 |
commit | ea160584574e345495e75ee4a7d3a7dbcad9e16c (patch) | |
tree | 87c6f45332556a44b55646ce5bc905a001883a95 /arch/sparc | |
parent | 5fba17084e5d1b00bf24e17b2b580cfa7705e7be (diff) |
Do not skip interrupt sources in sun4d interrupt handler and acknowledge interrupts correctly
During the introduction of genirq on sparc32 bugs were introduced in
the interrupt handler for sun4d. The interrupts handler checks the status
of the various sbus interfaces in the system and generates a virtual
interrupt, based upon the location of the interrupt source. This lookup
was broken by restructuring the code in such a way that index and shift
operations were performed prior to comparing this against the values
read from the interrupt controllers.
This could cause the handler to loop eternally as the interrupt source
could be skipped before any check was performed. Additionally
sun4d_encode_irq performs shifting internally, so it should not be performed
twice.
In sun4d_unmask interrupts were not correctly acknowledged, as the
corresponding bit it the interrupt mask was not actually cleared.
Signed-off-by: Kjetil Oftedal <oftedal@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc')
-rw-r--r-- | arch/sparc/kernel/sun4d_irq.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/arch/sparc/kernel/sun4d_irq.c b/arch/sparc/kernel/sun4d_irq.c index 487c1bb374f5..eaec8a90fb9f 100644 --- a/arch/sparc/kernel/sun4d_irq.c +++ b/arch/sparc/kernel/sun4d_irq.c | |||
@@ -103,10 +103,9 @@ static void sun4d_sbus_handler_irq(int sbusl) | |||
103 | 103 | ||
104 | sbil = (sbusl << 2); | 104 | sbil = (sbusl << 2); |
105 | /* Loop for each pending SBI */ | 105 | /* Loop for each pending SBI */ |
106 | for (sbino = 0; bus_mask; sbino++) { | 106 | for (sbino = 0; bus_mask; sbino++, bus_mask >>= 1) { |
107 | unsigned int idx, mask; | 107 | unsigned int idx, mask; |
108 | 108 | ||
109 | bus_mask >>= 1; | ||
110 | if (!(bus_mask & 1)) | 109 | if (!(bus_mask & 1)) |
111 | continue; | 110 | continue; |
112 | /* XXX This seems to ACK the irq twice. acquire_sbi() | 111 | /* XXX This seems to ACK the irq twice. acquire_sbi() |
@@ -118,19 +117,16 @@ static void sun4d_sbus_handler_irq(int sbusl) | |||
118 | mask &= (0xf << sbil); | 117 | mask &= (0xf << sbil); |
119 | 118 | ||
120 | /* Loop for each pending SBI slot */ | 119 | /* Loop for each pending SBI slot */ |
121 | idx = 0; | ||
122 | slot = (1 << sbil); | 120 | slot = (1 << sbil); |
123 | while (mask != 0) { | 121 | for (idx = 0; mask != 0; idx++, slot <<= 1) { |
124 | unsigned int pil; | 122 | unsigned int pil; |
125 | struct irq_bucket *p; | 123 | struct irq_bucket *p; |
126 | 124 | ||
127 | idx++; | ||
128 | slot <<= 1; | ||
129 | if (!(mask & slot)) | 125 | if (!(mask & slot)) |
130 | continue; | 126 | continue; |
131 | 127 | ||
132 | mask &= ~slot; | 128 | mask &= ~slot; |
133 | pil = sun4d_encode_irq(sbino, sbil, idx); | 129 | pil = sun4d_encode_irq(sbino, sbusl, idx); |
134 | 130 | ||
135 | p = irq_map[pil]; | 131 | p = irq_map[pil]; |
136 | while (p) { | 132 | while (p) { |
@@ -218,10 +214,10 @@ static void sun4d_unmask_irq(struct irq_data *data) | |||
218 | 214 | ||
219 | #ifdef CONFIG_SMP | 215 | #ifdef CONFIG_SMP |
220 | spin_lock_irqsave(&sun4d_imsk_lock, flags); | 216 | spin_lock_irqsave(&sun4d_imsk_lock, flags); |
221 | cc_set_imsk_other(cpuid, cc_get_imsk_other(cpuid) | ~(1 << real_irq)); | 217 | cc_set_imsk_other(cpuid, cc_get_imsk_other(cpuid) & ~(1 << real_irq)); |
222 | spin_unlock_irqrestore(&sun4d_imsk_lock, flags); | 218 | spin_unlock_irqrestore(&sun4d_imsk_lock, flags); |
223 | #else | 219 | #else |
224 | cc_set_imsk(cc_get_imsk() | ~(1 << real_irq)); | 220 | cc_set_imsk(cc_get_imsk() & ~(1 << real_irq)); |
225 | #endif | 221 | #endif |
226 | } | 222 | } |
227 | 223 | ||