qemu-arm
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] hw/arm/virt: Allow additions to the generated device tree


From: Simon Glass
Subject: Re: [PATCH] hw/arm/virt: Allow additions to the generated device tree
Date: Mon, 27 Sep 2021 10:04:10 -0600

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 via email to

[Prev in Thread] Current Thread [Next in Thread]