All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: Devarsh Thakkar <devarsht@ti.com>
Cc: u-boot@lists.denx.de, agust@denx.de, trini@konsulko.com,
	 bmeng.cn@gmail.com, msuchanek@suse.de,
	rasmus.villemoes@prevas.dk,  yangshiji66@outlook.com,
	praneeth@ti.com, nm@ti.com, vigneshr@ti.com,  a-bhatia1@ti.com,
	j-luthra@ti.com, nsekhar@ti.com, n-jain1@ti.com
Subject: Re: [PATCH v2 3/6] common/board_f: Catch bloblist before starting resevations
Date: Sun, 12 Nov 2023 13:01:19 -0700	[thread overview]
Message-ID: <CAPnjgZ1--+PBECK7UhWbsCyaUDMKL8LRm3sQnOz8YZsJdpHC6w@mail.gmail.com> (raw)
In-Reply-To: <20231110152944.647535-4-devarsht@ti.com>

On Fri, 10 Nov 2023 at 08:29, Devarsh Thakkar <devarsht@ti.com> wrote:
>
> Start reservations needed for init sequence only after catching
> bloblists from previous stage.
>
> This is to avoid catching bloblists in the middle causing
> gaps while u-boot is reserving.
>
> Adjust the relocaddr as per video hand-off information
> received from previous stage so that further reservations
> start only after regions reserved for previous stages
>
> Skip reservation for video memory if it was already
> filled by a bloblist.
>
> Signed-off-by: Devarsh Thakkar <devarsht@ti.com>
> ---
> V2: Fix typo in commit title and checkpatch warnings/checks
> V3: No change
> ---
>  common/board_f.c | 33 ++++++++++++++++++++++++++++++---
>  1 file changed, 30 insertions(+), 3 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>


>
> diff --git a/common/board_f.c b/common/board_f.c
> index d4d7d01f8f..acf802c9cb 100644
> --- a/common/board_f.c
> +++ b/common/board_f.c
> @@ -403,7 +403,7 @@ __weak int arch_reserve_mmu(void)
>         return 0;
>  }
>
> -static int reserve_video(void)
> +static int reserve_video_from_videoblob(void)
>  {
>         if (IS_ENABLED(CONFIG_SPL_VIDEO_HANDOFF) && spl_phase() > PHASE_SPL) {
>                 struct video_handoff *ho;
> @@ -412,8 +412,34 @@ static int reserve_video(void)
>                 if (!ho)
>                         return log_msg_ret("blf", -ENOENT);
>                 video_reserve_from_bloblist(ho);
> -               gd->relocaddr = ho->fb;
> -       } else if (CONFIG_IS_ENABLED(VIDEO)) {
> +
> +               /* Sanity check fb from blob is before current relocaddr */
> +               if (likely(gd->relocaddr > (unsigned long)ho->fb))
> +                       gd->relocaddr = ho->fb;
> +       }
> +
> +       return 0;
> +}
> +
> +/*
> + * Check if any bloblist received specifying reserved areas from previous stage and adjust
> + * gd->relocaddr accordingly, so that we start reserving after pre-reserved areas
> + * from previous stage.
> + *
> + * NOTE:
> + * IT is recommended that all bloblists from previous stage are reserved from ram_top
> + * as next stage will simply start reserving further regions after them.
> + */
> +static int setup_relocaddr_from_bloblist(void)
> +{
> +       reserve_video_from_videoblob();
> +
> +       return 0;
> +}
> +
> +static int reserve_video(void)
> +{
> +       if (CONFIG_IS_ENABLED(VIDEO)) {
>                 ulong addr;
>                 int ret;
>
> @@ -923,6 +949,7 @@ static const init_fnc_t init_sequence_f[] = {
>         reserve_pram,
>  #endif
>         reserve_round_4k,
> +       setup_relocaddr_from_bloblist,
>         arch_reserve_mmu,
>         reserve_video,
>         reserve_trace,
> --
> 2.34.1
>

  reply	other threads:[~2023-11-12 20:03 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-10 15:29 [PATCH v2 0/6] Move framebuffer reservation for SPL to RAM end Devarsh Thakkar
2023-11-10 15:29 ` [PATCH v2 1/6] arm: mach-k3: common: Reserve video memory from end of the RAM Devarsh Thakkar
2023-11-12 20:01   ` Simon Glass
2023-12-05 11:33   ` Nikhil Jain
2023-11-10 15:29 ` [PATCH v2 2/6] board: ti: am62x: evm: Remove video_setup from spl_board_init Devarsh Thakkar
2023-11-12 20:01   ` Simon Glass
2023-11-10 15:29 ` [PATCH v2 3/6] common/board_f: Catch bloblist before starting resevations Devarsh Thakkar
2023-11-12 20:01   ` Simon Glass [this message]
2023-11-10 15:29 ` [PATCH v2 4/6] video: Skip framebuffer reservation if already reserved Devarsh Thakkar
2023-11-12 20:01   ` Simon Glass
2023-11-10 15:29 ` [PATCH v2 5/6] video: Fill video handoff in video post probe Devarsh Thakkar
2023-11-12 20:01   ` Simon Glass
2023-11-25 14:27     ` Devarsh Thakkar
2023-12-02 18:23       ` Simon Glass
2023-12-05 10:11         ` Devarsh Thakkar
2023-11-10 15:29 ` [PATCH v2 6/6] doc: spl: Add info regarding memory reservation and missing Kconfigs Devarsh Thakkar
2023-11-12 20:01   ` Simon Glass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAPnjgZ1--+PBECK7UhWbsCyaUDMKL8LRm3sQnOz8YZsJdpHC6w@mail.gmail.com \
    --to=sjg@chromium.org \
    --cc=a-bhatia1@ti.com \
    --cc=agust@denx.de \
    --cc=bmeng.cn@gmail.com \
    --cc=devarsht@ti.com \
    --cc=j-luthra@ti.com \
    --cc=msuchanek@suse.de \
    --cc=n-jain1@ti.com \
    --cc=nm@ti.com \
    --cc=nsekhar@ti.com \
    --cc=praneeth@ti.com \
    --cc=rasmus.villemoes@prevas.dk \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=vigneshr@ti.com \
    --cc=yangshiji66@outlook.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.