On Thu, Feb 06, 2025 at 05:33:17AM -0700, Simon Glass wrote:
> Hi Tom,
> 
> On Mon, 3 Feb 2025 at 19:12, Tom Rini <tr...@konsulko.com> wrote:
> >
> > On Mon, Feb 03, 2025 at 05:38:44PM -0700, Simon Glass wrote:
> > > Hi Tom,
> > >
> > > On Mon, 3 Feb 2025 at 13:09, Tom Rini <tr...@konsulko.com> wrote:
> > > >
> > > > On Mon, Feb 03, 2025 at 10:42:08AM -0700, Simon Glass wrote:
> > > >
> > > > > The app does not have this symbol. Also the memory where the app is
> > > > > loaded is not under U-Boot's control. Disable this reservation for
> > > > > the EFI app.
> > > > >
> > > > > Signed-off-by: Simon Glass <s...@chromium.org>
> > > > > ---
> > > > >
> > > > >  lib/lmb.c | 3 ++-
> > > > >  1 file changed, 2 insertions(+), 1 deletion(-)
> > > > >
> > > > > diff --git a/lib/lmb.c b/lib/lmb.c
> > > > > index 588787d2a90..420eae4d0b8 100644
> > > > > --- a/lib/lmb.c
> > > > > +++ b/lib/lmb.c
> > > > > @@ -560,7 +560,8 @@ static void lmb_reserve_uboot_region(void)
> > > > >               lmb_reserve_flags(rsv_start, bank_end - rsv_start + 1,
> > > > >                                 LMB_NOOVERWRITE);
> > > > >
> > > > > -             if (gd->flags & GD_FLG_SKIP_RELOC)
> > > > > +             if (!IS_ENABLED(CONFIG_EFI_APP) &&
> > > > > +                 (gd->flags & GD_FLG_SKIP_RELOC))
> > > > >                       
> > > > > lmb_reserve_flags((phys_addr_t)(uintptr_t)_start,
> > > > >                                         gd->mon_len, LMB_NOOVERWRITE);
> > > >
> > > > What prevents U-Boot from overwriting itself, with U-Boot commands? Also
> > > > how is this linking today? I see lmb_reserve_uboot_region in
> > > > efi-x86_app64 for example.
> > >
> > > The only memory U-Boot can use when running as an EFI app is that
> > > which it has allocated using EFI calls. The actual U-Boot code is
> > > certainly in memory somewhere, but does not lie between gd->ram_start
> > > and (gd->ram_start + gd->ram_size)
> >
> > That's not what the commit message means to me. But the next question
> > is, is EFI_APP setting SKIP_RELOC?
> 
> Yes, there is no sense in relocating from one alloced region to
> another. U-Boot is not able to relocate to the top of memory, nor
> decide what other parts of memory are used for. This is in the nature
> of EFI, after all. We have an API, but not policy.

With a commit message that explains that EFI_APP skips relocation and so
isn't at the address pointed to by the _start symbol:

Reviewed-by: Tom Rini <tr...@konsulko.com>

-- 
Tom

Attachment: signature.asc
Description: PGP signature

Reply via email to