arch: arm: mpu: force outstanding transactions before MPU disabling

The ARMv8-M Memory Protection Unit document indicates that a DMB
instruction must be used before disabling the MPU in order to force
outstanding memory transactions.

The ARMv7-M documentation is less clear about that, and only specifies
that a DSB instruction followed by a ISB instruction must be used
before enabling the MPU, which is already the case. The ARMv7-M and
ARMv8-M MPU are relatively similar to believe the same sequence should
be used for disabling it.

This patch therefore adds a DMB instruction before disabling the MPU.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
This commit is contained in:
Aurelien Jarno 2018-11-07 20:49:44 +01:00 committed by Anas Nashif
commit 828ae6b8bc

View file

@ -72,6 +72,9 @@ void arm_core_mpu_enable(void)
*/
void arm_core_mpu_disable(void)
{
/* Force any outstanding transfers to complete before disabling MPU */
__DMB();
/* Disable MPU */
MPU->CTRL = 0;
}