Re: [PATCH qemu v9] spapr: Implement Open Firmware client interface
On 12/10/2020 22:51, Greg Kurz wrote: On Mon, 12 Oct 2020 13:40:33 +0200 BALATON Zoltan via wrote: On Mon, 12 Oct 2020, Alexey Kardashevskiy wrote: On 29/09/2020 20:35, Alexey Kardashevskiy wrote: On 16/07/2020 23:22, David Gibson wrote: On Thu, Jul 16, 2020 at 07:04:56PM +1000, Alexey Kardashevskiy wrote: Ping? I kinda realize it is not going to replace SLOF any time soon but still... Yeah, I know. I just haven't had time to consider it. Priority starvation. Still? :) Ping? +1, I'd like to see this merged and experiment with it to emulate firmware for pegasos2 but I'd rather use the final version than something off-tree which may end up different when gets upstream. Is there a way I could help with this? This patch is a bit _old_ ;) Nope, not really, the only change is meson and it is minor really ;) I haven't checked the details but it might need some rebasing. Especially it should be ported to using meson if someone wants to experiment with it. Right. I am posting v10 because of that but otherwise there were no conflicts (well, tracepoints but also minor). -- Alexey
Re: [PATCH qemu v9] spapr: Implement Open Firmware client interface
On Mon, 12 Oct 2020 13:40:33 +0200 BALATON Zoltan via wrote: > On Mon, 12 Oct 2020, Alexey Kardashevskiy wrote: > > On 29/09/2020 20:35, Alexey Kardashevskiy wrote: > >> > >> On 16/07/2020 23:22, David Gibson wrote: > >>> On Thu, Jul 16, 2020 at 07:04:56PM +1000, Alexey Kardashevskiy wrote: > Ping? I kinda realize it is not going to replace SLOF any time soon but > still... > >>> > >>> Yeah, I know. I just haven't had time to consider it. Priority > >>> starvation. > >> > >> > >> Still? :) > > > > Ping? > > +1, I'd like to see this merged and experiment with it to emulate firmware > for pegasos2 but I'd rather use the final version than something off-tree > which may end up different when gets upstream. Is there a way I could help > with this? > This patch is a bit _old_ ;) I haven't checked the details but it might need some rebasing. Especially it should be ported to using meson if someone wants to experiment with it. > Regards, > BALATON Zoltan
Re: [PATCH qemu v9] spapr: Implement Open Firmware client interface
On Mon, 12 Oct 2020, Alexey Kardashevskiy wrote: On 29/09/2020 20:35, Alexey Kardashevskiy wrote: On 16/07/2020 23:22, David Gibson wrote: On Thu, Jul 16, 2020 at 07:04:56PM +1000, Alexey Kardashevskiy wrote: Ping? I kinda realize it is not going to replace SLOF any time soon but still... Yeah, I know. I just haven't had time to consider it. Priority starvation. Still? :) Ping? +1, I'd like to see this merged and experiment with it to emulate firmware for pegasos2 but I'd rather use the final version than something off-tree which may end up different when gets upstream. Is there a way I could help with this? Regards, BALATON Zoltan
Re: [PATCH qemu v9] spapr: Implement Open Firmware client interface
On 29/09/2020 20:35, Alexey Kardashevskiy wrote: On 16/07/2020 23:22, David Gibson wrote: On Thu, Jul 16, 2020 at 07:04:56PM +1000, Alexey Kardashevskiy wrote: Ping? I kinda realize it is not going to replace SLOF any time soon but still... Yeah, I know. I just haven't had time to consider it. Priority starvation. Still? :) Ping? On 07/07/2020 10:34, Alexey Kardashevskiy wrote: Ping? On 24/06/2020 10:28, Alexey Kardashevskiy wrote: Ping? On 02/06/2020 21:40, Alexey Kardashevskiy wrote: Ping? On 13/05/2020 13:58, Alexey Kardashevskiy wrote: The PAPR platform which 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..4000 - the initial firmware 1..18 - stack This OF CI does not implement "interpret". 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 Signed-off-by: Alexey Kardashevskiy --- -- Alexey
Re: [PATCH qemu v9] spapr: Implement Open Firmware client interface
On 16/07/2020 23:22, David Gibson wrote: On Thu, Jul 16, 2020 at 07:04:56PM +1000, Alexey Kardashevskiy wrote: Ping? I kinda realize it is not going to replace SLOF any time soon but still... Yeah, I know. I just haven't had time to consider it. Priority starvation. Still? :) On 07/07/2020 10:34, Alexey Kardashevskiy wrote: Ping? On 24/06/2020 10:28, Alexey Kardashevskiy wrote: Ping? On 02/06/2020 21:40, Alexey Kardashevskiy wrote: Ping? On 13/05/2020 13:58, Alexey Kardashevskiy wrote: The PAPR platform which 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..4000 - the initial firmware 1..18 - stack This OF CI does not implement "interpret". 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 Signed-off-by: Alexey Kardashevskiy --- -- Alexey
Re: [PATCH qemu v9] spapr: Implement Open Firmware client interface
On Thu, Jul 16, 2020 at 07:04:56PM +1000, Alexey Kardashevskiy wrote: > Ping? I kinda realize it is not going to replace SLOF any time soon but > still... Yeah, I know. I just haven't had time to consider it. Priority starvation. > On 07/07/2020 10:34, Alexey Kardashevskiy wrote: > > Ping? > > > > > > On 24/06/2020 10:28, Alexey Kardashevskiy wrote: > >> Ping? > >> > >> On 02/06/2020 21:40, Alexey Kardashevskiy wrote: > >>> Ping? > >>> > >>> On 13/05/2020 13:58, Alexey Kardashevskiy wrote: > The PAPR platform which 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..4000 - the initial firmware > 1..18 - stack > > This OF CI does not implement "interpret". > > 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 > > Signed-off-by: Alexey Kardashevskiy > --- > > > -- 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 signature.asc Description: PGP signature
Re: [PATCH qemu v9] spapr: Implement Open Firmware client interface
Ping? I kinda realize it is not going to replace SLOF any time soon but still... On 07/07/2020 10:34, Alexey Kardashevskiy wrote: > Ping? > > > On 24/06/2020 10:28, Alexey Kardashevskiy wrote: >> Ping? >> >> On 02/06/2020 21:40, Alexey Kardashevskiy wrote: >>> Ping? >>> >>> On 13/05/2020 13:58, Alexey Kardashevskiy wrote: The PAPR platform which 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..4000 - the initial firmware 1..18 - stack This OF CI does not implement "interpret". 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 Signed-off-by: Alexey Kardashevskiy --- -- Alexey
Re: [PATCH qemu v9] spapr: Implement Open Firmware client interface
Ping? On 24/06/2020 10:28, Alexey Kardashevskiy wrote: > Ping? > > On 02/06/2020 21:40, Alexey Kardashevskiy wrote: >> Ping? >> >> On 13/05/2020 13:58, Alexey Kardashevskiy wrote: >>> The PAPR platform which 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..4000 - the initial firmware >>> 1..18 - stack >>> >>> This OF CI does not implement "interpret". >>> >>> 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 >>> >>> Signed-off-by: Alexey Kardashevskiy >>> --- >>> >>> The example command line is: >>> >>> pbuild/qemu-killslof-localhost-ppc64/ppc64-softmmu/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 \ >>> -machine >>> pseries,x-vof=on,cap-cfpc=broken,cap-sbbc=broken,cap-ibs=broken,cap-ccf-assist=off >>> \ >>> -m 16G \ >>> -kernel pbuild/kernel-le-guest/vmlinux \ >>> -initrd pb/rootfs.cpio.xz \ >>> -device virtio-scsi-pci,id=vscsi0 \ >>> -drive id=DRIVE0,if=none,file=img/f30le.qcow2,format=qcow2 \ >>> -device scsi-hd,id=scsi-hd0,drive=DRIVE0 \ >>> -enable-kvm \ >>> -bios p/qemu-killslof/pc-bios/vof.bin \ >>> -snapshot \ >>> -smp 1 \ >>> -L /home/aik/t/qemu-ppc64-bios/ \ >>> -trace events=qemu_trace_events \ >>> -d guest_errors \ >>> -chardev socket,id=SOCKET0,server,nowait,path=qemu.mon.ssh55056 \ >>> -mon chardev=SOCKET0,mode=control >>> >>> --- >>> Changes: >>> v9: >>> * remove special handling of /rtas/rtas-size as now we always add it in QEMU >>> * removed leftovers from scsi/grub/stdout/stdin/... >>> >>> v8: >>> * no read/write/seek >>> * no @dev in instances >>> * the machine flag is "x-vof" for now >>> >>> v7: >>> * now we have a small firmware which loads at 0 as SLOF and starts from >>> 0x100 as SLOF >>> * no MBR/ELF/GRUB business in QEMU anymore >>> * blockdev is a separate patch >>> * networking is a separate patch >>> >>> v6: >>> * borrowed a big chunk of commit log introduction from David >>> * fixed initial stack pointer (points to the highest address of stack) >>> * traces for "interpret" and others >>> * disabled translate_kernel_address() hack so grub can load (work in >>> progress) >>> * added "milliseconds" for grub >>> * fixed "claim" allocator again >>> * moved FDT_MAX_SIZE to spapr.h as spapr_of_client.c wants it too for CAS >>> * moved the most code possible from spapr.c to spapr_of_client.c, such as >>> RTAS, prom entry and FDT build/finalize >>> * separated blobs >>> * GRUB now proceeds to its console prompt (there are still other issues) >>> * parse MBR/GPT to find PReP and load GRUB >>>
Re: [PATCH qemu v9] spapr: Implement Open Firmware client interface
Ping? On 02/06/2020 21:40, Alexey Kardashevskiy wrote: > Ping? > > On 13/05/2020 13:58, Alexey Kardashevskiy wrote: >> The PAPR platform which 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..4000 - the initial firmware >> 1..18 - stack >> >> This OF CI does not implement "interpret". >> >> 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 >> >> Signed-off-by: Alexey Kardashevskiy >> --- >> >> The example command line is: >> >> pbuild/qemu-killslof-localhost-ppc64/ppc64-softmmu/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 \ >> -machine >> pseries,x-vof=on,cap-cfpc=broken,cap-sbbc=broken,cap-ibs=broken,cap-ccf-assist=off >> \ >> -m 16G \ >> -kernel pbuild/kernel-le-guest/vmlinux \ >> -initrd pb/rootfs.cpio.xz \ >> -device virtio-scsi-pci,id=vscsi0 \ >> -drive id=DRIVE0,if=none,file=img/f30le.qcow2,format=qcow2 \ >> -device scsi-hd,id=scsi-hd0,drive=DRIVE0 \ >> -enable-kvm \ >> -bios p/qemu-killslof/pc-bios/vof.bin \ >> -snapshot \ >> -smp 1 \ >> -L /home/aik/t/qemu-ppc64-bios/ \ >> -trace events=qemu_trace_events \ >> -d guest_errors \ >> -chardev socket,id=SOCKET0,server,nowait,path=qemu.mon.ssh55056 \ >> -mon chardev=SOCKET0,mode=control >> >> --- >> Changes: >> v9: >> * remove special handling of /rtas/rtas-size as now we always add it in QEMU >> * removed leftovers from scsi/grub/stdout/stdin/... >> >> v8: >> * no read/write/seek >> * no @dev in instances >> * the machine flag is "x-vof" for now >> >> v7: >> * now we have a small firmware which loads at 0 as SLOF and starts from >> 0x100 as SLOF >> * no MBR/ELF/GRUB business in QEMU anymore >> * blockdev is a separate patch >> * networking is a separate patch >> >> v6: >> * borrowed a big chunk of commit log introduction from David >> * fixed initial stack pointer (points to the highest address of stack) >> * traces for "interpret" and others >> * disabled translate_kernel_address() hack so grub can load (work in >> progress) >> * added "milliseconds" for grub >> * fixed "claim" allocator again >> * moved FDT_MAX_SIZE to spapr.h as spapr_of_client.c wants it too for CAS >> * moved the most code possible from spapr.c to spapr_of_client.c, such as >> RTAS, prom entry and FDT build/finalize >> * separated blobs >> * GRUB now proceeds to its console prompt (there are still other issues) >> * parse MBR/GPT to find PReP and load GRUB >> >> v5: >> * made instances keep device and chardev pointers >> * removed VIO dependencies >> * print error if RTAS memory is not claimed as it should have been >> * pack FDT as "quie
Re: [PATCH qemu v9] spapr: Implement Open Firmware client interface
Ping? On 13/05/2020 13:58, Alexey Kardashevskiy wrote: > The PAPR platform which 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..4000 - the initial firmware > 1..18 - stack > > This OF CI does not implement "interpret". > > 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 > > Signed-off-by: Alexey Kardashevskiy > --- > > The example command line is: > > pbuild/qemu-killslof-localhost-ppc64/ppc64-softmmu/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 \ > -machine > pseries,x-vof=on,cap-cfpc=broken,cap-sbbc=broken,cap-ibs=broken,cap-ccf-assist=off > \ > -m 16G \ > -kernel pbuild/kernel-le-guest/vmlinux \ > -initrd pb/rootfs.cpio.xz \ > -device virtio-scsi-pci,id=vscsi0 \ > -drive id=DRIVE0,if=none,file=img/f30le.qcow2,format=qcow2 \ > -device scsi-hd,id=scsi-hd0,drive=DRIVE0 \ > -enable-kvm \ > -bios p/qemu-killslof/pc-bios/vof.bin \ > -snapshot \ > -smp 1 \ > -L /home/aik/t/qemu-ppc64-bios/ \ > -trace events=qemu_trace_events \ > -d guest_errors \ > -chardev socket,id=SOCKET0,server,nowait,path=qemu.mon.ssh55056 \ > -mon chardev=SOCKET0,mode=control > > --- > Changes: > v9: > * remove special handling of /rtas/rtas-size as now we always add it in QEMU > * removed leftovers from scsi/grub/stdout/stdin/... > > v8: > * no read/write/seek > * no @dev in instances > * the machine flag is "x-vof" for now > > v7: > * now we have a small firmware which loads at 0 as SLOF and starts from > 0x100 as SLOF > * no MBR/ELF/GRUB business in QEMU anymore > * blockdev is a separate patch > * networking is a separate patch > > v6: > * borrowed a big chunk of commit log introduction from David > * fixed initial stack pointer (points to the highest address of stack) > * traces for "interpret" and others > * disabled translate_kernel_address() hack so grub can load (work in > progress) > * added "milliseconds" for grub > * fixed "claim" allocator again > * moved FDT_MAX_SIZE to spapr.h as spapr_of_client.c wants it too for CAS > * moved the most code possible from spapr.c to spapr_of_client.c, such as > RTAS, prom entry and FDT build/finalize > * separated blobs > * GRUB now proceeds to its console prompt (there are still other issues) > * parse MBR/GPT to find PReP and load GRUB > > v5: > * made instances keep device and chardev pointers > * removed VIO dependencies > * print error if RTAS memory is not claimed as it should have been > * pack FDT as "quiesce" > > v4: > * fixed open > * validate ihandles in "call-method" > > v3: > * fixed phandles allocation > * s/__be32/uint32_t/ as we do not normally have __be32 t
[PATCH qemu v9] spapr: Implement Open Firmware client interface
The PAPR platform which 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..4000 - the initial firmware 1..18 - stack This OF CI does not implement "interpret". 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 Signed-off-by: Alexey Kardashevskiy --- The example command line is: pbuild/qemu-killslof-localhost-ppc64/ppc64-softmmu/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 \ -machine pseries,x-vof=on,cap-cfpc=broken,cap-sbbc=broken,cap-ibs=broken,cap-ccf-assist=off \ -m 16G \ -kernel pbuild/kernel-le-guest/vmlinux \ -initrd pb/rootfs.cpio.xz \ -device virtio-scsi-pci,id=vscsi0 \ -drive id=DRIVE0,if=none,file=img/f30le.qcow2,format=qcow2 \ -device scsi-hd,id=scsi-hd0,drive=DRIVE0 \ -enable-kvm \ -bios p/qemu-killslof/pc-bios/vof.bin \ -snapshot \ -smp 1 \ -L /home/aik/t/qemu-ppc64-bios/ \ -trace events=qemu_trace_events \ -d guest_errors \ -chardev socket,id=SOCKET0,server,nowait,path=qemu.mon.ssh55056 \ -mon chardev=SOCKET0,mode=control --- Changes: v9: * remove special handling of /rtas/rtas-size as now we always add it in QEMU * removed leftovers from scsi/grub/stdout/stdin/... v8: * no read/write/seek * no @dev in instances * the machine flag is "x-vof" for now v7: * now we have a small firmware which loads at 0 as SLOF and starts from 0x100 as SLOF * no MBR/ELF/GRUB business in QEMU anymore * blockdev is a separate patch * networking is a separate patch v6: * borrowed a big chunk of commit log introduction from David * fixed initial stack pointer (points to the highest address of stack) * traces for "interpret" and others * disabled translate_kernel_address() hack so grub can load (work in progress) * added "milliseconds" for grub * fixed "claim" allocator again * moved FDT_MAX_SIZE to spapr.h as spapr_of_client.c wants it too for CAS * moved the most code possible from spapr.c to spapr_of_client.c, such as RTAS, prom entry and FDT build/finalize * separated blobs * GRUB now proceeds to its console prompt (there are still other issues) * parse MBR/GPT to find PReP and load GRUB v5: * made instances keep device and chardev pointers * removed VIO dependencies * print error if RTAS memory is not claimed as it should have been * pack FDT as "quiesce" v4: * fixed open * validate ihandles in "call-method" v3: * fixed phandles allocation * s/__be32/uint32_t/ as we do not normally have __be32 type in qemu * fixed size of /chosen/stdout * bunch of renames * do not create rtas properties at all, let the client deal with it; instead setprop allows changing these in the FDT * no more packing FDT when bios=off - nobody needs it and getprop does not work otherwise * allow updating initramdisk device tree prope