hc
2023-12-11 1f93a7dfd1f8d5ff7a5c53246c7534fe2332d6f4
kernel/arch/arc/kernel/entry-arcv2.S
....@@ -1,11 +1,8 @@
1
+/* SPDX-License-Identifier: GPL-2.0-only */
12 /*
23 * ARCv2 ISA based core Low Level Intr/Traps/Exceptions(non-TLB) Handling
34 *
45 * Copyright (C) 2013 Synopsys, Inc. (www.synopsys.com)
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License version 2 as
8
- * published by the Free Software Foundation.
96 */
107
118 #include <linux/linkage.h> /* ARC_{EXTRY,EXIT} */
....@@ -70,7 +67,7 @@
7067
7168 ENTRY(handle_interrupt)
7269
73
- INTERRUPT_PROLOGUE irq
70
+ INTERRUPT_PROLOGUE
7471
7572 # irq control APIs local_irq_save/restore/disable/enable fiddle with
7673 # global interrupt enable bits in STATUS32 (.IE for 1 prio, .E[] for 2 prio)
....@@ -82,7 +79,7 @@
8279 #
8380 # Note this disable is only for consistent book-keeping as further interrupts
8481 # will be disabled anyways even w/o this. Hardware tracks active interrupts
85
- # seperately in AUX_IRQ_ACTIVE.active and will not take new interrupts
82
+ # seperately in AUX_IRQ_ACT.active and will not take new interrupts
8683 # unless this one returns (or higher prio becomes pending in 2-prio scheme)
8784
8885 IRQ_DISABLE
....@@ -203,17 +200,18 @@
203200 ld r0, [sp, PT_status32] ; U/K mode at time of entry
204201 lr r10, [AUX_IRQ_ACT]
205202
206
- bmsk r11, r10, 15 ; AUX_IRQ_ACT.ACTIVE
203
+ bmsk r11, r10, 15 ; extract AUX_IRQ_ACT.active
207204 breq r11, 0, .Lexcept_ret ; No intr active, ret from Exception
208205
209206 ;####### Return from Intr #######
207
+
208
+.Lisr_ret:
210209
211210 debug_marker_l1:
212211 ; bbit1.nt r0, STATUS_DE_BIT, .Lintr_ret_to_delay_slot
213212 btst r0, STATUS_DE_BIT ; Z flag set if bit clear
214213 bnz .Lintr_ret_to_delay_slot ; branch if STATUS_DE_BIT set
215214
216
-.Lisr_ret_fast_path:
217215 ; Handle special case #1: (Entry via Exception, Return via IRQ)
218216 ;
219217 ; Exception in U mode, preempted in kernel, Intr taken (K mode), orig
....@@ -226,7 +224,7 @@
226224 bset.nz r11, r11, AUX_IRQ_ACT_BIT_U ; NZ means U
227225 sr r11, [AUX_IRQ_ACT]
228226
229
- INTERRUPT_EPILOGUE irq
227
+ INTERRUPT_EPILOGUE
230228 rtie
231229
232230 ;####### Return from Exception / pure kernel mode #######
....@@ -247,8 +245,8 @@
247245 ;
248246 ; IRQ RTIE won't reliably restore DE bit and/or BTA, needs workaround
249247 ;
250
-; Solution is return from Intr w/o any delay slot quirks into a kernel trampoline
251
-; and from pure kernel mode return to delay slot which handles DS bit/BTA correctly
248
+; Solution is to drop out of interrupt context into pure kernel mode
249
+; and return from pure kernel mode which does right things for delay slot
252250
253251 .Lintr_ret_to_delay_slot:
254252 debug_marker_ds:
....@@ -257,48 +255,9 @@
257255 add r2, r2, 1
258256 st r2, [@intr_to_DE_cnt]
259257
260
- ld r2, [sp, PT_ret]
261
- ld r3, [sp, PT_status32]
262
-
263
- ; STAT32 for Int return created from scratch
264
- ; (No delay dlot, disable Further intr in trampoline)
265
-
266
- bic r0, r3, STATUS_U_MASK|STATUS_DE_MASK|STATUS_IE_MASK|STATUS_L_MASK
267
- st r0, [sp, PT_status32]
268
-
269
- mov r1, .Lintr_ret_to_delay_slot_2
270
- st r1, [sp, PT_ret]
271
-
272
- ; Orig exception PC/STAT32 safekept @orig_r0 and @event stack slots
273
- st r2, [sp, 0]
274
- st r3, [sp, 4]
275
-
276
- b .Lisr_ret_fast_path
277
-
278
-.Lintr_ret_to_delay_slot_2:
279
- ; Trampoline to restore orig exception PC/STAT32/BTA/AUX_USER_SP
280
- sub sp, sp, SZ_PT_REGS
281
- st r9, [sp, -4]
282
-
283
- ld r9, [sp, 0]
284
- sr r9, [eret]
285
-
286
- ld r9, [sp, 4]
287
- sr r9, [erstatus]
288
-
289
- ; restore AUX_USER_SP if returning to U mode
290
- bbit0 r9, STATUS_U_BIT, 1f
291
- ld r9, [sp, PT_sp]
292
- sr r9, [AUX_USER_SP]
293
-
294
-1:
295
- ld r9, [sp, 8]
296
- sr r9, [erbta]
297
-
298
- ld r9, [sp, -4]
299
- add sp, sp, SZ_PT_REGS
300
-
301
- ; return from pure kernel mode to delay slot
302
- rtie
258
+ ; drop out of interrupt context (clear AUX_IRQ_ACT.active)
259
+ bmskn r11, r10, 15
260
+ sr r11, [AUX_IRQ_ACT]
261
+ b .Lexcept_ret
303262
304263 END(ret_from_exception)