arm64: fix mpu_freeregion

The limit register contains the enable/disable bit for the MPU region,
so it must be written first before writing the base register to ensure
proper region disable operation.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
This commit is contained in:
hujun5
2025-05-13 15:12:59 +08:00
committed by GUIDINGLI
parent 223230a9ed
commit 14e5d8a995
+6 -2
View File
@@ -187,10 +187,14 @@ void mpu_freeregion(unsigned int region)
write_sysreg(region, prselr_el1);
UP_DSB();
/* Set the region base, limit and attribute */
/* Set the region base, limit and attribute
* Have to set limit register first as the enable/disable bit of the
* region is in the limit register.
*/
write_sysreg(0, prbar_el1);
write_sysreg(0, prlar_el1);
write_sysreg(0, prbar_el1);
g_mpu_region[this_cpu()] &= ~(1 << region);
UP_MB();
}