[PATCH 1/2] ARM: mmu64: mark barebox text section executable during early init

Ahmad Fatoum a.fatoum at pengutronix.de
Thu Sep 7 01:21:25 PDT 2023

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 at 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);

More information about the barebox mailing list