mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH] fixup! ARM: mmu32: Use pages for early MMU setup
Date: Mon, 22 May 2023 07:20:54 +0200	[thread overview]
Message-ID: <20230522052054.1037494-1-a.fatoum@pengutronix.de> (raw)

ARM: mmu32: fix alignment when early remapping .text section

arch_remap_range has a BUG_ON unaligned memory region start. On AM335x
(Tested with Beaglebone Black), _stext for the second stage barebox.bin
is not page-aligned, so this broke the boot. Use PAGE_ALIGN_DOWN to fix
this.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/cpu/mmu_32.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/cpu/mmu_32.c b/arch/arm/cpu/mmu_32.c
index dc4b0e414d57..852c5626dedd 100644
--- a/arch/arm/cpu/mmu_32.c
+++ b/arch/arm/cpu/mmu_32.c
@@ -583,7 +583,7 @@ void mmu_early_enable(unsigned long membase, unsigned long memsize)
 	/* maps main memory as cachable */
 	arch_remap_range((void *)membase, memsize - OPTEE_SIZE, MAP_CACHED);
 	arch_remap_range((void *)membase + memsize - OPTEE_SIZE, OPTEE_SIZE, MAP_UNCACHED);
-	arch_remap_range(_stext, PAGE_ALIGN(_etext - _stext), MAP_CACHED);
+	arch_remap_range((void *)PAGE_ALIGN_DOWN((uintptr_t)_stext), PAGE_ALIGN(_etext - _stext), MAP_CACHED);
 
 	__mmu_cache_on();
 }
-- 
2.39.2




             reply	other threads:[~2023-05-22  5:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-22  5:20 Ahmad Fatoum [this message]
2023-05-22  8:18 ` Sascha Hauer

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=20230522052054.1037494-1-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@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