public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: your name <yurovsky@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] bootm: flush cache on aligned region
Date: Wed, 20 Dec 2017 09:12:28 -0800	[thread overview]
Message-ID: <20171220171228.16270-1-yurovsky@gmail.com> (raw)

From: Andrey Yurovsky <yurovsky@gmail.com>

bootm_load_os() uses flush_cache() on the region where the OS image is
loaded however the OS image may be part of a FIT image and thereby may
not be aligned with respect to the machine's cache lines. Give
flush_cache() an aligned start of the region to avoid misalignment.

Signed-off-by: Andrey Yurovsky <yurovsky@gmail.com>
---
 common/bootm.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/common/bootm.c b/common/bootm.c
index adb12137c7..948807af25 100644
--- a/common/bootm.c
+++ b/common/bootm.c
@@ -447,7 +447,10 @@ static int bootm_load_os(bootm_headers_t *images, unsigned long *load_end,
 		bootstage_error(BOOTSTAGE_ID_DECOMP_IMAGE);
 		return err;
 	}
-	flush_cache(load, ALIGN(*load_end - load, ARCH_DMA_MINALIGN));
+
+	ulong load_a = ALIGN(load, ARCH_DMA_MINALIGN);
+
+	flush_cache(load_a, ALIGN(*load_end - load_a, ARCH_DMA_MINALIGN));
 
 	debug("   kernel loaded at 0x%08lx, end = 0x%08lx\n", load, *load_end);
 	bootstage_mark(BOOTSTAGE_ID_KERNEL_LOADED);
-- 
2.14.3

             reply	other threads:[~2017-12-20 17:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-20 17:12 your name [this message]
2017-12-21  7:18 ` [U-Boot] [PATCH] bootm: flush cache on aligned region Lothar Waßmann

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=20171220171228.16270-1-yurovsky@gmail.com \
    --to=yurovsky@gmail.com \
    --cc=u-boot@lists.denx.de \
    /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