All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ilias Apalodimas <ilias.apalodimas@linaro.org>
To: Simon Glass <sjg@chromium.org>
Cc: U-Boot Mailing List <u-boot@lists.denx.de>,
	Mark Kettenis <mark.kettenis@xs4all.nl>,
	 Heinrich Schuchardt <xypron.glpk@gmx.de>,
	Tom Rini <trini@konsulko.com>,  Sean Anderson <seanga2@gmail.com>,
	Jerry Van Baren <vanbaren@cideas.com>
Subject: Re: [PATCH v5 26/26] fdt: Don't call board_fdt_blob_setup() without OF_BOARD
Date: Wed, 27 Oct 2021 10:17:05 +0300	[thread overview]
Message-ID: <CAC_iWjKtds0r-H1qPADgBE8p6yDCTqNvHexYe4nVDy-=aKG82g@mail.gmail.com> (raw)
In-Reply-To: <CAPnjgZ3mR8hWCAjN9egg7f+w1AiDp7LiYtQx8_mtKxus0ZvWPA@mail.gmail.com>

Hi Simon,

On Tue, 26 Oct 2021 at 18:27, Simon Glass <sjg@chromium.org> wrote:
>
> Hi Ilias,
>
> On Tue, 26 Oct 2021 at 07:56, Ilias Apalodimas
> <ilias.apalodimas@linaro.org> wrote:
> >
> > Hi Simon,
> >
> > As I said here [1], this is moving on an entirely different direction I had
> > in mind. I'd much prefer starting the discussions for a solution that
> > allows us to scale.
>
> I am missing the point here. Is there something in the plans that I
> don't know about?

I have some ideas, but haven't found time to code it and send patches yet.

>
> > FWIW I think the current code is still not clean for my taste.  Commit
> > 3b595da441cf ("fdtdec: allow board to provide fdt for CONFIG_OF_SEPARATE")
> > allowed this function to be used regardless of the config options.  IMHO we
> > should have 2 clear options:
> > - U-Boot provides the DTB
>
> Supported with: OF_SEPARATE
>
> > - It's somehow passed over to U-Boot
>
> Supported with: OF_SEPARATE + OF_BOARD

That's exactly what I don't personally like. In your example OF_BOARD
means "U-Boot has a DTB and here's a way to override it".  In my head
that options means "U-Boot was handed over a DTB on a register and it
must be able to deal with it".  The latter is obviously less
restrictive to previous bootloaders.

>
> I actually hit this problem with my qemu testing, in that it is
> actually not possible to use U-Boot's devicetree without hacking the
> code. We need to be able to select this feature explicitly, or turn it
> off, at least for development.

Alternatively we can just keep U-Boot config node in a .dtbo and apply
it on the fly after QEMU has handed us over the DTB it created.

