Skip to content

Commit 573a712

Browse files
JiafeiPankartben
authored andcommitted
arm64: reset: disable cache and MMU for safety
When Zephyr boot from EL2, D-Cache, I-Cache and MMU should be disabled by default, but in some cases, for example use U-Boot "go" command to boot Zephyr Image, Cache and MMU are already been enabled by U-Boot. So disable them at reset code to make it safety when the code goes into C code. Signed-off-by: Jiafei Pan <[email protected]>
1 parent b4f4528 commit 573a712

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

arch/arm64/core/reset.S

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,10 @@ SECTION_SUBSEC_FUNC(TEXT,_reset_section,__reset_prep_c)
5858
b out
5959
#endif /* CONFIG_ARMV8_R */
6060
2:
61-
/* Disable alignment fault checking */
61+
/* Disable alignment fault checking, disable D-Cache, I-Cache, MMU for safety */
6262
mrs x0, sctlr_el2
63-
bic x0, x0, SCTLR_A_BIT
63+
mov x1, #(SCTLR_A_BIT | SCTLR_C_BIT | SCTLR_M_BIT | SCTLR_I_BIT)
64+
bic x0, x0, x1
6465
msr sctlr_el2, x0
6566
isb
6667

0 commit comments

Comments
 (0)