[U-Boot] [PATCH] ARM: non-sec: flush code cacheline aligned

From: Stefan Agner stefan.agner@toradex.com
Flush operations need to be cacheline aligned to take effect, make sure to flush always complete cachelines. This avoids messages such as: CACHE: Misaligned operation at range [00900000, 009004d9]
Signed-off-by: Stefan Agner stefan.agner@toradex.com ---
arch/arm/cpu/armv7/virt-v7.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/arm/cpu/armv7/virt-v7.c b/arch/arm/cpu/armv7/virt-v7.c index 9c53306..d33e5c6 100644 --- a/arch/arm/cpu/armv7/virt-v7.c +++ b/arch/arm/cpu/armv7/virt-v7.c @@ -54,10 +54,12 @@ static void relocate_secure_section(void) { #ifdef CONFIG_ARMV7_SECURE_BASE size_t sz = __secure_end - __secure_start; + unsigned long szflush = ALIGN(sz + 1, CONFIG_SYS_CACHELINE_SIZE);
memcpy((void *)CONFIG_ARMV7_SECURE_BASE, __secure_start, sz); + flush_dcache_range(CONFIG_ARMV7_SECURE_BASE, - CONFIG_ARMV7_SECURE_BASE + sz + 1); + CONFIG_ARMV7_SECURE_BASE + szflush); protect_secure_section(); invalidate_icache_all(); #endif

Hi Stefan,
On Wed, Aug 3, 2016 at 5:08 PM, Stefan Agner stefan@agner.ch wrote:
From: Stefan Agner stefan.agner@toradex.com
Flush operations need to be cacheline aligned to take effect, make sure to flush always complete cachelines. This avoids messages such as: CACHE: Misaligned operation at range [00900000, 009004d9]
Signed-off-by: Stefan Agner stefan.agner@toradex.com
This fixes the cache warnings:
Tested-by: Fabio Estevam fabio.estevam@nxp.com
Thanks

On Wed, Aug 03, 2016 at 01:08:55PM -0700, Stefan Agner wrote:
From: Stefan Agner stefan.agner@toradex.com
Flush operations need to be cacheline aligned to take effect, make sure to flush always complete cachelines. This avoids messages such as: CACHE: Misaligned operation at range [00900000, 009004d9]
Signed-off-by: Stefan Agner stefan.agner@toradex.com Tested-by: Fabio Estevam fabio.estevam@nxp.com
Applied to u-boot/master, thanks!
participants (3)
-
Fabio Estevam
-
Stefan Agner
-
Tom Rini