Skip to content

Commit f53a1b6

Browse files
manish-pandey-armTrustedFirmware Code Review
authored andcommitted
Merge "refactor(el3_runtime): remove unnecessary assembly macros" into integration
2 parents e5d6cec + 76a91d8 commit f53a1b6

File tree

1 file changed

+24
-56
lines changed

1 file changed

+24
-56
lines changed

bl31/aarch64/runtime_exceptions.S

Lines changed: 24 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -82,31 +82,6 @@
8282
bl restore_gp_pmcr_pauth_regs
8383
1:
8484
#else
85-
/*
86-
* For SoCs which do not implement RAS, use DSB as a barrier to
87-
* synchronize pending external aborts.
88-
*/
89-
dsb sy
90-
91-
/* Unmask the SError interrupt */
92-
msr daifclr, #DAIF_ABT_BIT
93-
94-
/* Use ISB for the above unmask operation to take effect immediately */
95-
isb
96-
97-
/*
98-
* Refer Note 1. No need to restore X30 as both handle_sync_exception
99-
* and handle_interrupt_exception macro which follow this macro modify
100-
* X30 anyway.
101-
*/
102-
str x30, [sp, #CTX_GPREGS_OFFSET + CTX_GPREG_LR]
103-
mov x30, #1
104-
str x30, [sp, #CTX_EL3STATE_OFFSET + CTX_IS_IN_EL3]
105-
dmb sy
106-
#endif
107-
.endm
108-
109-
#if !RAS_EXTENSION
11085
/*
11186
* Note 1: The explicit DSB at the entry of various exception vectors
11287
* for handling exceptions from lower ELs can inadvertently trigger an
@@ -121,13 +96,9 @@
12196
* flag execute without causing further exceptions.
12297
*/
12398

124-
/* ---------------------------------------------------------------------
125-
* This macro handles Asynchronous External Aborts.
126-
* ---------------------------------------------------------------------
127-
*/
128-
.macro handle_async_ea
12999
/*
130-
* Use a barrier to synchronize pending external aborts.
100+
* For SoCs which do not implement RAS, use DSB as a barrier to
101+
* synchronize pending external aborts.
131102
*/
132103
dsb sy
133104

@@ -137,33 +108,16 @@
137108
/* Use ISB for the above unmask operation to take effect immediately */
138109
isb
139110

140-
/* Refer Note 1 */
111+
/*
112+
* Refer Note 1.
113+
* No need to restore X30 as macros following this modify x30 anyway.
114+
*/
141115
str x30, [sp, #CTX_GPREGS_OFFSET + CTX_GPREG_LR]
142116
mov x30, #1
143117
str x30, [sp, #CTX_EL3STATE_OFFSET + CTX_IS_IN_EL3]
144118
dmb sy
145-
146-
b handle_lower_el_async_ea
147-
.endm
148-
149-
/*
150-
* This macro checks if the exception was taken due to SError in EL3 or
151-
* because of pending asynchronous external aborts from lower EL that got
152-
* triggered due to explicit synchronization in EL3. Refer Note 1.
153-
*/
154-
.macro check_if_serror_from_EL3
155-
/* Assumes SP_EL3 on entry */
156-
str x30, [sp, #CTX_GPREGS_OFFSET + CTX_GPREG_LR]
157-
ldr x30, [sp, #CTX_EL3STATE_OFFSET + CTX_IS_IN_EL3]
158-
cbnz x30, exp_from_EL3
159-
160-
/* Handle asynchronous external abort from lower EL */
161-
b handle_lower_el_async_ea
162-
163-
exp_from_EL3:
164-
/* Jump to plat_handle_el3_ea which does not return */
165-
.endm
166119
#endif
120+
.endm
167121

168122
/* ---------------------------------------------------------------------
169123
* This macro handles Synchronous exceptions.
@@ -356,7 +310,19 @@ end_vector_entry fiq_sp_elx
356310

357311
vector_entry serror_sp_elx
358312
#if !RAS_EXTENSION
359-
check_if_serror_from_EL3
313+
/*
314+
* This will trigger if the exception was taken due to SError in EL3 or
315+
* because of pending asynchronous external aborts from lower EL that got
316+
* triggered due to explicit synchronization in EL3. Refer Note 1.
317+
*/
318+
/* Assumes SP_EL3 on entry */
319+
str x30, [sp, #CTX_GPREGS_OFFSET + CTX_GPREG_LR]
320+
ldr x30, [sp, #CTX_EL3STATE_OFFSET + CTX_IS_IN_EL3]
321+
cbnz x30, 1f
322+
323+
/* Handle asynchronous external abort from lower EL */
324+
b handle_lower_el_async_ea
325+
1:
360326
#endif
361327
no_ret plat_handle_el3_ea
362328
end_vector_entry serror_sp_elx
@@ -395,7 +361,8 @@ vector_entry serror_aarch64
395361
msr daifclr, #DAIF_ABT_BIT
396362
b enter_lower_el_async_ea
397363
#else
398-
handle_async_ea
364+
check_and_unmask_ea
365+
b handle_lower_el_async_ea
399366
#endif
400367
end_vector_entry serror_aarch64
401368

@@ -433,7 +400,8 @@ vector_entry serror_aarch32
433400
msr daifclr, #DAIF_ABT_BIT
434401
b enter_lower_el_async_ea
435402
#else
436-
handle_async_ea
403+
check_and_unmask_ea
404+
b handle_lower_el_async_ea
437405
#endif
438406
end_vector_entry serror_aarch32
439407

0 commit comments

Comments
 (0)