arm64: mmu: invalidate all data caches before enable them
Datas in data cache are dirty before data caches are enabled, so need to invalidate all data caches firstly before enable them. Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
This commit is contained in:
parent
7b7035231f
commit
a89cb1cc13
1 changed files with 4 additions and 0 deletions
|
@ -7,6 +7,7 @@
|
|||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <cache.h>
|
||||
#include <device.h>
|
||||
#include <init.h>
|
||||
#include <kernel.h>
|
||||
|
@ -762,6 +763,9 @@ static void enable_mmu_el1(struct arm_mmu_ptables *ptables, unsigned int flags)
|
|||
/* Ensure these changes are seen before MMU is enabled */
|
||||
isb();
|
||||
|
||||
/* Invalidate all data caches before enable them */
|
||||
sys_dcache_all(K_CACHE_INVD);
|
||||
|
||||
/* Enable the MMU and data cache */
|
||||
val = read_sctlr_el1();
|
||||
write_sctlr_el1(val | SCTLR_M_BIT | SCTLR_C_BIT);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue