aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2013-11-11 15:01:03 -0500
committerThomas Gleixner <tglx@linutronix.de>2013-11-13 14:21:46 -0500
commit09f90f6685cd88b6b904c141035d096169958cc4 (patch)
tree4784a4c02a7620bc24e92ba59da56d00cf190493 /arch
parentb39898cd4077f4b6ec706e717c938751c34e1dc4 (diff)
m68k: Simplify low level interrupt handling code
The low level interrupt entry code of m68k contains the following: add_preempt_count(HARDIRQ_OFFSET); do_IRQ(); irq_enter(); add_preempt_count(HARDIRQ_OFFSET); handle_interrupt(); irq_exit(); sub_preempt_count(HARDIRQ_OFFSET); if (in_interrupt()) return; <---- On m68k always taken! if (local_softirq_pending()) do_softirq(); sub_preempt_count(HARDIRQ_OFFSET); if (in_hardirq()) return; if (status_on_stack_has_interrupt_priority_mask > 0) return; if (local_softirq_pending()) do_softirq(); ret_from_exception: if (interrupted_context_is_kernel) return: .... I tried to find a proper explanation for this, but the changelog is sparse and there are no mails explaining it further. But obviously this relates to the interrupt priority levels of the m68k and tries to be extra clever with nested interrupts. Though this cleverness just adds code bloat to the interrupt hotpath. For the common case of non nested interrupts the code runs through two extra conditionals to the only important one, which checks whether the return is to kernel or user space. For the nested case the checks for in_hardirq() and the priority mask value on stack catch only the case where the nested interrupt happens inside the hard irq context of the first interrupt. If the nested interrupt happens while the first interrupt handles soft interrupts, then these extra checks buy nothing. The nested interrupt will fall through to the final kernel/user space return check at ret_from_exception. Changing the code flow in the following way: do_IRQ(); irq_enter(); add_preempt_count(HARDIRQ_OFFSET); handle_interrupt(); irq_exit(); sub_preempt_count(HARDIRQ_OFFSET); if (in_interrupt()) return; if (local_softirq_pending()) do_softirq(); ret_from_exception: if (interrupted_context_is_kernel) return: makes the region protected by the hardirq count slightly smaller and the softirq handling is invoked with a minimal deeper stack. But otherwise it's completely functional equivalent and saves 104 bytes of text in arch/m68k/kernel/entry.o. This modification allows us further to get rid of the limitations which m68k puts on the preempt_count layout, so we can make the preempt count bits completely generic. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Tested-by: Michael Schmitz <schmitz@biophys.uni-duesseldorf.de> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> Cc: Linux/m68k <linux-m68k@vger.kernel.org> Cc: Andreas Schwab <schwab@linux-m68k.org> Link: http://lkml.kernel.org/r/alpine.DEB.2.02.1311112052360.30673@ionos.tec.linutronix.de
Diffstat (limited to 'arch')
-rw-r--r--arch/m68k/kernel/entry.S40
-rw-r--r--arch/m68k/kernel/ints.c6
-rw-r--r--arch/m68k/platform/68000/entry.S33
-rw-r--r--arch/m68k/platform/68360/entry.S24
4 files changed, 15 insertions, 88 deletions
diff --git a/arch/m68k/kernel/entry.S b/arch/m68k/kernel/entry.S
index a78f5649e8de..b54ac7aba850 100644
--- a/arch/m68k/kernel/entry.S
+++ b/arch/m68k/kernel/entry.S
@@ -45,7 +45,7 @@
45.globl system_call, buserr, trap, resume 45.globl system_call, buserr, trap, resume
46.globl sys_call_table 46.globl sys_call_table
47.globl __sys_fork, __sys_clone, __sys_vfork 47.globl __sys_fork, __sys_clone, __sys_vfork
48.globl ret_from_interrupt, bad_interrupt 48.globl bad_interrupt
49.globl auto_irqhandler_fixup 49.globl auto_irqhandler_fixup
50.globl user_irqvec_fixup 50.globl user_irqvec_fixup
51 51
@@ -275,8 +275,6 @@ do_delayed_trace:
275ENTRY(auto_inthandler) 275ENTRY(auto_inthandler)
276 SAVE_ALL_INT 276 SAVE_ALL_INT
277 GET_CURRENT(%d0) 277 GET_CURRENT(%d0)
278 movel %d0,%a1
279 addqb #1,%a1@(TINFO_PREEMPT+1)
280 | put exception # in d0 278 | put exception # in d0
281 bfextu %sp@(PT_OFF_FORMATVEC){#4,#10},%d0 279 bfextu %sp@(PT_OFF_FORMATVEC){#4,#10},%d0
282 subw #VEC_SPUR,%d0 280 subw #VEC_SPUR,%d0
@@ -286,32 +284,13 @@ ENTRY(auto_inthandler)
286auto_irqhandler_fixup = . + 2 284auto_irqhandler_fixup = . + 2
287 jsr do_IRQ | process the IRQ 285 jsr do_IRQ | process the IRQ
288 addql #8,%sp | pop parameters off stack 286 addql #8,%sp | pop parameters off stack
289 287 jra ret_from_exception
290ret_from_interrupt:
291 movel %curptr@(TASK_STACK),%a1
292 subqb #1,%a1@(TINFO_PREEMPT+1)
293 jeq ret_from_last_interrupt
2942: RESTORE_ALL
295
296 ALIGN
297ret_from_last_interrupt:
298 moveq #(~ALLOWINT>>8)&0xff,%d0
299 andb %sp@(PT_OFF_SR),%d0
300 jne 2b
301
302 /* check if we need to do software interrupts */
303 tstl irq_stat+CPUSTAT_SOFTIRQ_PENDING
304 jeq .Lret_from_exception
305 pea ret_from_exception
306 jra do_softirq
307 288
308/* Handler for user defined interrupt vectors */ 289/* Handler for user defined interrupt vectors */
309 290
310ENTRY(user_inthandler) 291ENTRY(user_inthandler)
311 SAVE_ALL_INT 292 SAVE_ALL_INT
312 GET_CURRENT(%d0) 293 GET_CURRENT(%d0)
313 movel %d0,%a1
314 addqb #1,%a1@(TINFO_PREEMPT+1)
315 | put exception # in d0 294 | put exception # in d0
316 bfextu %sp@(PT_OFF_FORMATVEC){#4,#10},%d0 295 bfextu %sp@(PT_OFF_FORMATVEC){#4,#10},%d0
317user_irqvec_fixup = . + 2 296user_irqvec_fixup = . + 2
@@ -321,29 +300,18 @@ user_irqvec_fixup = . + 2
321 movel %d0,%sp@- | put vector # on stack 300 movel %d0,%sp@- | put vector # on stack
322 jsr do_IRQ | process the IRQ 301 jsr do_IRQ | process the IRQ
323 addql #8,%sp | pop parameters off stack 302 addql #8,%sp | pop parameters off stack
324 303 jra ret_from_exception
325 movel %curptr@(TASK_STACK),%a1
326 subqb #1,%a1@(TINFO_PREEMPT+1)
327 jeq ret_from_last_interrupt
328 RESTORE_ALL
329 304
330/* Handler for uninitialized and spurious interrupts */ 305/* Handler for uninitialized and spurious interrupts */
331 306
332ENTRY(bad_inthandler) 307ENTRY(bad_inthandler)
333 SAVE_ALL_INT 308 SAVE_ALL_INT
334 GET_CURRENT(%d0) 309 GET_CURRENT(%d0)
335 movel %d0,%a1
336 addqb #1,%a1@(TINFO_PREEMPT+1)
337 310
338 movel %sp,%sp@- 311 movel %sp,%sp@-
339 jsr handle_badint 312 jsr handle_badint
340 addql #4,%sp 313 addql #4,%sp
341 314 jra ret_from_exception
342 movel %curptr@(TASK_STACK),%a1
343 subqb #1,%a1@(TINFO_PREEMPT+1)
344 jeq ret_from_last_interrupt
345 RESTORE_ALL
346
347 315
348resume: 316resume:
349 /* 317 /*
diff --git a/arch/m68k/kernel/ints.c b/arch/m68k/kernel/ints.c
index 4d7da384eea0..077d3a70fed1 100644
--- a/arch/m68k/kernel/ints.c
+++ b/arch/m68k/kernel/ints.c
@@ -58,12 +58,6 @@ void __init init_IRQ(void)
58{ 58{
59 int i; 59 int i;
60 60
61 /* assembly irq entry code relies on this... */
62 if (HARDIRQ_MASK != 0x00ff0000) {
63 extern void hardirq_mask_is_broken(void);
64 hardirq_mask_is_broken();
65 }
66
67 for (i = IRQ_AUTO_1; i <= IRQ_AUTO_7; i++) 61 for (i = IRQ_AUTO_1; i <= IRQ_AUTO_7; i++)
68 irq_set_chip_and_handler(i, &auto_irq_chip, handle_simple_irq); 62 irq_set_chip_and_handler(i, &auto_irq_chip, handle_simple_irq);
69 63
diff --git a/arch/m68k/platform/68000/entry.S b/arch/m68k/platform/68000/entry.S
index 7f91c2fde509..23ac054c6e1a 100644
--- a/arch/m68k/platform/68000/entry.S
+++ b/arch/m68k/platform/68000/entry.S
@@ -27,7 +27,6 @@
27.globl ret_from_exception 27.globl ret_from_exception
28.globl ret_from_signal 28.globl ret_from_signal
29.globl sys_call_table 29.globl sys_call_table
30.globl ret_from_interrupt
31.globl bad_interrupt 30.globl bad_interrupt
32.globl inthandler1 31.globl inthandler1
33.globl inthandler2 32.globl inthandler2
@@ -137,7 +136,7 @@ inthandler1:
137 movel #65,%sp@- /* put vector # on stack*/ 136 movel #65,%sp@- /* put vector # on stack*/
138 jbsr process_int /* process the IRQ*/ 137 jbsr process_int /* process the IRQ*/
1393: addql #8,%sp /* pop parameters off stack*/ 1383: addql #8,%sp /* pop parameters off stack*/
140 bra ret_from_interrupt 139 bra ret_from_exception
141 140
142inthandler2: 141inthandler2:
143 SAVE_ALL_INT 142 SAVE_ALL_INT
@@ -148,7 +147,7 @@ inthandler2:
148 movel #66,%sp@- /* put vector # on stack*/ 147 movel #66,%sp@- /* put vector # on stack*/
149 jbsr process_int /* process the IRQ*/ 148 jbsr process_int /* process the IRQ*/
1503: addql #8,%sp /* pop parameters off stack*/ 1493: addql #8,%sp /* pop parameters off stack*/
151 bra ret_from_interrupt 150 bra ret_from_exception
152 151
153inthandler3: 152inthandler3:
154 SAVE_ALL_INT 153 SAVE_ALL_INT
@@ -159,7 +158,7 @@ inthandler3:
159 movel #67,%sp@- /* put vector # on stack*/ 158 movel #67,%sp@- /* put vector # on stack*/
160 jbsr process_int /* process the IRQ*/ 159 jbsr process_int /* process the IRQ*/
1613: addql #8,%sp /* pop parameters off stack*/ 1603: addql #8,%sp /* pop parameters off stack*/
162 bra ret_from_interrupt 161 bra ret_from_exception
163 162
164inthandler4: 163inthandler4:
165 SAVE_ALL_INT 164 SAVE_ALL_INT
@@ -170,7 +169,7 @@ inthandler4:
170 movel #68,%sp@- /* put vector # on stack*/ 169 movel #68,%sp@- /* put vector # on stack*/
171 jbsr process_int /* process the IRQ*/ 170 jbsr process_int /* process the IRQ*/
1723: addql #8,%sp /* pop parameters off stack*/ 1713: addql #8,%sp /* pop parameters off stack*/
173 bra ret_from_interrupt 172 bra ret_from_exception
174 173
175inthandler5: 174inthandler5:
176 SAVE_ALL_INT 175 SAVE_ALL_INT
@@ -181,7 +180,7 @@ inthandler5:
181 movel #69,%sp@- /* put vector # on stack*/ 180 movel #69,%sp@- /* put vector # on stack*/
182 jbsr process_int /* process the IRQ*/ 181 jbsr process_int /* process the IRQ*/
1833: addql #8,%sp /* pop parameters off stack*/ 1823: addql #8,%sp /* pop parameters off stack*/
184 bra ret_from_interrupt 183 bra ret_from_exception
185 184
186inthandler6: 185inthandler6:
187 SAVE_ALL_INT 186 SAVE_ALL_INT
@@ -192,7 +191,7 @@ inthandler6:
192 movel #70,%sp@- /* put vector # on stack*/ 191 movel #70,%sp@- /* put vector # on stack*/
193 jbsr process_int /* process the IRQ*/ 192 jbsr process_int /* process the IRQ*/
1943: addql #8,%sp /* pop parameters off stack*/ 1933: addql #8,%sp /* pop parameters off stack*/
195 bra ret_from_interrupt 194 bra ret_from_exception
196 195
197inthandler7: 196inthandler7:
198 SAVE_ALL_INT 197 SAVE_ALL_INT
@@ -203,7 +202,7 @@ inthandler7:
203 movel #71,%sp@- /* put vector # on stack*/ 202 movel #71,%sp@- /* put vector # on stack*/
204 jbsr process_int /* process the IRQ*/ 203 jbsr process_int /* process the IRQ*/
2053: addql #8,%sp /* pop parameters off stack*/ 2043: addql #8,%sp /* pop parameters off stack*/
206 bra ret_from_interrupt 205 bra ret_from_exception
207 206
208inthandler: 207inthandler:
209 SAVE_ALL_INT 208 SAVE_ALL_INT
@@ -214,23 +213,7 @@ inthandler:
214 movel %d0,%sp@- /* put vector # on stack*/ 213 movel %d0,%sp@- /* put vector # on stack*/
215 jbsr process_int /* process the IRQ*/ 214 jbsr process_int /* process the IRQ*/
2163: addql #8,%sp /* pop parameters off stack*/ 2153: addql #8,%sp /* pop parameters off stack*/
217 bra ret_from_interrupt 216 bra ret_from_exception
218
219ret_from_interrupt:
220 jeq 1f
2212:
222 RESTORE_ALL
2231:
224 moveb %sp@(PT_OFF_SR), %d0
225 and #7, %d0
226 jhi 2b
227
228 /* check if we need to do software interrupts */
229 jeq ret_from_exception
230
231 pea ret_from_exception
232 jra do_softirq
233
234 217
235/* 218/*
236 * Handler for uninitialized and spurious interrupts. 219 * Handler for uninitialized and spurious interrupts.
diff --git a/arch/m68k/platform/68360/entry.S b/arch/m68k/platform/68360/entry.S
index 904fd9a4af4e..447c33ef37fd 100644
--- a/arch/m68k/platform/68360/entry.S
+++ b/arch/m68k/platform/68360/entry.S
@@ -29,7 +29,6 @@
29.globl ret_from_exception 29.globl ret_from_exception
30.globl ret_from_signal 30.globl ret_from_signal
31.globl sys_call_table 31.globl sys_call_table
32.globl ret_from_interrupt
33.globl bad_interrupt 32.globl bad_interrupt
34.globl inthandler 33.globl inthandler
35 34
@@ -132,26 +131,9 @@ inthandler:
132 131
133 movel %sp,%sp@- 132 movel %sp,%sp@-
134 movel %d0,%sp@- /* put vector # on stack*/ 133 movel %d0,%sp@- /* put vector # on stack*/
135 jbsr do_IRQ /* process the IRQ*/ 134 jbsr do_IRQ /* process the IRQ */
1363: addql #8,%sp /* pop parameters off stack*/ 135 addql #8,%sp /* pop parameters off stack*/
137 bra ret_from_interrupt 136 jra ret_from_exception
138
139ret_from_interrupt:
140 jeq 1f
1412:
142 RESTORE_ALL
1431:
144 moveb %sp@(PT_OFF_SR), %d0
145 and #7, %d0
146 jhi 2b
147 /* check if we need to do software interrupts */
148
149 movel irq_stat+CPUSTAT_SOFTIRQ_PENDING,%d0
150 jeq ret_from_exception
151
152 pea ret_from_exception
153 jra do_softirq
154
155 137
156/* 138/*
157 * Handler for uninitialized and spurious interrupts. 139 * Handler for uninitialized and spurious interrupts.