Skip to content

Commit 9b56feb

Browse files
author
Russell King
committed
ARM: entry: move IRQ tracing exit into svc_exit
The IRQ tracing exit path is much the same between all SVC mode exits, so move this into the svc_exit macro. Use a macro parameter to identify the IRQ case, which is the only different case there is. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
1 parent 651e949 commit 9b56feb

2 files changed

Lines changed: 31 additions & 28 deletions

File tree

‎arch/arm/kernel/entry-armv.S‎

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -197,13 +197,6 @@ __dabt_svc:
197197
@ IRQs off again before pulling preserved data off the stack
198198
@
199199
disable_irq_notrace
200-
201-
#ifdef CONFIG_TRACE_IRQFLAGS
202-
tst r5, #PSR_I_BIT
203-
bleq trace_hardirqs_on
204-
tst r5, #PSR_I_BIT
205-
blne trace_hardirqs_off
206-
#endif
207200
svc_exit r5 @ return from exception
208201
UNWIND(.fnend )
209202
ENDPROC(__dabt_svc)
@@ -223,12 +216,7 @@ __irq_svc:
223216
blne svc_preempt
224217
#endif
225218

226-
#ifdef CONFIG_TRACE_IRQFLAGS
227-
@ The parent context IRQs must have been enabled to get here in
228-
@ the first place, so there's no point checking the PSR I bit.
229-
bl trace_hardirqs_on
230-
#endif
231-
svc_exit r5 @ return from exception
219+
svc_exit r5, irq = 1 @ return from exception
232220
UNWIND(.fnend )
233221
ENDPROC(__irq_svc)
234222

@@ -305,12 +293,6 @@ __und_svc_finish:
305293
@ restore SPSR and restart the instruction
306294
@
307295
ldr r5, [sp, #S_PSR] @ Get SVC cpsr
308-
#ifdef CONFIG_TRACE_IRQFLAGS
309-
tst r5, #PSR_I_BIT
310-
bleq trace_hardirqs_on
311-
tst r5, #PSR_I_BIT
312-
blne trace_hardirqs_off
313-
#endif
314296
svc_exit r5 @ return from exception
315297
UNWIND(.fnend )
316298
ENDPROC(__und_svc)
@@ -325,13 +307,6 @@ __pabt_svc:
325307
@ IRQs off again before pulling preserved data off the stack
326308
@
327309
disable_irq_notrace
328-
329-
#ifdef CONFIG_TRACE_IRQFLAGS
330-
tst r5, #PSR_I_BIT
331-
bleq trace_hardirqs_on
332-
tst r5, #PSR_I_BIT
333-
blne trace_hardirqs_off
334-
#endif
335310
svc_exit r5 @ return from exception
336311
UNWIND(.fnend )
337312
ENDPROC(__pabt_svc)

‎arch/arm/kernel/entry-header.S‎

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,21 @@
7474
.endm
7575

7676
#ifndef CONFIG_THUMB2_KERNEL
77-
.macro svc_exit, rpsr
77+
.macro svc_exit, rpsr, irq = 0
78+
.if \irq != 0
79+
#ifdef CONFIG_TRACE_IRQFLAGS
80+
@ The parent context IRQs must have been enabled to get here in
81+
@ the first place, so there's no point checking the PSR I bit.
82+
bl trace_hardirqs_on
83+
#endif
84+
.else
85+
#ifdef CONFIG_TRACE_IRQFLAGS
86+
tst \rpsr, #PSR_I_BIT
87+
bleq trace_hardirqs_on
88+
tst \rpsr, #PSR_I_BIT
89+
blne trace_hardirqs_off
90+
#endif
91+
.endif
7892
msr spsr_cxsf, \rpsr
7993
#if defined(CONFIG_CPU_V6)
8094
ldr r0, [sp]
@@ -120,7 +134,21 @@
120134
mov pc, \reg
121135
.endm
122136
#else /* CONFIG_THUMB2_KERNEL */
123-
.macro svc_exit, rpsr
137+
.macro svc_exit, rpsr, irq = 0
138+
.if \irq != 0
139+
#ifdef CONFIG_TRACE_IRQFLAGS
140+
@ The parent context IRQs must have been enabled to get here in
141+
@ the first place, so there's no point checking the PSR I bit.
142+
bl trace_hardirqs_on
143+
#endif
144+
.else
145+
#ifdef CONFIG_TRACE_IRQFLAGS
146+
tst \rpsr, #PSR_I_BIT
147+
bleq trace_hardirqs_on
148+
tst \rpsr, #PSR_I_BIT
149+
blne trace_hardirqs_off
150+
#endif
151+
.endif
124152
ldr lr, [sp, #S_SP] @ top of the stack
125153
ldrd r0, r1, [sp, #S_LR] @ calling lr and pc
126154
clrex @ clear the exclusive monitor

0 commit comments

Comments
 (0)