Regards
/Ilias
>
> Regards,
> Simon
>
>
> >
> > On Mon, Oct 25, 2021 at 06:23:44PM -0600, Simon Glass wrote:
> > > At present this override function is called even when OF_BOARD Is not
> > > enabled. This makes it impossible to disable this feature and in fact
> > > makes the OF_BOARD option useless.
> > >
> > > Reinstate its intended purpose, so that it is possible to switch between
> > > the appended devicetree and one provided by the board's custom function.
> > >
> > > Signed-off-by: Simon Glass <sjg@chromium.org>
> > > ---
> > >
> > > Changes in v5:
> > > - Add new patches to clean up fdtdec_setup() and surrounds
> > >
> > >  include/fdtdec.h |  7 +++++--
> > >  lib/fdtdec.c     | 17 +++++++++++------
> > >  2 files changed, 16 insertions(+), 8 deletions(-)
> > >
> > > diff --git a/include/fdtdec.h b/include/fdtdec.h
> > > index 386f6611294..b2faa84008e 100644
> > > --- a/include/fdtdec.h
> > > +++ b/include/fdtdec.h
> > > @@ -1170,8 +1170,11 @@ int fdtdec_resetup(int *rescan);
> > >
> > >  /**
> > >   * Board-specific FDT initialization. Returns the address to a device tree blob.
> > > - * Called when CONFIG_OF_BOARD is defined, or if CONFIG_OF_SEPARATE is defined
> > > - * and the board implements it.
> > > + * Called when CONFIG_OF_BOARD is defined.
> > > + *
> > > + * The existing devicetree is available at gd->fdt_blob
> > > + *
> > > + * @returns new devicetree blob pointer
> > >   */
> > >  void *board_fdt_blob_setup(void);
> > >
> > > diff --git a/lib/fdtdec.c b/lib/fdtdec.c
> > > index 067c27d0aa3..da36dffec62 100644
> > > --- a/lib/fdtdec.c
> > > +++ b/lib/fdtdec.c
> > > @@ -1203,11 +1203,12 @@ static int uncompress_blob(const void *src, ulong sz_src, void **dstp)
> > >       return 0;
> > >  }
> > >
> > > -/*
> > > - * For CONFIG_OF_SEPARATE, the board may optionally implement this to
> > > - * provide and/or fixup the fdt.
> > > +/**
> > > + * fdt_find_separate() - Find a devicetree at the end of the image
> > > + *
> > > + * @return pointer to FDT blob
> > >   */
> > > -__weak void *board_fdt_blob_setup(void)
> > > +static void *fdt_find_separate(void)
> > >  {
> > >       void *fdt_blob = NULL;
> > >  #ifdef CONFIG_SPL_BUILD
> > > @@ -1623,11 +1624,15 @@ int fdtdec_setup(void)
> > >       int ret;
> > >
> > >       /* The devicetree is typically appended to U-Boot */
> > > -     if (IS_ENABLED(CONFIG_OF_SEPARATE) || IS_ENABLED(CONFIG_OF_BOARD))
> > > -             gd->fdt_blob = board_fdt_blob_setup();
> > > +     if (IS_ENABLED(CONFIG_OF_SEPARATE))
> > > +             gd->fdt_blob = fdt_find_separate();
> > >       else /* embed dtb in ELF file for testing / development */
> > >               gd->fdt_blob = dtb_dt_embedded();
> > >
> > > +     /* Allow the board to override the fdt address. */
> > > +     if (IS_ENABLED(CONFIG_OF_BOARD))
> > > +             gd->fdt_blob = board_fdt_blob_setup();
> > > +
> > >       if (!IS_ENABLED(CONFIG_SPL_BUILD)) {
> > >               /* Allow the early environment to override the fdt address */
> > >               gd->fdt_blob = map_sysmem(env_get_ulong("fdtcontroladdr", 16,
> > > --
> > > 2.33.0.1079.g6e70778dc9-goog
> > >
> >
> > [1] https://lore.kernel.org/u-boot/YXekTkeL73NM0UOU@apalos.home/
> >
> > Regards
> > /Ilias

  reply	other threads:[~2021-10-27  7:17 UTC|newest]

Thread overview: 144+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-26  0:23 [PATCH v5 00/26] fdt: Make OF_BOARD a boolean option Simon Glass
2021-10-26  0:23 ` Simon Glass
2021-10-26  0:23 ` [PATCH v5 01/26] sandbox: Remove OF_HOSTFILE Simon Glass
2021-10-26  0:23 ` [PATCH v5 02/26] doc: Add documentation about devicetree usage Simon Glass
2021-10-26 14:06   ` Ilias Apalodimas
2021-10-26 15:27     ` Simon Glass
2021-10-27  9:29       ` Ilias Apalodimas
2021-10-26 14:31   ` François Ozog
2021-10-26 15:27     ` Simon Glass
2021-10-26 15:57       ` François Ozog
2021-10-27 14:13         ` Simon Glass
2021-10-27 15:38           ` François Ozog
2021-10-27 18:32             ` Simon Glass
2021-10-27 19:12               ` Ilias Apalodimas
2021-10-27 19:52                 ` Simon Glass
2021-10-29 10:20                   ` Ilias Apalodimas
2021-11-01 15:19                     ` Tom Rini
2021-11-02 14:53                     ` Simon Glass
2021-11-02 15:38                       ` Ilias Apalodimas
2021-11-03  3:29                         ` Simon Glass
2021-10-29 17:07                   ` François Ozog
2021-11-02 14:53                     ` Simon Glass
2021-10-27 19:46               ` François Ozog
2021-10-27 19:48             ` Tom Rini
2021-10-27 20:13               ` François Ozog
2021-10-26  0:23 ` [PATCH v5 03/26] arm: qemu: Mention -nographic in the docs Simon Glass
2021-10-26  0:23   ` Simon Glass
2021-10-26  0:23 ` [PATCH v5 04/26] arm: riscv: qemu: Explain how to extract the generated dt Simon Glass
2021-10-26  0:23   ` Simon Glass
2021-10-26  0:23 ` [PATCH v5 05/26] arm: qemu: Add a devicetree file for qemu_arm Simon Glass
2021-10-26  0:23   ` Simon Glass
2021-10-26  0:23 ` [PATCH v5 06/26] arm: qemu: Add a devicetree file for qemu_arm64 Simon Glass
2021-10-26  0:23   ` Simon Glass
2021-11-01 10:48   ` Peter Maydell
2021-11-01 10:48     ` Peter Maydell
2021-11-01 16:58     ` Simon Glass
2021-11-01 16:58       ` Simon Glass
2021-11-01 17:33       ` François Ozog
2021-11-01 17:33         ` François Ozog
2021-11-01 18:07         ` Tom Rini
2021-11-01 18:07           ` Tom Rini
2021-11-02 15:00           ` Simon Glass
2021-11-02 15:00             ` Simon Glass
2021-11-02 17:28             ` Tom Rini
2021-11-02 17:28               ` Tom Rini
2021-11-03  1:29               ` Simon Glass
2021-11-03  1:29                 ` Simon Glass
2021-11-03  5:29                 ` François Ozog
2021-11-03  5:29                   ` François Ozog
2021-11-03 14:41                   ` Tom Rini
2021-11-03 14:41                     ` Tom Rini
2021-11-04 11:09                     ` Peter Maydell
2021-11-04 11:09                       ` Peter Maydell
2021-11-04 11:22                       ` François Ozog
2021-11-04 11:22                         ` François Ozog
2021-11-04 11:41                         ` Peter Maydell
2021-11-04 11:41                           ` Peter Maydell
2021-11-04 11:48                           ` François Ozog
2021-11-04 11:48                             ` François Ozog
2021-11-03 14:44                   ` François Ozog
2021-11-03 14:44                     ` François Ozog
2021-11-03 14:39                 ` Tom Rini
2021-11-03 14:39                   ` Tom Rini
2021-11-02 14:59         ` Simon Glass
2021-11-02 14:59           ` Simon Glass
2021-11-02 16:57           ` Tom Rini
2021-11-02 16:57             ` Tom Rini
2021-11-03  1:32             ` Simon Glass
2021-11-03  1:32               ` Simon Glass
2021-11-03 14:39               ` Tom Rini
2021-11-03 14:39                 ` Tom Rini
2021-10-26  0:23 ` [PATCH v5 07/26] riscv: qemu: Add devicetree files for qemu_riscv32/64 Simon Glass
2021-10-26  0:23   ` Simon Glass
2021-10-26  0:23 ` [PATCH v5 08/26] arm: rpi: Add a devicetree file for rpi_4 Simon Glass
2021-10-26  0:23 ` [PATCH v5 09/26] arm: vexpress: Add a devicetree file for juno Simon Glass
2021-10-26  0:23 ` [PATCH v5 10/26] arm: xenguest_arm64: Add a fake devicetree file Simon Glass
2021-10-26  0:23 ` [PATCH v5 11/26] arm: octeontx: " Simon Glass
2021-10-26  0:23 ` [PATCH v5 12/26] arm: xilinx_versal_virt: Add a " Simon Glass
2021-10-26  0:23 ` [PATCH v5 13/26] arm: bcm7xxx: " Simon Glass
2021-10-26  0:23 ` [PATCH v5 14/26] arm: qemu-ppce500: " Simon Glass
2021-10-26  0:23 ` [PATCH v5 15/26] arm: highbank: Add a fake " Simon Glass
2021-10-26  0:23 ` [PATCH v5 16/26] fdt: Make OF_BOARD a bool option Simon Glass
2021-10-26  0:23 ` [PATCH v5 17/26] Drop CONFIG_BINMAN_STANDALONE_FDT Simon Glass
2021-10-26  0:23 ` [PATCH v5 18/26] doc: Update info on devicetree update Simon Glass
2021-10-26  0:23 ` [PATCH v5 19/26] fdt: Move MULTI_DTB_FIT handling out of fdtdec_setup() Simon Glass
2021-10-29  5:49   ` Ilias Apalodimas
2021-10-26  0:23 ` [PATCH v5 20/26] fdt: Drop #ifdefs with MULTI_DTB_FIT Simon Glass
2021-10-29  5:55   ` Ilias Apalodimas
2021-10-26  0:23 ` [PATCH v5 21/26] fdt: Drop CONFIG_SPL_BUILD check in fdtdec_setup() Simon Glass
2021-10-26  0:23 ` [PATCH v5 22/26] fdt: Drop #ifdef around board_fdt_blob_setup() Simon Glass
2021-10-26  0:23 ` [PATCH v5 25/26] fdt: Drop remaining preprocessor macros in fdtdec_setup() Simon Glass
2021-10-26  0:23 ` [PATCH v5 26/26] fdt: Don't call board_fdt_blob_setup() without OF_BOARD Simon Glass
2021-10-26 13:55   ` Ilias Apalodimas
2021-10-26 15:27     ` Simon Glass
2021-10-27  7:17       ` Ilias Apalodimas [this message]
2021-10-27 19:12         ` Tom Rini
2021-10-27 21:33           ` François Ozog
2021-10-27 21:44             ` Tom Rini
2021-10-26  6:07 ` [PATCH v5 00/26] fdt: Make OF_BOARD a boolean option François Ozog
2021-10-26  6:07   ` François Ozog
2021-10-27 14:08   ` Simon Glass
2021-10-27 14:08     ` Simon Glass
2021-10-27 15:14     ` François Ozog
2021-10-27 15:14       ` François Ozog
2021-10-27 18:23       ` Simon Glass
2021-10-27 18:23         ` Simon Glass
2021-10-27 19:25         ` Tom Rini
2021-10-27 19:25           ` Tom Rini
2021-11-03 16:45           ` Simon Glass
2021-11-03 16:45             ` Simon Glass
2021-11-03 17:21             ` Tom Rini
2021-11-03 17:21               ` Tom Rini
2021-10-27 20:07         ` François Ozog
2021-10-27 20:07           ` François Ozog
2021-11-03  1:20           ` Simon Glass
2021-11-03  1:20             ` Simon Glass
2021-11-03  4:45             ` François Ozog
2021-11-03  4:45               ` François Ozog
2021-10-27 22:30         ` Mark Kettenis
2021-10-27 22:30           ` Mark Kettenis
2021-11-03  1:20           ` Simon Glass
2021-11-03  1:20             ` Simon Glass
2021-11-03  8:22             ` Mark Kettenis
2021-11-03  8:22               ` Mark Kettenis
2021-11-03 16:02               ` Tom Rini
2021-11-03 16:02                 ` Tom Rini
2021-11-03 16:45                 ` Simon Glass
2021-11-03 16:45                   ` Simon Glass
2021-11-03 17:36                   ` Mark Kettenis
2021-11-03 17:36                     ` Mark Kettenis
2021-11-03 15:56             ` Tom Rini
2021-11-03 15:56               ` Tom Rini
2021-11-03 16:45               ` Simon Glass
2021-11-03 16:45                 ` Simon Glass
2021-10-27 15:36     ` Tuomas Tynkkynen
2021-10-27 15:36       ` Tuomas Tynkkynen
2021-10-27 19:13       ` Tom Rini
2021-10-27 19:13         ` Tom Rini
2021-10-27 18:16     ` Tom Rini
2021-10-27 18:16       ` Tom Rini
2021-10-27 18:24     ` Tom Rini
2021-10-27 18:24       ` Tom Rini
2021-11-03 17:13 ` François Ozog
2021-11-03 17:13   ` François Ozog

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='CAC_iWjKtds0r-H1qPADgBE8p6yDCTqNvHexYe4nVDy-=aKG82g@mail.gmail.com' \
    --to=ilias.apalodimas@linaro.org \
    --cc=mark.kettenis@xs4all.nl \
    --cc=seanga2@gmail.com \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=vanbaren@cideas.com \
    --cc=xypron.glpk@gmx.de \
    /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.