qemu-e2k/include/hw/ppc
Alexey Kardashevskiy fc8c745d50 spapr: Implement Open Firmware client interface
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 assumes potential support for booting from QEMU backends
such as blockdev or netdev without devices/drivers used.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Message-Id: <20210625055155.2252896-1-aik@ozlabs.ru>
Reviewed-by: BALATON Zoltan <balaton@eik.bme.hu>
[dwg: Adjusted some includes which broke compile in some more obscure
 compilation setups]
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-07-09 10:38:19 +10:00
..
fdt.h target/ppc: Pass cpu instead of env to ppc_create_page_sizes_prop() 2018-04-27 18:05:22 +10:00
mac_dbdma.h Use OBJECT_DECLARE_SIMPLE_TYPE when possible 2020-09-18 14:12:32 -04:00
openpic.h Use OBJECT_DECLARE_SIMPLE_TYPE when possible 2020-09-18 14:12:32 -04:00
openpic_kvm.h openpic: move KVM-specific declarations into separate openpic_kvm.h file 2018-03-06 13:16:29 +11:00
pef.h spapr: Add PEF based confidential guest support 2021-02-08 16:57:38 +11:00
pnv.h ppc/pnv: Introduce a LPC FW memory region attribute to map the PNOR 2021-02-10 10:43:50 +11:00
pnv_core.h non-virt: Fix Lesser GPL version number 2020-11-15 16:38:24 +01:00
pnv_homer.h non-virt: Fix Lesser GPL version number 2020-11-15 16:38:24 +01:00
pnv_lpc.h non-virt: Fix Lesser GPL version number 2020-11-15 16:38:24 +01:00
pnv_occ.h non-virt: Fix Lesser GPL version number 2020-11-15 16:38:24 +01:00
pnv_pnor.h Use OBJECT_DECLARE_SIMPLE_TYPE when possible 2020-09-18 14:12:32 -04:00
pnv_psi.h non-virt: Fix Lesser GPL version number 2020-11-15 16:38:24 +01:00
pnv_xive.h qom: Remove module_obj_name parameter from OBJECT_DECLARE* macros 2020-09-18 14:12:32 -04:00
pnv_xscom.h exec/memory: Use struct Object typedef 2021-03-09 21:53:57 +01:00
ppc.h hw/ppc/prep: Remove the deprecated "prep" machine and the OpenHackware BIOS 2020-02-02 14:07:57 +11:00
ppc4xx.h hw/ppc: Remove unused ppcuic_init() 2021-01-19 10:20:29 +11:00
ppc_e500.h intc/openpic: Build openpic only once 2013-07-09 21:33:02 +02:00
spapr.h spapr: Implement Open Firmware client interface 2021-07-09 10:38:19 +10:00
spapr_cpu_core.h qom: Remove module_obj_name parameter from OBJECT_DECLARE* macros 2020-09-18 14:12:32 -04:00
spapr_drc.h spapr: rollback 'unplug timeout' for CPU hotunplugs 2021-04-12 12:27:14 +10:00
spapr_irq.h Use DECLARE_*CHECKER* macros 2020-09-09 09:27:09 -04:00
spapr_numa.h spapr_numa.c: create spapr_numa_initial_nvgpu_numa_id() helper 2021-02-10 10:43:50 +11:00
spapr_nvdimm.h spapr: nvdimm: Forward declare and move the definitions 2021-06-03 13:22:06 +10:00
spapr_ovec.h spapr: Improve handling of memory unplug with old guests 2021-01-19 10:20:29 +11:00
spapr_rtas.h tests: add RTAS command in the protocol 2016-09-23 10:29:40 +10:00
spapr_tpm_proxy.h Use OBJECT_DECLARE_SIMPLE_TYPE when possible 2020-09-18 14:12:32 -04:00
spapr_vio.h nomaintainer: Fix Lesser GPL version number 2020-11-15 17:04:40 +01:00
spapr_xive.h spapr/xive: Make spapr_xive_pic_print_info() static 2021-01-06 11:09:59 +11:00
vof.h spapr: Implement Open Firmware client interface 2021-07-09 10:38:19 +10:00
xics.h qom: Remove module_obj_name parameter from OBJECT_DECLARE* macros 2020-09-18 14:12:32 -04:00
xics_spapr.h spapr/xics: Drop unused argument to xics_kvm_has_broken_disconnect() 2020-12-14 15:50:55 +11:00
xive.h Use OBJECT_DECLARE_SIMPLE_TYPE when possible 2020-09-18 14:12:32 -04:00
xive_regs.h ppc/xive: Add firmware bit when dumping the ENDs 2021-02-10 10:43:50 +11:00