* [PATCH] fixup! ARM: mmu32: Use pages for early MMU setup
@ 2023-05-22 5:20 Ahmad Fatoum
2023-05-22 8:18 ` Sascha Hauer
0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2023-05-22 5:20 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] fixup! ARM: mmu32: Use pages for early MMU setup
2023-05-22 5:20 [PATCH] fixup! ARM: mmu32: Use pages for early MMU setup Ahmad Fatoum
@ 2023-05-22 8:18 ` Sascha Hauer
0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2023-05-22 8:18 UTC (permalink / raw)
To: Ahmad Fatoum; +Cc: barebox
On Mon, May 22, 2023 at 07:20:54AM +0200, Ahmad Fatoum wrote:
> 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(-)
Applied, thanks
Sascha
>
> 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
>
>
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-05-22 8:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-22 5:20 [PATCH] fixup! ARM: mmu32: Use pages for early MMU setup Ahmad Fatoum
2023-05-22 8:18 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox