Skip to content

Commit f7694d7

Browse files
committed
Fixup the boot EL check
The boot EL will save in x0, when current EL is EL3, kernel will jump to the EL2 after EL3. But the x0 value is **3**, The init for EL2 will not work. To fix it: the EL3 should jump to the EL2 init branch with not check, and when SoC boot in EL2, kernel will jump to the EL2 test branch. Link: https://club.rt-thread.org/ask/question/ec320a6765389f67.html Signed-off-by: wusongjie <[email protected]>
1 parent a894796 commit f7694d7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

libcpu/aarch64/cortex-a/entry_point.S

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,13 +180,12 @@ init_cpu_el:
180180

181181
/* running at EL3? */
182182
cmp x0, #3
183-
bne .init_cpu_hyp
183+
bne .init_cpu_hyp_test
184184

185185
/* should never be executed, just for completeness. (EL3) */
186186
mov x1, #(1 << 0) /* EL0 and EL1 are in Non-Secure state */
187187
orr x1, x1, #(1 << 4) /* RES1 */
188188
orr x1, x1, #(1 << 5) /* RES1 */
189-
/* bic x1, x1, #(1 << 7) disable Secure Monitor Call */
190189
orr x1, x1, #(1 << 10) /* The next lower level is AArch64 */
191190
msr scr_el3, x1
192191

@@ -201,11 +200,12 @@ init_cpu_el:
201200
msr elr_el3, x1
202201
eret
203202

204-
.init_cpu_hyp:
203+
.init_cpu_hyp_test:
205204
/* running at EL2? */
206205
cmp x0, #2 /* EL2 = 0b10 */
207206
bne .init_cpu_sys
208207

208+
.init_cpu_hyp:
209209
/* Enable CNTP for EL1 */
210210
mrs x0, cnthctl_el2 /* Counter-timer Hypervisor Control register */
211211
orr x0, x0, #(1 << 0) /* Don't traps NS EL0/1 accesses to the physical counter */

0 commit comments

Comments
 (0)