qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Simon Glass <sjg@chromium.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 17:49:37 +0100	[thread overview]
Message-ID: <CAFEAcA-bk6PF_P3JOxQSCXo7Fh2K5AVygB9WwDUiK2fV9Fx5jw@mail.gmail.com> (raw)
In-Reply-To: <CAPnjgZ2S7SXxHYd_bkcf+GcmmgEew3vpJkw+DRPqrpb44eLgcA@mail.gmail.com>

On Mon, 27 Sept 2021 at 17:04, Simon Glass <sjg@chromium.org> wrote:
> On Mon, 27 Sept 2021 at 09:46, Peter Maydell <peter.maydell@linaro.org> wrote:

> > 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.

You're suggesting "QEMU should have machinery for taking two
blobs and combining them and passing one blob to the guest".
I'm suggesting "the guest should combine them" (and the second
blob could be provided via several different existing mechanisms
that amount to 'QEMU provides some ways to load data into guest
ROM or RAM'), because as far as I know no other guest has this
"combine two different bits of dtb for me" requirement.

> 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.

Well, real hardware doesn't provide device tree blobs of any
form to u-boot, right? u-boot is just compiled into flash, or
perhaps launched from some other boot ROM, as I understand it.
Where does it get its dtb from then ?

> 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.

The generic-loader is quite good for this sort of thing:
https://qemu-project.gitlab.io/qemu/system/generic-loader.html
You can load raw data files to specific addresses; or you can
load ELF files (which can have multiple segments which get loaded
as the ELF header specifies). You can specify -device generic-loader,...
as many times as you need to to load multiple blobs.

-- PMM


  reply	other threads:[~2021-09-27 16:55 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
2021-09-27 16:49             ` Peter Maydell [this message]
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=CAFEAcA-bk6PF_P3JOxQSCXo7Fh2K5AVygB9WwDUiK2fV9Fx5jw@mail.gmail.com \
    --to=peter.maydell@linaro.org \
    --cc=ehabkost@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=sjg@chromium.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).