qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	qemu-arm <qemu-arm@nongnu.org>,
	QEMU Developers <qemu-devel@nongnu.org>,
	Eduardo Habkost <ehabkost@redhat.com>
Subject: Re: [PATCH] hw/arm/virt: Allow additions to the generated device tree
Date: Mon, 27 Sep 2021 10:04:10 -0600	[thread overview]
Message-ID: <CAPnjgZ2S7SXxHYd_bkcf+GcmmgEew3vpJkw+DRPqrpb44eLgcA@mail.gmail.com> (raw)
In-Reply-To: <CAFEAcA8FsPcBELEZxiRMuFbKtmKTFgDHABePQ33hdxYRq0C0ig@mail.gmail.com>

Hi Peter,

On Mon, 27 Sept 2021 at 09:46, Peter Maydell <peter.maydell@linaro.org> wrote:
>
> On Mon, 27 Sept 2021 at 16:18, Simon Glass <sjg@chromium.org> wrote:
> > On Mon, 27 Sept 2021 at 02:48, Peter Maydell <peter.maydell@linaro.org> wrote:
> > > So what is missing in the QEMU-provided DTB that it needs?
> >
> > Quite a lot. Here are some examples:
> >
> > U-Boot has limited pre-relocation memory so tries to avoid
> > binding/probing devices that are not used before relocation:
> >
> > https://u-boot.readthedocs.io/en/latest/develop/driver-model/design.html#pre-relocation-support
>
> It's up to u-boot to decide what it wants to touch and
> what it does not. QEMU tells u-boot what all the available
> devices are; I don't think we should have extra stuff saying
> "and if you are u-boot, do something odd".

Do you have familiarity with U-Boot and the space constraints of
embedded systems?

>
> > There is a configuration node (which is likely to change form in
> > future releases, but will still be there)
> >
> > https://github.com/u-boot/u-boot/blob/master/doc/device-tree-bindings/config.txt
>
> I think u-boot should be storing this kind of thing somewhere
> else (e.g. as part of the binary blob that is u-boot itself,
> or stored in flash or RAM as a separate blob).
>
> > Then there are various features which put things in U-Boot's control
> > dtb, such as verified boot, which adds public keys during signing:
> >
> > https://github.com/u-boot/u-boot/blob/master/doc/uImage.FIT/signature.txt#L135
> >
> > More generally, the U-Boot tree has hundreds of files which add
> > properties for each board, since we try to keep the U-Boot-specific
> > things out of the Linux tree:
> >
> > $ find . -name *u-boot.dtsi |wc -l
> > 398
>
> If any of this is actual information about the hardware then you
> should sort out getting the bindings documented officially
> (which I think is still in the Linux tree), and then QEMU can
> provide them.
>
> > Quite a bit of this is to do with SPL and so far it seems that QEMU
> > mostly runs U-Boot proper only, although I see that SPL is starting to
> > creep in too in the U-Boot CI.
> >
> > So at present QEMU is not able to support U-Boot fully.
>
> My take is that this is u-boot doing weird custom things with
> the DTB that aren't "describe the hardware". You should be able
> to boot u-boot by putting those custom DTB extra things in a
> separate blob and having u-boot combine that with the
> actual DTB when it starts.

Well this is how U-Boot works. Since it doesn't have a user-space
program to provide configuration / policy, nor a command line to
provide parameters (except with sandbox[1]), device tree is what it
uses. All of its driver model and configuration comes from there The
'describe the hardware' thing has been discussed to death but U-Boot
needs board- and arch-specific policy information about the hardware
so it can actually boot successfully on real systems.

It has been like this since U-Boot started using device tree, some 9
years ago! I can't imagine it changing.

As to a separate blob, isn't that what I am suggesting with this
patch? QEMU doesn't support passing two separate dtb blobs to U-Boot,
nor is there an API for that. Even if we did that it would require
code very early in U-Boot to process, which would make it infeasible
for anything other than QEMU. Ideally QEMU should work the same way as
other boards.

As a related point, I am looking at how we pass things between
firmware components.  If we wanted to pass in some initiate state in
some sort of blob, is it possible to set that up in memory (along with
the binary) for when QEMU starts emulating? The code and RAM might be
quite a long way apart so using a single image would involve a lot of
zeroes.

Regards,
Simon

[1] https://u-boot.readthedocs.io/en/latest/arch/sandbox.html


  reply	other threads:[~2021-09-27 16:07 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-26 18:34 [PATCH] hw/arm/virt: Allow additions to the generated device tree Simon Glass
2021-09-26 18:46 ` Peter Maydell
2021-09-26 18:55   ` Simon Glass
2021-09-27  8:48     ` Peter Maydell
2021-09-27 15:17       ` Simon Glass
2021-09-27 15:45         ` Peter Maydell
2021-09-27 16:04           ` Simon Glass [this message]
2021-09-27 16:49             ` Peter Maydell
2021-09-27 20:12               ` Simon Glass
2021-09-28  9:20                 ` Peter Maydell
2021-09-29  3:01                   ` Simon Glass
2021-09-29  9:09                     ` Peter Maydell
2021-09-29 15:09                       ` Simon Glass
2021-09-29 19:44                         ` Andrew Jones
2021-11-03 11:39           ` Alex Bennée
2021-11-03 13:17             ` François Ozog
2021-11-05 15:50               ` François Ozog
2023-02-07 18:39                 ` 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=CAPnjgZ2S7SXxHYd_bkcf+GcmmgEew3vpJkw+DRPqrpb44eLgcA@mail.gmail.com \
    --to=sjg@chromium.org \
    --cc=ehabkost@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /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;
as well as URLs for NNTP newsgroup(s).