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: mfe@pengutronix.de, Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 1/2] ARM: mmu64: mark barebox text section executable during early init
Date: Thu,  7 Sep 2023 10:21:25 +0200	[thread overview]
Message-ID: <20230907082126.2326381-2-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20230907082126.2326381-1-a.fatoum@pengutronix.de>

barebox on ARM64 is usually relocated to DRAM by the time mmu_early_enable()
is called, but in the future we may want to enable the MMU earlier and thus
we need to ensure that the location barebox is currently running from is not
marked eXecute Never, even if it's outside the initially known RAM bank.

This is the first part of fixing barebox hanging on i.MX8M when located
at an address greater than 4G.

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

diff --git a/arch/arm/cpu/mmu_64.c b/arch/arm/cpu/mmu_64.c
index 63e70963224a..3124f8f3a987 100644
--- a/arch/arm/cpu/mmu_64.c
+++ b/arch/arm/cpu/mmu_64.c
@@ -289,6 +289,7 @@ void mmu_early_enable(unsigned long membase, unsigned long memsize)
 	early_remap_range(0, 1UL << (BITS_PER_VA - 1), MAP_UNCACHED);
 	early_remap_range(membase, memsize - OPTEE_SIZE, MAP_CACHED);
 	early_remap_range(membase + memsize - OPTEE_SIZE, OPTEE_SIZE, MAP_FAULT);
+	early_remap_range(PAGE_ALIGN_DOWN((uintptr_t)_stext), PAGE_ALIGN(_etext - _stext), MAP_CACHED);
 
 	mmu_enable();
 }
-- 
2.39.2




  reply	other threads:[~2023-09-07  8:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-07  8:21 [PATCH 0/2] console: pbl: correctly handle relocate_to_adr after pbl_set_putc Ahmad Fatoum
2023-09-07  8:21 ` Ahmad Fatoum [this message]
2023-09-07  8:21 ` [PATCH 2/2] " Ahmad Fatoum
2023-09-08  6:58 ` [PATCH 0/2] " 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=20230907082126.2326381-2-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=mfe@pengutronix.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