From: Conor Dooley <conor.dooley@microchip.com>
To: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>,
Ilias Apalodimas <ilias.apalodimas@linaro.org>,
<u-boot@lists.denx.de>, <conor@kernel.org>,
Ivan Griffin <ivan.griffin@microchip.com>,
Padmarao Begari <padmarao.begari@microchip.com>,
Cyril Jean <cyril.jean@microchip.com>
Subject: Re: [PATCH v1] board: mpfs_icicle: implement board_fdt_blob_setup()
Date: Thu, 27 Jun 2024 10:38:08 +0100 [thread overview]
Message-ID: <20240627-endnote-cacti-5c8ae6251234@wendy> (raw)
In-Reply-To: <CAFLszTipm2MB9L8tubRxh_cF-BOXciBo5ypnjomm5rTj_F4fAQ@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 5853 bytes --]
On Thu, Jun 27, 2024 at 09:36:49AM +0100, Simon Glass wrote:
>
> On Tue, 25 Jun 2024 at 15:34, Tom Rini <trini@konsulko.com> wrote:
> >
> > On Tue, Jun 25, 2024 at 10:08:06AM +0100, Conor Dooley wrote:
> >
> > > The firmware on the Icicle is capable of providing a devicetree in a1 to
> > > U-Boot, but until now the devicetree has been packaged in a "payload" [1]
> > > alongside U-Boot (or other bootloaders/RTOSes) and appended to the image.
> > > The address of this appended devicetree is placed in a1 by the firmware.
> > > This meant that the mechanism used by OF_SEPARATE to locate the
> > > devicetree at the end of the image would pick up the one provided by the
> > > firmware when u-boot-nodtb.bin was in the payload and U-Boot's devicetree
> > > when u-boot.bin was.
> > >
> > > The firmware is now going to be capable of providing a minimal devicetree
> > > (quite cut down due to severe space constraints), but this devicetree is
> > > linked into the firmware that runs out of the L2 rather than at the end
> > > of the U-Boot image. Implement board_fdt_blob_setup() so that this
> > > devicetree can be optionally used, and the devicetree provided in the
> > > "payload" can be used without relying on "happening" to implement the
> > > same strategy as OF_SEPARATE expects in combination with
> > > u-boot-nodtb.bin. Unlike other RISC-V boards, the firmware provided
> > > devicetree is only used when OF_BOARD is set, so that the almost
> > > certainly more complete devicetree in U-Boot will be used unless
> > > explicitly requested otherwise.
> > >
> > > Link: https://github.com/polarfire-soc/hart-software-services/blob/master/tools/hss-payload-generator/README.md [1]
> > > Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
> > > ---
> > > CC: Ivan Griffin <ivan.griffin@microchip.com>
> > > CC: Padmarao Begari <padmarao.begari@microchip.com>
> > > CC: Cyril Jean <cyril.jean@microchip.com>
> > > CC: Tom Rini <trini@konsulko.com>
> > > CC: Conor Dooley <conor.dooley@microchip.com>
> > > CC: u-boot@lists.denx.de
> > > ---
> > > board/microchip/mpfs_icicle/mpfs_icicle.c | 19 +++++++++++++++++++
> > > 1 file changed, 19 insertions(+)
> > >
> > > diff --git a/board/microchip/mpfs_icicle/mpfs_icicle.c b/board/microchip/mpfs_icicle/mpfs_icicle.c
> > > index 4d7d843dfa3..2c1f7175f0e 100644
> > > --- a/board/microchip/mpfs_icicle/mpfs_icicle.c
> > > +++ b/board/microchip/mpfs_icicle/mpfs_icicle.c
> > > @@ -9,6 +9,7 @@
> > > #include <init.h>
> > > #include <asm/global_data.h>
> > > #include <asm/io.h>
> > > +#include <asm/sections.h>
> > >
> > > DECLARE_GLOBAL_DATA_PTR;
> > >
> > > @@ -50,6 +51,24 @@ static void read_device_serial_number(u8 *response, u8 response_size)
> > > response_buf[idx] = readb(MPFS_SYS_SERVICE_MAILBOX + idx);
> > > }
> > >
> > > +void *board_fdt_blob_setup(int *err)
> > > +{
> > > + *err = 0;
> > > + /*
> > > + * The devicetree provided by the previous stage is very minimal due to
> > > + * severe space constraints. The firmware performs no fixups etc.
> > > + * U-Boot, if providing a devicetree, almost certainly has a better
> > > + * more complete one than the firmware so that provided by the firmware
> > > + * is ignored for OF_SEPARATE.
> > > + */
> > > + if (IS_ENABLED(CONFIG_OF_BOARD)) {
> > > + if (gd->arch.firmware_fdt_addr)
> > > + return (ulong *)(uintptr_t)gd->arch.firmware_fdt_addr;
> > > + }
> > > +
> > > + return (ulong *)_end;
> > > +}
> > > +
> > > int board_init(void)
> > > {
> > > /* For now nothing to do here. */
> >
> > I'm adding in Simon and Ilias as this touches on one of those frequent
> > topics about how device trees can/should be passed along to us.
>
> The only thing I can think of is implementing bloblist in the a1 (?)
> firmware, then passing the DT in that.
a1 is the register that is used on riscv to pass the dtb, I think the
corresponding thing on arm64 is x0.
Re-reading the firware handoff spec, it's difficult to see what benefits
it actually provides us when we only ever have a single dtb which the
firmware does not interact with/use.
We are super space constrained in the firmware even carving out 4.5 KiB
for a devicetree blob is a stretch and requires disabling other features
and ripping out anything in the DT not required for U-Boot to load the OS.
Even the ~1 KiB mentioned in bloblist.h for handling a bloblist would be a
challenge.
I think the only way a bloblist could work is if it was created at build
time and linked into the firmware, since the on-disk format seems pretty
minimal. Is there tooling for generating a bloblist at build time that I
could use to check whether or not a bloblist is viable?
I'd also have to investigate how that would interact with OpenSBI, since
it's integrated into the firmware and involved with loading U-Boot.
> It seems that you still need to be able to turn that on and off in
> U-Boot though. So far we have not agreed the mechanism to do that, I
> have the same problem, with a pending patch here[1]
It seems your patch is trying to do some runtime determination of
whether to examine the bloblist or not, but the ?existing? build-time
check for BLOBLIST being enabled would work equally well/poorly as the
OF_BOARD check the code I am adding. I'm not even really sure what runtime
option could be used here here to check if the passed dtb/bloblist was to
be used. U-Boot only runs here as supervisor mode U-Boot proper and always
has a more complete devicetree. Whether to use the one passed to U-Boot
just depends on what the person with the board wants to do - which, given
this is an FPGA, could be vary significantly.
Cheers,
Conor.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2024-06-27 9:38 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-25 9:08 [PATCH v1] board: mpfs_icicle: implement board_fdt_blob_setup() Conor Dooley
2024-06-25 14:34 ` Tom Rini
2024-06-27 8:36 ` Simon Glass
2024-06-27 9:38 ` Conor Dooley [this message]
2024-06-27 10:50 ` Simon Glass
2024-06-27 20:27 ` Conor Dooley
2024-06-28 5:53 ` Ilias Apalodimas
2024-06-28 6:34 ` Conor Dooley
2024-06-28 6:22 ` Simon Glass
2024-06-28 6:29 ` Conor Dooley
2024-07-03 13:42 ` Conor Dooley
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=20240627-endnote-cacti-5c8ae6251234@wendy \
--to=conor.dooley@microchip.com \
--cc=conor@kernel.org \
--cc=cyril.jean@microchip.com \
--cc=ilias.apalodimas@linaro.org \
--cc=ivan.griffin@microchip.com \
--cc=padmarao.begari@microchip.com \
--cc=sjg@chromium.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.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.