public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Ilias Apalodimas <ilias.apalodimas@linaro.org>
To: Bin Meng <bmeng.cn@gmail.com>
Cc: Zong Li <zong.li@sifive.com>,
	Leo Yu-Chi Liang <ycliang@andestech.com>,
	Rick Chen <rick@andestech.com>,
	U-Boot Mailing List <u-boot@lists.denx.de>
Subject: Re: [PATCH v2] board: sifive: Fix a potential build warning in board_fdt_blob_setup()
Date: Wed, 29 Sep 2021 17:59:30 +0300	[thread overview]
Message-ID: <YVR/UlywmPSaAKfv@apalos.home> (raw)
In-Reply-To: <CAEUhbmXHZxzvfvVreWM0RJDtejuwdVHO5qwhUpH-2Meq-Ek3ng@mail.gmail.com>

[...]
> > >  int board_init(void)
> > > diff --git a/board/sifive/unmatched/unmatched.c b/board/sifive/unmatched/unmatched.c
> > > index d90b252bae..8773b660fa 100644
> > > --- a/board/sifive/unmatched/unmatched.c
> > > +++ b/board/sifive/unmatched/unmatched.c
> > > @@ -16,9 +16,9 @@ void *board_fdt_blob_setup(void)
> > >       if (IS_ENABLED(CONFIG_OF_SEPARATE)) {
> > >               if (gd->arch.firmware_fdt_addr)
> > >                       return (ulong *)gd->arch.firmware_fdt_addr;
> > > -             else
> > > -                     return (ulong *)&_end;
> > >       }
> > > +
> > > +     return (ulong *)&_end;
> >
> > is _end correct here? Doesn't the placement depend on CONFIG_SPL_BUILD and
> > CONFIG_SPL_SEPARATE_BSS?
> >
> 
> I will have to leave this to Zong to comment as he introduced this via
> commit 47d73ba4f4a4 ("board: sifive: overwrite board_fdt_blob_setup in
> u-boot proper").
> 
> I don't know what user case that Zong wanted to support on Unleased
> and Unmatched.

Okay.  The I think we can fix this correctly.  We can probably use OF_BOARD
in those boards,  as long as the SPL generated DTB is always there and
passed over to OpenSBI.

> 
> > To sum up the other thread I think the overall approach here is not ideal.
> > OF_SEPARATE is used in conjunction with SPL in these boards.  What happens
> > (assuming I didn't miss anything),  is that SPL passes the DTB to OpenSBI,
> > which in it turn copies to a1 before invoking U-Boot.
> > But we are better of with stricter rules for DTB.
> > - OF_SEPARATE means: I'll read the DTB from the U-Boot binary.
> > - OF_BOARD: The board will somehow provide it.
> >
> > So II think the patch should look something along the lines of:
> >
> > if (IS_ENABLED(CONFIG_OF_SEPARATE)) {
> > #ifdef CONFIG_SPL_BUILD
> >         /* FDT is at end of BSS unless it is in a different memory region */
> >         if (IS_ENABLED(CONFIG_SPL_SEPARATE_BSS))
> >                 fdt_blob = (void *)&_image_binary_end;
> >         else
> >                 fdt_blob = (void *)&__bss_end;
> > #else
> >         /* FDT is at end of image */
> >         fdt_blob = (void *)&_end;
> >
> 
> Missing #endif here?o

Yea it wasn't supposed to be real code.

> 
> > }
> >
> > if (IS_ENABLED(CONFIG_OF_BOARD)) {
> >         fdt_blob = (void *)gd->arch.firmware_fdt_addr;
> > }
> >
> > >  }
> > >
> > >  int board_init(void)
> > > --
> 
> Regards,
> Bin

Regards
/Ilias

      reply	other threads:[~2021-09-29 15:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-11 14:31 [PATCH v2] board: sifive: Fix a potential build warning in board_fdt_blob_setup() Bin Meng
2021-09-14  8:21 ` Leo Liang
     [not found] ` <HK0PR03MB299484FCB8C64939BB8F91E6C1DD9@HK0PR03MB2994.apcprd03.prod.outlook.com>
2021-09-17  6:52   ` Rick Chen
2021-10-11  3:13     ` Bin Meng
2021-09-29 13:07 ` Ilias Apalodimas
2021-09-29 14:03   ` Bin Meng
2021-09-29 14:59     ` Ilias Apalodimas [this message]

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=YVR/UlywmPSaAKfv@apalos.home \
    --to=ilias.apalodimas@linaro.org \
    --cc=bmeng.cn@gmail.com \
    --cc=rick@andestech.com \
    --cc=u-boot@lists.denx.de \
    --cc=ycliang@andestech.com \
    --cc=zong.li@sifive.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox