[PATCH v2 4/4] common: Allow relocations on the top of the last bank

Ilias Apalodimas ilias.apalodimas at linaro.org
Wed Apr 1 08:45:53 CEST 2026


On Wed, 1 Apr 2026 at 01:01, Marek Vasut <marek.vasut at mailbox.org> wrote:
>
> On 3/31/26 10:01 AM, Ilias Apalodimas wrote:
>
> [...]
>
> > @@ -321,6 +323,19 @@ __weak phys_addr_t board_get_usable_ram_top(phys_size_t total_size)
> >                */
> >               return 0;
> >   #endif
> > +     if (IS_ENABLED(CONFIG_RELOCATE_LAST_BANK)) {
> > +             phys_addr_t old_top = gd->ram_top;
> > +
> > +             ret = fdtdec_setup_mem_ram_top();
> > +             if (ret)
> > +                     debug("failed to relocate to ram top");
> > +             ret = fdtdec_setup_ram_size();
> > +             if (ret) {
> > +                     debug("failed to calculate RAM size");
> > +                     gd->ram_top = old_top;
> This changes ram_size , why is this restoring ram_top ?

Because the actions of calculating a ram_top and ram_size should be
bundled together imho. You are effectively calculating how much ram i
have available and where should i relocate.
So if one fails, the other should be restored.

> Should this also restore gd->ram_size ?

fdtdec_setup_ram_size() already does that in case it fails.

Cheers
/Ilias


More information about the U-Boot mailing list