From: Alexey Kardashevskiy <aik@ozlabs.ru>
To: Paolo Bonzini <pbonzini@redhat.com>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>,
Thomas Huth <thuth@redhat.com>,
Stefano Garzarella <sgarzare@redhat.com>,
Cornelia Huck <conny@cornelia-huck.de>,
David Gibson <david@gibson.dropbear.id.au>
Subject: Re: VW ELF loader
Date: Sun, 2 Feb 2020 22:51:27 +1100 [thread overview]
Message-ID: <94828b1d-fa7d-149e-9eb3-d001d6484489@ozlabs.ru> (raw)
In-Reply-To: <e3ee4b4d-1b24-2900-4304-05fa521a9b47@redhat.com>
On 02/02/2020 06:04, Paolo Bonzini wrote:
> On 01/02/20 14:39, Alexey Kardashevskiy wrote:
>> QEMU needs to load GRUB from the disk. The current workaround is to read
>> it from qcow2, save in a file and then call load_elf(). Not nice.
>>
>> 2 problems with that.
>>
>> 1. when load_elf calls address_space_write() - I need to know where and
>> how much RAM was used to mark this memory "used" for the OF client
>> interface (/memory@0/available FDT property). So I'll need "preload()"
>> hook.
>>
>> 2. (bigger) GRUB comes from PReP partition which is 8MB. load_elf{32|64}
>> consumes filename, not a memory pointer nor a "read_fn" callback - so I
>> thought I need a "read_fn" callback.
>>
>> And then I discovered that load_elf actually maps the passed file. And
>> here I got lost.
>>
>> Why does not load_elf just map the entire file and parse the bits? It
>> still reads chunks with seek+read and then it maps the file in a loop
>> potentially multiple times - is this even correct? Passing "fd" around
>> is weird.
>
> QEMU must not load GRUB from disk, that's the firmware's task. If you
> want to kill SLOF, you can rewrite it, but loading the kernel GRUB from
> disk within QEMU is a bad idea: the next feature you'll be requested to
> implement will be network boot, and there's no way to do that in QEMU.
What is exactly the problem with netboot? I can hook up the OF's "net" to a backend (as I do for serial console and
blockdev, in boot order) and GRUB will do the rest which is tftp/dhcp/ip (SLOF does just this and nothing more). If GRUB
does not do this on POWER - I can fix this.
Or alternatively it is possible with my patchset to load petitboot (kernel + intramdisk, the default way of booting
POWER8/9 baremetal systems) and that thing can do whole lot of things, we can consider it as a replacement for ROMs from
devices (or I misunderstood what kind of netboot you meant).
> You should be able to reuse quite a lot of code from both
> pc-bios/s390-ccw (for virtio drivers) and kvm-unit-tests (for device
> tree parsing). You'd have to write the glue code for PCI hypercalls,
> and adapt virtio.c for virtio-pci instead of virtio-ccw.
The reason for killing SLOF is to keep one device tree for the entire boot process including
ibm,client-architecture-support with possible (and annoying) configuration reboots. Having another firware won't help
with that.
Also the OF1275 client interface is the way for the client to get net/block device without need to have drivers, I'd
like to do just this and skip the middle man (QEMU device and guest driver in firmware/bootloader).
I'll post another RFC tomorrow to give a better idea.
--
Alexey
next prev parent reply other threads:[~2020-02-02 11:52 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-01 13:39 VW ELF loader Alexey Kardashevskiy
2020-02-01 19:04 ` Paolo Bonzini
2020-02-02 11:51 ` Alexey Kardashevskiy [this message]
2020-02-02 17:38 ` Paolo Bonzini
2020-02-03 1:31 ` David Gibson
2020-02-03 1:28 ` David Gibson
2020-02-03 9:12 ` Paolo Bonzini
2020-02-03 9:50 ` David Gibson
2020-02-03 10:58 ` Alexey Kardashevskiy
2020-02-03 15:08 ` Paolo Bonzini
2020-02-03 22:36 ` Alexey Kardashevskiy
2020-02-03 22:56 ` Paolo Bonzini
2020-02-03 23:19 ` Alexey Kardashevskiy
2020-02-03 23:26 ` Paolo Bonzini
2020-02-04 6:16 ` Thomas Huth
2020-02-04 8:54 ` Cornelia Huck
2020-02-04 9:20 ` Restrictions of libnet (was: Re: VW ELF loader) Thomas Huth
2020-02-04 9:32 ` Thomas Huth
2020-02-04 9:33 ` Michal Suchánek
2020-02-05 5:30 ` David Gibson
2020-02-05 6:24 ` Thomas Huth
2020-02-10 7:55 ` David Gibson
2020-02-10 9:39 ` Michal Suchánek
2020-02-13 3:16 ` David Gibson
2020-02-04 23:18 ` VW ELF loader Alexey Kardashevskiy
2020-02-05 6:06 ` David Gibson
2020-02-05 9:28 ` Cornelia Huck
2020-02-06 4:47 ` David Gibson
2020-02-06 8:27 ` Paolo Bonzini
2020-02-06 23:17 ` Alexey Kardashevskiy
2020-02-06 23:45 ` Paolo Bonzini
2020-02-10 7:30 ` David Gibson
2020-02-10 10:37 ` Peter Maydell
2020-02-10 11:25 ` Paolo Bonzini
2020-02-14 3:23 ` David Gibson
2020-02-10 7:28 ` David Gibson
2020-02-10 11:26 ` Paolo Bonzini
2020-02-14 4:02 ` David Gibson
2020-02-05 5:58 ` David Gibson
2020-02-06 8:29 ` Paolo Bonzini
2020-02-06 23:23 ` Alexey Kardashevskiy
2020-02-06 23:46 ` Paolo Bonzini
2020-02-10 0:31 ` Alexey Kardashevskiy
2020-02-13 1:43 ` Alexey Kardashevskiy
2020-02-13 10:17 ` Paolo Bonzini
2020-02-14 0:01 ` Alexey Kardashevskiy
2020-02-14 2:30 ` David Gibson
2020-02-04 9:40 ` Christian Borntraeger
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=94828b1d-fa7d-149e-9eb3-d001d6484489@ozlabs.ru \
--to=aik@ozlabs.ru \
--cc=borntraeger@de.ibm.com \
--cc=conny@cornelia-huck.de \
--cc=david@gibson.dropbear.id.au \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=sgarzare@redhat.com \
--cc=thuth@redhat.com \
/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).