public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: marc.ceeeee@gmail.com (Marc Carino)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3] ARM: zImage: perform cache maintenance after relocating code (was: ARM: zImage: add DSB and ISB barriers after relocating code)
Date: Mon, 11 Aug 2014 17:35:47 -0700	[thread overview]
Message-ID: <1407803747-21379-1-git-send-email-marc.ceeeee@gmail.com> (raw)

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

             reply	other threads:[~2014-08-12  0:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-12  0:35 Marc Carino [this message]
2014-08-12  2:33 ` [PATCH v3] ARM: zImage: perform cache maintenance after relocating code (was: ARM: zImage: add DSB and ISB barriers after relocating code) Nicolas Pitre
2014-08-12  9:34 ` Russell King - ARM Linux

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1407803747-21379-1-git-send-email-marc.ceeeee@gmail.com \
    --to=marc.ceeeee@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox