[PATCH] Revert "efi_memory: do not add U-Boot memory to the memory map"
Ilias Apalodimas
ilias.apalodimas at linaro.org
Wed Nov 13 12:28:31 CET 2024
Hi Sughosh
On Tue, 12 Nov 2024 at 20:46, Sughosh Ganu <sughosh.ganu at linaro.org> wrote:
>
> On Tue, 12 Nov 2024 at 18:48, Simon Glass <sjg at chromium.org> wrote:
> >
> > A bisect of Ubuntu 2022.04 boot-failure on qemu-x86_64 resulted in this
> > patch. I am not sure how to investigate it.
> >
> > The boot hangs at some point during booting of the install image, before
> > the Ubuntu logo appears.
> >
> > I will sent a series with a script showing how it is run.
> >
> > This reverts commit a68c9ac5d8afc51c619c5d3e865fcf147bea90cb.
> >
> > Signed-off-by: Simon Glass <sjg at chromium.org>
> > ---
>
> This seems to be an issue specific to the x86 architecture. The
> installation works on arm64 and riscv (confirmed by Heinrich)
> architectures. I checked the output of the EFI memory map with the
> above commit against the master branch, and the only difference is
> that with this revert, the EFI memory map has the u-boot memory region
> marked as EFI_BOOT_SERVICES_CODE, whereas without this commit, that
> region is marked as reserved.
Hmm why? LMB is adding this with EFI_BOOT_SERVICES_CODE in
lmb_map_update_notify(). Who's switching it to reserved?
This is a pretty big change since the memory switches from reusable to
reserved for the OS.
> I need to look into this in more detail,
> but it would seem like the x86 kernel (or some efi stub code ?) is
> expecting some region of memory marked as EFI_BOOT_SERVICES_CODE,
> which is not the case for other architectures.
Not EFI_BOOT_SERVICES_CODE explicitly, probably just a reusable type of memory.
Cheers
/Ilias
>
> -sughosh
>
> >
> > lib/efi_loader/efi_memory.c | 10 ++++++++++
> > 1 file changed, 10 insertions(+)
> >
> > diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
> > index d2f5d563f2a..c7400ec9854 100644
> > --- a/lib/efi_loader/efi_memory.c
> > +++ b/lib/efi_loader/efi_memory.c
> > @@ -809,6 +809,16 @@ static void add_u_boot_and_runtime(void)
> > {
> > unsigned long runtime_start, runtime_end, runtime_pages;
> > unsigned long runtime_mask = EFI_PAGE_MASK;
> > + unsigned long uboot_start, uboot_pages;
> > + unsigned long uboot_stack_size = CONFIG_STACK_SIZE;
> > +
> > + /* 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;
> > + efi_add_memory_map_pg(uboot_start, uboot_pages, EFI_BOOT_SERVICES_CODE,
> > + false);
> >
> > #if defined(__aarch64__)
> > /*
> > --
> > 2.34.1
> >
More information about the U-Boot
mailing list