public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH v3] ARM: zImage: perform cache maintenance after relocating code (was: ARM: zImage: add DSB and ISB barriers after relocating code)
@ 2014-08-12  0:35 Marc Carino
  2014-08-12  2:33 ` Nicolas Pitre
  2014-08-12  9:34 ` Russell King - ARM Linux
  0 siblings, 2 replies; 3+ messages in thread
From: Marc Carino @ 2014-08-12  0:35 UTC (permalink / raw)
  To: linux-arm-kernel

The zImage loader will relocate the kernel image if it determines that
decompression will overwrite its current location. Since the act of relocation
is a form of code self-modification, we need to ensure that the CPU fetches
the updated instruction stream.

Instead of conditionally executing cache maintenance, this commit ensures that
cache maintenance is performed in all cases. Besides ensuring coherency with
the caches and main memory, performing cache maintenance ensures that any
potentially stale instructions are flushed from the instruction pipeline.

Signed-off-by: Marc Carino <marc.ceeeee@gmail.com>
---
 arch/arm/boot/compressed/head.S | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S
index 3a8b32d..8a39054 100644
--- a/arch/arm/boot/compressed/head.S
+++ b/arch/arm/boot/compressed/head.S
@@ -395,8 +395,7 @@ dtb_check_done:
 		add	sp, sp, r6
 #endif
 
-		tst	r4, #1
-		bleq	cache_clean_flush
+		bl	cache_clean_flush
 
 		adr	r0, BSYM(restart)
 		add	r0, r0, r6
-- 
1.8.1.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-08-12  9:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-12  0:35 [PATCH v3] ARM: zImage: perform cache maintenance after relocating code (was: ARM: zImage: add DSB and ISB barriers after relocating code) Marc Carino
2014-08-12  2:33 ` Nicolas Pitre
2014-08-12  9:34 ` Russell King - ARM Linux

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox