qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: BALATON Zoltan <balaton@eik.bme.hu>
Cc: Alexey Kardashevskiy <aik@ozlabs.ru>,
	qemu-ppc@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [PATCH qemu v20] spapr: Implement Open Firmware client interface
Date: Mon, 24 May 2021 20:50:56 +1000	[thread overview]
Message-ID: <YKuFEBl8+ljUfs2B@yekko> (raw)
In-Reply-To: <3bf2ff2c-6cf3-ee4c-48b-394c531876@eik.bme.hu>

[-- Attachment #1: Type: text/plain, Size: 7129 bytes --]

On Mon, May 24, 2021 at 11:57:27AM +0200, BALATON Zoltan wrote:
> On Mon, 24 May 2021, David Gibson wrote:
> > On Thu, May 20, 2021 at 11:59:07PM +0200, BALATON Zoltan wrote:
> > > On Thu, 20 May 2021, Alexey Kardashevskiy wrote:
> > > > The PAPR platform describes an OS environment that's presented by
> > > > a combination of a hypervisor and firmware. The features it specifies
> > > > require collaboration between the firmware and the hypervisor.
> > > > 
> > > > Since the beginning, the runtime component of the firmware (RTAS) has
> > > > been implemented as a 20 byte shim which simply forwards it to
> > > > a hypercall implemented in qemu. The boot time firmware component is
> > > > SLOF - but a build that's specific to qemu, and has always needed to be
> > > > updated in sync with it. Even though we've managed to limit the amount
> > > > of runtime communication we need between qemu and SLOF, there's some,
> > > > and it has become increasingly awkward to handle as we've implemented
> > > > new features.
> > > > 
> > > > This implements a boot time OF client interface (CI) which is
> > > > enabled by a new "x-vof" pseries machine option (stands for "Virtual Open
> > > > Firmware). When enabled, QEMU implements the custom H_OF_CLIENT hcall
> > > > which implements Open Firmware Client Interface (OF CI). This allows
> > > > using a smaller stateless firmware which does not have to manage
> > > > the device tree.
> > > > 
> > > > The new "vof.bin" firmware image is included with source code under
> > > > pc-bios/. It also includes RTAS blob.
> > > > 
> > > > This implements a handful of CI methods just to get -kernel/-initrd
> > > > working. In particular, this implements the device tree fetching and
> > > > simple memory allocator - "claim" (an OF CI memory allocator) and updates
> > > > "/memory@0/available" to report the client about available memory.
> > > > 
> > > > This implements changing some device tree properties which we know how
> > > > to deal with, the rest is ignored. To allow changes, this skips
> > > > fdt_pack() when x-vof=on as not packing the blob leaves some room for
> > > > appending.
> > > > 
> > > > In absence of SLOF, this assigns phandles to device tree nodes to make
> > > > device tree traversing work.
> > > > 
> > > > When x-vof=on, this adds "/chosen" every time QEMU (re)builds a tree.
> > > > 
> > > > This adds basic instances support which are managed by a hash map
> > > > ihandle -> [phandle].
> > > > 
> > > > Before the guest started, the used memory is:
> > > > 0..e60 - the initial firmware
> > > > 8000..10000 - stack
> > > > 400000.. - kernel
> > > > 3ea0000.. - initramdisk
> > > > 
> > > > This OF CI does not implement "interpret".
> > > > 
> > > > Unlike SLOF, this does not format uninitialized nvram. Instead, this
> > > > includes a disk image with pre-formatted nvram.
> > > > 
> > > > With this basic support, this can only boot into kernel directly.
> > > > However this is just enough for the petitboot kernel and initradmdisk to
> > > > boot from any possible source. Note this requires reasonably recent guest
> > > > kernel with:
> > > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=df5be5be8735
> > > > 
> > > > The immediate benefit is much faster booting time which especially
> > > > crucial with fully emulated early CPU bring up environments. Also this
> > > > may come handy when/if GRUB-in-the-userspace sees light of the day.
> > > > 
> > > > This separates VOF and sPAPR in a hope that VOF bits may be reused by
> > > > other POWERPC boards which do not support pSeries.
> > > > 
> > > > This is coded in assumption that later on we might be adding support for
> > > > booting from QEMU backends (blockdev is the first candidate) without
> > > > devices/drivers in between as OF1275 does not require that and
> > > > it is quite easy to so.
> > > > 
> > > > Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> > > > ---
> > > > 
> > > > The example command line is:
> > > > 
> > > > /home/aik/pbuild/qemu-killslof-localhost-ppc64/qemu-system-ppc64 \
> > > > -nodefaults \
> > > > -chardev stdio,id=STDIO0,signal=off,mux=on \
> > > > -device spapr-vty,id=svty0,reg=0x71000110,chardev=STDIO0 \
> > > > -mon id=MON0,chardev=STDIO0,mode=readline \
> > > > -nographic \
> > > > -vga none \
> > > > -enable-kvm \
> > > > -m 8G \
> > > > -machine pseries,x-vof=on,cap-cfpc=broken,cap-sbbc=broken,cap-ibs=broken,cap-ccf-assist=off \
> > > > -kernel pbuild/kernel-le-guest/vmlinux \
> > > > -initrd pb/rootfs.cpio.xz \
> > > > -drive id=DRIVE0,if=none,file=./p/qemu-killslof/pc-bios/vof-nvram.bin,format=raw \
> > > > -global spapr-nvram.drive=DRIVE0 \
> > > > -snapshot \
> > > > -smp 8,threads=8 \
> > > > -L /home/aik/t/qemu-ppc64-bios/ \
> > > > -trace events=qemu_trace_events \
> > > > -d guest_errors \
> > > > -chardev socket,id=SOCKET0,server,nowait,path=qemu.mon.tmux26 \
> > > > -mon chardev=SOCKET0,mode=control
> > > > 
> > > > ---
> > > > Changes:
> > > > v20:
> > > > * compile vof.bin with -mcpu=power4 for better compatibility
> > > > * s/std/stw/ in entry.S to make it work on ppc32
> > > > * fixed dt_available property to support both 32 and 64bit
> > > > * shuffled prom_args handling code
> > > > * do not enforce 32bit in MSR (again, to support 32bit platforms)
> > > > 
> > > 
> > > [...]
> > > 
> > > > diff --git a/default-configs/devices/ppc64-softmmu.mak b/default-configs/devices/ppc64-softmmu.mak
> > > > index ae0841fa3a18..9fb201dfacfa 100644
> > > > --- a/default-configs/devices/ppc64-softmmu.mak
> > > > +++ b/default-configs/devices/ppc64-softmmu.mak
> > > > @@ -9,3 +9,4 @@ CONFIG_POWERNV=y
> > > >  # For pSeries
> > > >  CONFIG_PSERIES=y
> > > >  CONFIG_NVDIMM=y
> > > > +CONFIG_VOF=y
> > > > diff --git a/hw/ppc/Kconfig b/hw/ppc/Kconfig
> > > > index e51e0e5e5ac6..964510dfc73d 100644
> > > > --- a/hw/ppc/Kconfig
> > > > +++ b/hw/ppc/Kconfig
> > > > @@ -143,3 +143,6 @@ config FW_CFG_PPC
> > > > 
> > > >  config FDT_PPC
> > > >      bool
> > > > +
> > > > +config VOF
> > > > +    bool
> > > 
> > > I think you should just add "select VOF" to config PSERIES section in
> > > Kconfig instead of adding it to default-configs/devices/ppc64-softmmu.mak.
> > > That should do it, it works in my updated pegasos2 patch:
> > 
> > No, we don't want a "select": PSERIES doesn't require VOF while we
> > still support SLOF, and indeed we're quite a ways from being ready to
> > even make VOF the default pseries firmware.
> 
> Shouldn't you then also need to make code in spapr adding x-vof conditional
> on CONFIG_VOF or make sure it cannot be enabled if not compiled in?
> Otherwise it means VOF is always an option so spapr depends on VOF for which
> select is the way to describe that.

Uh, yes, we probably should.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2021-05-24 13:25 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-20  9:05 [PATCH qemu v20] spapr: Implement Open Firmware client interface Alexey Kardashevskiy
2021-05-20 21:59 ` BALATON Zoltan
2021-05-21  0:25   ` Alexey Kardashevskiy
2021-05-21  9:05     ` BALATON Zoltan
2021-05-21 19:57       ` BALATON Zoltan
2021-05-22  6:39         ` Alexey Kardashevskiy
2021-05-22 13:08           ` BALATON Zoltan
2021-05-23  3:47             ` Alexey Kardashevskiy
2021-05-23 12:12               ` BALATON Zoltan
2021-05-22  6:22       ` Alexey Kardashevskiy
2021-05-22 13:01         ` BALATON Zoltan
2021-05-22 15:02           ` BALATON Zoltan
2021-05-22 16:46             ` BALATON Zoltan
2021-05-23  3:41               ` Alexey Kardashevskiy
2021-05-23 12:02                 ` BALATON Zoltan
2021-05-23  3:31             ` Alexey Kardashevskiy
2021-05-23 11:24               ` BALATON Zoltan
2021-05-24  4:26                 ` Alexey Kardashevskiy
2021-05-24  5:40                   ` David Gibson
2021-05-24 11:56                     ` BALATON Zoltan
2021-05-23  3:20           ` Alexey Kardashevskiy
2021-05-23 11:19             ` BALATON Zoltan
2021-05-23 17:09               ` BALATON Zoltan
2021-05-24  6:01                 ` David Gibson
2021-05-24 10:55                   ` BALATON Zoltan
2021-05-24 12:46                     ` Alexey Kardashevskiy
2021-05-24 22:34                       ` BALATON Zoltan
2021-05-25  5:24                       ` David Gibson
2021-05-25  5:23                     ` David Gibson
2021-05-25 10:08                       ` BALATON Zoltan
2021-05-27  5:34                         ` David Gibson
2021-05-27 12:42                           ` BALATON Zoltan
2021-06-02  7:57                             ` David Gibson
2021-06-02 12:29                               ` BALATON Zoltan
2021-06-04  6:29                                 ` David Gibson
2021-06-04 13:59                                   ` BALATON Zoltan
2021-06-07  3:30                                     ` David Gibson
2021-06-07 22:54                                       ` BALATON Zoltan
2021-06-09  5:51                                         ` Alexey Kardashevskiy
2021-06-09 10:19                                           ` BALATON Zoltan
2021-06-06 22:21                                   ` BALATON Zoltan
2021-06-07  3:37                                     ` David Gibson
2021-06-07 22:20                                       ` BALATON Zoltan
2021-05-24 12:42                   ` BALATON Zoltan
2021-05-25  5:29                     ` David Gibson
2021-05-25  9:55                       ` BALATON Zoltan
2021-05-27  5:31                         ` David Gibson
2021-05-24  5:23   ` David Gibson
2021-05-24  9:57     ` BALATON Zoltan
2021-05-24 10:50       ` David Gibson [this message]
2021-05-29 18:10 ` BALATON Zoltan
2021-05-30 17:33 ` BALATON Zoltan
2021-05-31 13:07   ` BALATON Zoltan
2021-06-01 12:02     ` Alexey Kardashevskiy
2021-06-01 14:12       ` BALATON Zoltan
2021-06-04  6:21         ` David Gibson
2021-06-04 13:27           ` BALATON Zoltan
2021-06-07  3:02             ` David Gibson
2021-06-04  6:19   ` David Gibson
2021-06-04 13:50     ` BALATON Zoltan
2021-06-04 14:34       ` BALATON Zoltan
2021-06-07  3:05       ` David Gibson
2021-06-09  6:13         ` Alexey Kardashevskiy

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=YKuFEBl8+ljUfs2B@yekko \
    --to=david@gibson.dropbear.id.au \
    --cc=aik@ozlabs.ru \
    --cc=balaton@eik.bme.hu \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@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).