Skip to content

Commit a7a49c5

Browse files
danielRepmiguelafsilva5
authored andcommitted
fix(mpu): perform RMW and inst barrier on mpu enable
Signed-off-by: Daniel Oliveira <[email protected]>
1 parent cfe1677 commit a7a49c5

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/arch/armv8/armv8-r/aarch32/boot.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ boot_arch_profile_init:
5050
/* r4 contains the id of the MPU entry being used */
5151
mov r4, #(-1)
5252

53-
/* Enable caches and MPU */
53+
/* Enable caches */
5454
ldr r4, =(SCTLR_RES1_AARCH32 | SCTLR_C | SCTLR_I)
5555
mcr p15, 4, r4, c1, c0, 0 // HSCTLR
5656

src/arch/armv8/armv8-r/mpu.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,13 @@ bool mpu_perms_compatible(unsigned long perms1, unsigned long perms2)
199199

200200
void mpu_enable(void)
201201
{
202-
sysreg_sctlr_el2_write(SCTLR_M);
202+
unsigned long reg_val;
203+
204+
reg_val = sysreg_sctlr_el2_read();
205+
reg_val |= SCTLR_M;
206+
sysreg_sctlr_el2_write(reg_val);
207+
208+
ISB();
203209
}
204210

205211
void mpu_init()

0 commit comments

Comments
 (0)