From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Anne Macedo <retpolanne@posteo.net>, qemu-devel@nongnu.org
Subject: Re: Onboarding QEMU Firmware Configuration to other machines
Date: Mon, 25 Nov 2024 09:47:31 +0000 [thread overview]
Message-ID: <Z0RHs89WxRFnZs2M@redhat.com> (raw)
In-Reply-To: <CAFEAcA_ROEC7UkEzZ5v7FKYHajhLVKZuMAtzA2M8_Fj7KSZO0A@mail.gmail.com>
On Sun, Nov 24, 2024 at 05:41:08PM +0000, Peter Maydell wrote:
> On Sun, 24 Nov 2024 at 14:24, Anne Macedo <retpolanne@posteo.net> wrote:
> > How should one port fw_cfg to other QEMU machines?
> >
> > Context:
> >
> > - I found a possible bug on the Debian builds for Raspberry Pi 4 that is
> > only triggered when I try to launch it on QEMU;
> >
> > - I wrote an issue on systemd (I thought it had something to do with
> > logind) and they requested me to only fill bugs if they show up on the
> > upstream.
> >
> > - I tried baking systemd with mkosi – however, to test with mkosi and
> > qemu, it uses fw_cfg [1] which seems specific to the virt machine on
> > ARM.
> >
> > - Opened an issue [2] and started working on that [3]
> >
> > However, I still don't understand exactly how fw_cfg works. My current
> > understanding is that it is a device that, when connected some memory
> > mapping will happen on the guest so that it can access this memmap.
> >
> > TL;DR which steps should I take to onboard fw_cfg to machines such as
> > raspi4b?
>
> fw_cfg is a device that is intended for setups where the guest
> knows it is running as a virtual machine. It provides a way
> for the guest to ask for e.g. particular files like a kernel
> for direct kernel boot, among other things. It's present on
> the Arm "virt" machine and on the x86 PC machine.
>
> It doesn't and should not exist on the raspi4b model, because
> almost all QEMU machine types are supposed to model the real
> hardware, which doesn't have a fw_cfg.
To expand on this, by chance fw_cfg is visible to the guest OS, and thus
apps developers have (mis-)used this as a way to config data to the OS.
This should *not* be relied upon to work everywhere/anywhere. Adding it
to other targets / machines for general purpose application usage is a
non-goal for QEMU.
> I'm not sure exactly what mkosi is or does, but if it's supposed to be
> able to produce images that work with the raspberry pi then
> it needs to not require fw_cfg to exist (because on a real
> rpi it doesn't).
mkosi is a simple python tool for creating virtual disk images aka acronym
"MaKe Operating System Image".
What they need is a way to pass configuration metadata into the guest.
They already support a range of options, in order of preference looking
for SMBIOS (OEM strings), fw_cfg, kernel command line:
https://github.com/systemd/mkosi/blob/6c33859a1b445e0bff19d9e7f28158140893a3e4/mkosi/qemu.py#L1336
If none of those 3 options are viable, then a further option is to create
a virtual disk image containing a JSON file of the data needed and pass
that in. There are other options available too, virtiofs, 9p, usb-mtp,
virtio-serial, virtio-sock, all of which provide a ways to communicate
with the guest OS, with varying pros & cons. It is upto mkosi devs to
decide which best serve their needs, if they think their current 3 options
are insufficient.
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
prev parent reply other threads:[~2024-11-25 9:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-24 14:22 Onboarding QEMU Firmware Configuration to other machines Anne Macedo
2024-11-24 17:41 ` Peter Maydell
2024-11-25 9:47 ` Daniel P. Berrangé [this message]
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=Z0RHs89WxRFnZs2M@redhat.com \
--to=berrange@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=retpolanne@posteo.net \
/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.