[PATCH 6/6] memory: reserve from start_addr_sp to relocaddr
Ilias Apalodimas
ilias.apalodimas at linaro.org
Thu Apr 2 11:21:19 CEST 2026
On Thu, 2 Apr 2026 at 03:14, <rs at ti.com> wrote:
>
> From: Randolph Sapp <rs at ti.com>
>
> Reserve the memory from gd->start_addr_sp - CONFIG_STACK_SIZE to
> gd->relocaddr instead of gd->ram_top. This allows platform specific
> relocation addresses to work without unnecessarily painting over a large
> range.
This hangs when trying to boot with UEFI on QEMU aarch64.
With the qemu_arm64_lwip_defconfig and this command line
qemu-system-aarch64 -m 8192 -smp 2 -nographic -cpu cortex-a57 \
-machine virt,secure=off \
-bios u-boot.bin \
-device virtio-rng-pci \
-drive id=os,if=none,file=my.iso \
-device virtio-blk-device,drive=os \
-object memory-backend-ram,id=ram0,size=4G \
-object memory-backend-ram,id=ram1,size=4G \
-numa node,memdev=ram0 \
-numa node,memdev=ram1
It also hangs when trying to initialize the EFI subsystem in general,
e.g 'efidebug memmap', probably because some EFI code is relocated on
the region you exlcuded.
Thanks
/Ilias
>
> Signed-off-by: Randolph Sapp <rs at ti.com>
> ---
> lib/efi_loader/efi_memory.c | 4 ++--
> lib/lmb.c | 2 +-
> 2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
> index f07cc39b157..57691d15758 100644
> --- a/lib/efi_loader/efi_memory.c
> +++ b/lib/efi_loader/efi_memory.c
> @@ -915,8 +915,8 @@ static void add_u_boot_and_runtime(void)
> /* Add U-Boot */
> uboot_start = ((uintptr_t)map_sysmem(gd->start_addr_sp, 0) -
> uboot_stack_size) & ~EFI_PAGE_MASK;
> - uboot_pages = ((uintptr_t)map_sysmem(gd->ram_top - 1, 0) -
> - uboot_start + EFI_PAGE_MASK) >> EFI_PAGE_SHIFT;
> + uboot_pages = ((gd->relocaddr - uboot_start) + EFI_PAGE_MASK) >>
> + EFI_PAGE_SHIFT;
> efi_update_memory_map(uboot_start, uboot_pages, EFI_BOOT_SERVICES_CODE,
> false, false);
> #if defined(__aarch64__)
> diff --git a/lib/lmb.c b/lib/lmb.c
> index 542bb11dcf5..0df8157db7f 100644
> --- a/lib/lmb.c
> +++ b/lib/lmb.c
> @@ -540,7 +540,7 @@ static void lmb_reserve_uboot_region(void)
> ulong pram = 0;
>
> rsv_start = gd->start_addr_sp - CONFIG_STACK_SIZE;
> - end = gd->ram_top;
> + end = gd->relocaddr;
>
> /*
> * Reserve memory from aligned address below the bottom of U-Boot stack
> --
> 2.53.0
>
More information about the U-Boot
mailing list