arm64: cache: fix arch_dcache_all()

Add data barrier before and after dcachle flush or clean,
and restore to data cache level 0 after all ops.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
This commit is contained in:
Jiafei Pan 2021-04-29 11:17:20 +08:00 committed by Carles Cufí
commit 4a87c08606

View file

@ -110,6 +110,9 @@ int arch_dcache_all(int op)
if (op != K_CACHE_INVD && op != K_CACHE_WB && op != K_CACHE_WB_INVD)
return -ENOTSUP;
/* Data barrier before start */
dsb();
clidr_el1 = read_clidr_el1();
loc = (clidr_el1 >> CLIDR_EL1_LOC_SHIFT) & CLIDR_EL1_LOC_MASK;
@ -157,5 +160,11 @@ int arch_dcache_all(int op)
}
}
}
/* Restore csselr_el1 to level 0 */
write_csselr_el1(0);
dsb();
isb();
return 0;
}