spapr: Kill SLOF
PATCH v4 1/1 spapr: Kill SLOF
The Petitboot bootloader is way more advanced than SLOF is ever going to be as Petitboot comes with the full-featured Linux kernel with all the drivers, and initramdisk with quite user friendly interface. The problem with ditching SLOF is that an unmodified pseries kernel can either start via:
1. kexec, this requires presence of RTAS and skips ibm,client-architecture-support entirely;
2. normal boot, this heavily relies on the OF1275 client interface to fetch the device tree and do early setup (claim memory).
This adds a new bios-less mode to the pseries machine: "bios=on|off". When enabled, QEMU does not load SLOF and jumps to the kernel from "-kernel".
The client interface is implemented exactly as RTAS - a 20 bytes blob, right next after the RTAS blob. The entry point is passed to the kernel via GPR5.
This implements a handful of client interface methods just to get going. In particular, this implements the device tree fetching, ibm,client-architecture-support and instantiate-rtas.
This implements changing FDT properties for RTAS (for vmlinux and zImage) and initramdisk location (for zImage). To make this work, this skips fdt_pack() when bios=off as not packing the blob leaves some room for appending.
This assigns "phandles" to device tree nodes as there is no more SLOF and OF nodes addresses of which served as phandle values. This keeps predefined nodes (such as XICS/NVLINK/...) unchanged. phandles are regenerated at every FDT rebuild.
This defines phandles for VIO devices to have phandle assigned to the default stdout device at the point when we write "/chosen/stdout" which an ihandle which the OS uses to write to the console.
When bios=off, this adds "/chosen" every time QEMU builds a tree.
This implements "claim" which the client (Linux) uses for memory allocation; this is also used by QEMU for claiming kernel/initrd images, client interface entry point, RTAS and the initial stack.
While at this, add a "kernel-addr" machine parameter to allow moving the kernel in memory. This is useful for debugging if the kernel is loaded at @0, although not necessary.
This adds very basic instances support which are managed by a hashmap ihandle->phandle.
Note that a 64bit PCI fix is required for Linux:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=df5be5be8735e
The test command line:
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 \
-kernel pbuild/kernel-le-guest/arch/powerpc/boot/zImage.pseries \
-machine pseries,bios=off,cap-cfpc=broken,cap-sbbc=broken,cap-ibs=broken \
-m 4G \
-enable-kvm \
-initrd pb/rootfs.cpio.xz \
-device nec-usb-xhci,id=nec-usb-xhci0 \
-netdev tap,id=TAP0,helper=/home/aik/qemu-bridge-helper --br=br0 \
-device virtio-net-pci,id=vnet0,netdev=TAP0 img/f30le.qcow2 \
-snapshot \
-smp 8,threads=8 \
-trace events=qemu_trace_events \
-d guest_errors \
-chardev socket,id=SOCKET0,server,nowait,path=qemu.mon.ssh54088 \
-mon chardev=SOCKET0,mode=control
---
Changes:
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 properties (for zImage)
* added instances
* fixed stdout on OF's "write"
* removed special handling for stdout in OF client, spapr-vty handles it instead
v2:
* fixed claim()
* added "setprop"
* cleaner client interface and RTAS blobs management
* boots to petitboot and further to the target system
* more trace points
--- hw/ppc/Makefile.objs | 1 + include/hw/ppc/spapr.h | 28 +- include/hw/ppc/spapr_vio.h | 5 + hw/char/spapr_vty.c | 14 + hw/ppc/spapr.c | 263 +++++++++++++++-- hw/ppc/spapr_hcall.c | 74 +++-- hw/ppc/spapr_of_client.c | 580 +++++++++++++++++++++++++++++++++++++ hw/ppc/spapr_vio.c | 27 +- hw/ppc/trace-events | 12 + 9 files changed, 947 insertions(+), 57 deletions(-) create mode 100644 hw/ppc/spapr_of_client.c
hw/ppc/Makefile.objs +1 -0
@@ -6,6 +6,7 @@ obj-$(CONFIG_PSERIES) += spapr_hcall.o spapr_iommu.o spapr_rtas.o obj-$(CONFIG_PSERIES) += spapr_pci.o spapr_rtc.o spapr_drc.o obj-$(CONFIG_PSERIES) += spapr_cpu_core.o spapr_ovec.o spapr_irq.o obj-$(CONFIG_PSERIES) += spapr_tpm_proxy.o +obj-$(CONFIG_PSERIES) += spapr_of_client.o obj-$(CONFIG_SPAPR_RNG) += spapr_rng.o # IBM PowerNV obj-$(CONFIG_POWERNV) += pnv.o pnv_xscom.o pnv_core.o pnv_lpc.o pnv_psi.o pnv_occ.o pnv_bmc.o
include/hw/ppc/spapr.h +27 -1
@@ -105,6 +105,11 @@ struct SpaprCapabilities {uint8_t caps[SPAPR_CAP_NUM ]; }; +typedef struct { +uint64_t start; +uint64_t size; +}SpaprOfClaimed ; +/** * SpaprMachineClass: */
@@ -160,6 +165,13 @@ struct SpaprMachineState {void *fdt_blob;long kernel_size;bool kernel_le; +uint64_t kernel_addr; +bool bios_enabled; +uint32_t rtas_base; +GArray *claimed;/* array of SpaprOfClaimed */ +uint64_t claimed_base; +GHashTable *of_instances;/* ihandle -> phandle map */ +uint32_t of_instance_last;uint32_t initrd_base;long initrd_size;uint64_t rtc_offset;/* Now used only during incoming migration */
@@ -510,7 +522,8 @@ struct SpaprMachineState {/* Client Architecture support */ #define KVMPPC_H_CAS (KVMPPC_HCALL_BASE + 0x2)#define KVMPPC_H_UPDATE_DT (KVMPPC_HCALL_BASE + 0x3) -#define KVMPPC_HCALL_MAX KVMPPC_H_UPDATE_DT +#define KVMPPC_H_CLIENT (KVMPPC_HCALL_BASE + 0x5) +#define KVMPPC_HCALL_MAX KVMPPC_H_CLIENT/* * The hcall range 0xEF00 to 0xEF80 is reserved for use in facilitating
@@ -538,6 +551,11 @@ void spapr_register_hypercall(target_ulong opcode, spapr_hcall_fn fn);target_ulong spapr_hypercall (PowerPCCPU *cpu,target_ulong opcode,target_ulong *args); +target_ulong do_client_architecture_support (PowerPCCPU *cpu, +SpaprMachineState *spapr, +target_ulong addr, +target_ulong fdt_bufsize); +/* Virtual Processor Area structure constants */ #define VPA_MIN_SIZE 640#define VPA_SIZE_OFFSET 0x4
@@ -769,6 +787,11 @@ struct SpaprEventLogEntry {void *spapr_build_fdt (SpaprMachineState *spapr,bool reset,size_t space);void spapr_events_init (SpaprMachineState *sm);void spapr_dt_events (SpaprMachineState *sm,void *fdt); +uint64_t spapr_do_of_client_claim (SpaprMachineState *spapr,uint64_t virt, +uint64_t size,uint64_t align); + +uint32_t spapr_of_client_open (SpaprMachineState *spapr,const char *path); +int spapr_h_client (SpaprMachineState *spapr,target_ulong client_args);void close_htab_fd (SpaprMachineState *spapr);void spapr_setup_hpt_and_vrma (SpaprMachineState *spapr);void spapr_free_hpt (SpaprMachineState *spapr);
@@ -891,4 +914,7 @@ void spapr_check_pagesize(SpaprMachineState *spapr, hwaddr pagesize,#define SPAPR_OV5_XIVE_BOTH 0x80/* Only to advertise on the platform */ void spapr_set_all_lpcrs (target_ulong value,target_ulong mask); + +void spapr_instantiate_rtas (SpaprMachineState *spapr,uint32_t base); +#endif /* HW_SPAPR_H */
include/hw/ppc/spapr_vio.h +5 -0
@@ -64,6 +64,7 @@ struct SpaprVioDevice {DeviceState qdev;uint32_t reg;uint32_t irq; +uint32_t phandle;uint64_t signal_state;SpaprVioCrq crq;AddressSpace as;
@@ -78,10 +79,12 @@ struct SpaprVioDevice {struct SpaprVioBus {BusState bus;uint32_t next_reg; +uint32_t next_phandle; };SpaprVioBus *spapr_vio_bus_init (void );SpaprVioDevice *spapr_vio_find_by_reg (SpaprVioBus *bus,uint32_t reg); +SpaprVioDevice *spapr_vio_find_by_phandle (SpaprVioBus *bus,uint32_t phandle);void spapr_dt_vdevice (SpaprVioBus *bus,void *fdt);gchar *spapr_vio_stdout_path (SpaprVioBus *bus);
@@ -128,6 +131,8 @@ static inline int spapr_vio_dma_set(SpaprVioDevice *dev, uint64_t taddr,int spapr_vio_send_crq (SpaprVioDevice *dev,uint8_t *crq);SpaprVioDevice *vty_lookup (SpaprMachineState *spapr,target_ulong reg); +SpaprVioDevice *vty_lookup_phandle (SpaprMachineState *spapr, +uint32_t phandle);void vty_putchars (SpaprVioDevice *sdev,uint8_t *buf,int len);void spapr_vty_create (SpaprVioBus *bus,Chardev *chardev);void spapr_vlan_create (SpaprVioBus *bus,NICInfo *nd);
hw/char/spapr_vty.c +14 -0
@@ -262,6 +262,20 @@ SpaprVioDevice *vty_lookup(SpaprMachineState *spapr, target_ulong reg)return sdev; } +SpaprVioDevice *vty_lookup_phandle (SpaprMachineState *spapr, +uint32_t phandle) +{ +SpaprVioDevice *sdev; + + sdev =spapr_vio_find_by_phandle (spapr->vio_bus, phandle); +if (!sdev || + !object_dynamic_cast (OBJECT (sdev),TYPE_VIO_SPAPR_VTY_DEVICE )) { +return NULL ; + } + +return sdev; +} +static void spapr_vty_register_types (void ) {spapr_register_hypercall (H_PUT_TERM_CHAR , h_put_term_char);
hw/ppc/spapr.c +233 -30
346 lines not on this page · raw message
hw/ppc/spapr_hcall.c +50 -24
111 lines not on this page · raw message
hw/ppc/spapr_of_client.c new file +580 -0
580 lines not on this page · raw message
hw/ppc/spapr_vio.c +25 -2
@@ -41,6 +41,7 @@#include <libfdt.h> #define SPAPR_VIO_REG_BASE 0x71000000 +#define PHANDLE_SPAPR_VIO_BASE 0x0000F000static char *spapr_vio_get_dev_name (DeviceState *qdev) {
@@ -81,6 +82,21 @@ SpaprVioDevice *spapr_vio_find_by_reg(SpaprVioBus *bus, uint32_t reg)return NULL ; } +SpaprVioDevice *spapr_vio_find_by_phandle (SpaprVioBus *bus,uint32_t phandle) +{ +BusChild *kid; +SpaprVioDevice *dev =NULL ; + + QTAILQ_FOREACH(kid, &bus->bus.children, sibling) { + dev = (SpaprVioDevice *)kid->child; +if (dev->phandle && dev->phandle == phandle) { +return dev; + } + } + +return NULL ; +} +static int vio_make_devnode (SpaprVioDevice *dev,void *fdt) {
@@ -105,6 +121,11 @@ static int vio_make_devnode(SpaprVioDevice *dev,return ret; } + ret =fdt_setprop_cell (fdt, node_off,"phandle" , dev->phandle); +if (ret <0 ) { +return ret; + } +if (pc->dt_type) { ret =fdt_setprop_string (fdt, node_off,"device_type" , pc->dt_type);
@@ -468,6 +489,7 @@ static void spapr_vio_busdev_realize(DeviceState *qdev, Error **errp)SpaprVioDeviceClass *pc =VIO_SPAPR_DEVICE_GET_CLASS (dev);char *id;Error *local_err =NULL ; +SpaprVioBus *bus =SPAPR_VIO_BUS (dev->qdev.parent_bus);if (dev->reg !=-1 ) {/*
@@ -487,13 +509,13 @@ static void spapr_vio_busdev_realize(DeviceState *qdev, Error **errp) } }else {/* Need to assign an address */ -SpaprVioBus *bus =SPAPR_VIO_BUS (dev->qdev.parent_bus); -do { dev->reg = bus->next_reg++; }while (reg_conflict (dev)); } + dev->phandle = bus->next_phandle++; +/* Don't overwrite ids assigned on the command line */ if (!dev->qdev.id) { id =spapr_vio_get_dev_name (DEVICE (dev));
@@ -576,6 +598,7 @@ SpaprVioBus *spapr_vio_bus_init(void) qbus =qbus_create (TYPE_SPAPR_VIO_BUS , dev,"spapr-vio" ); bus =SPAPR_VIO_BUS (qbus); bus->next_reg =SPAPR_VIO_REG_BASE ; + bus->next_phandle =PHANDLE_SPAPR_VIO_BASE ;/* hcall-vio */ spapr_register_hypercall (H_VIO_SIGNAL , h_vio_signal);
hw/ppc/trace-events +12 -0
@@ -21,6 +21,18 @@ spapr_update_dt(unsigned cb) "New blob %u bytes" spapr_update_dt_failed_size(unsigned cbold, unsigned cbnew, unsigned magic) "Old blob %u bytes, new blob %u bytes, magic 0x%x" spapr_update_dt_failed_check(unsigned cbold, unsigned cbnew, unsigned magic) "Old blob %u bytes, new blob %u bytes, magic 0x%x" +# spapr_client.c +spapr_of_client_error_param(const char *method, int nargscheck, int nretcheck, int nargs, int nret) "%s takes/returns %d/%d, not %d/%d" +spapr_of_client_error_unknown_service(const char *service, int nargs, int nret) "%s args=%d rets=%d" +spapr_of_client_error_unknown_method(const char *method) "%s" +spapr_of_client_error_unknown_ihandle_close(uint32_t ihandle) "0x%x" +spapr_of_client_error_unknown_path(const char *path) "%s" +spapr_of_client_claim(uint32_t virt, uint32_t size, uint32_t align, uint32_t ret) "virt=0x%x size=0x%x align=0x%x => 0x%x" +spapr_of_client_method(uint32_t ihandle, const char *method, uint32_t param, uint32_t phandle, const char *path, uint32_t ret) "0x%x \"%s\" param=0x%x ph=0x%x \"%s\" => 0x%x" +spapr_of_client_getprop(uint32_t ph, const char *prop, uint32_t ret) "phandle=0x%x \"%s\" => 0x%x" +spapr_of_client_setprop(uint32_t ph, const char *prop, uint32_t ret) "phandle=0x%x \"%s\" => 0x%x" +spapr_of_client_open(const char *path, uint32_t phandle, uint32_t ihandle) "%s 0x%x => 0x%x" + # spapr_hcall_tpm.c spapr_h_tpm_comm(const char *device_path, uint64_t operation) "tpm_device_path=%s operation=0x%"PRIu64 spapr_tpm_execute(uint64_t data_in, uint64_t data_in_sz, uint64_t data_out, uint64_t data_out_sz) "data_in=0x%"PRIx64", data_in_sz=%"PRIu64", data_out=0x%"PRIx64", data_out_sz=%"PRIu64
Signature · 1 line
2.17.1
Quoted 10 lines · Alexey Kardashevskiy
The Petitboot bootloader is way more advanced than SLOF is ever going to be as Petitboot comes with the full-featured Linux kernel with all the drivers, and initramdisk with quite user friendly interface. The problem with ditching SLOF is that an unmodified pseries kernel can either start via:
1. kexec, this requires presence of RTAS and skips ibm,client-architecture-support entirely;
2. normal boot, this heavily relies on the OF1275 client interface to fetch the device tree and do early setup (claim memory).
Quoted 3 lines
This adds a new bios-less mode to the pseries machine: "bios=on|off". When enabled, QEMU does not load SLOF and jumps to the kernel from "-kernel".
btw it occured to me that "of" (or "of-cli", or "of1275") is probably a better name for the new option as there is still "bios" (those new 20 bytes with H_CLIENT) but this time QEMU implements the OF client interface.
Quoted 18 lines
fdt = spapr_build_fdt(spapr, true, FDT_MAX_SIZE);hw/ppc/spapr.c +0
-11- rc =fdt_pack (fdt); - -/* Should only fail if we've built a corrupted tree */ -assert (rc ==0 ); - -/* Load the fdt */ -qemu_fdt_dumpdtb (fdt,fdt_totalsize (fdt)); -cpu_physical_memory_write (fdt_addr, fdt,fdt_totalsize (fdt));g_free (spapr->fdt_blob); spapr->fdt_size =fdt_totalsize (fdt); spapr->fdt_initial_size = spapr->fdt_size; spapr->fdt_blob = fdt; -/* Set up the entry state */ -spapr_cpu_set_entry_state (first_ppc_cpu,SPAPR_ENTRY_POINT , fdt_addr); - first_ppc_cpu->env.gpr[5 ] =0 ;
hw/ppc/spapr.c static void spapr_machine_reset(MachineState *machine) · line 1825
Quoted 10 lines
hw/ppc/spapr.c +10
-0+if (spapr->bios_enabled) { +/* Load the fdt */ + rc =fdt_pack (fdt); +/* Should only fail if we've built a corrupted tree */ +assert (rc ==0 ); + + spapr->fdt_size =fdt_totalsize (fdt); + spapr->fdt_initial_size = spapr->fdt_size; +qemu_fdt_dumpdtb (fdt,fdt_totalsize (fdt)); +cpu_physical_memory_write (fdt_addr, fdt,fdt_totalsize (fdt));
Inconsistency here, should have used here spapr->fdt_blob.
Signature · 1 line
Alexey
Quoted 27 lines · Alexey Kardashevskiy
The Petitboot bootloader is way more advanced than SLOF is ever going to be as Petitboot comes with the full-featured Linux kernel with all the drivers, and initramdisk with quite user friendly interface. The problem with ditching SLOF is that an unmodified pseries kernel can either start via:
1. kexec, this requires presence of RTAS and skips ibm,client-architecture-support entirely;
2. normal boot, this heavily relies on the OF1275 client interface to fetch the device tree and do early setup (claim memory).This adds a new bios-less mode to the pseries machine: "bios=on|off". When enabled, QEMU does not load SLOF and jumps to the kernel from "-kernel".
The client interface is implemented exactly as RTAS - a 20 bytes blob, right next after the RTAS blob. The entry point is passed to the kernel via GPR5.
This implements a handful of client interface methods just to get going. In particular, this implements the device tree fetching, ibm,client-architecture-support and instantiate-rtas.
This implements changing FDT properties for RTAS (for vmlinux and zImage) and initramdisk location (for zImage). To make this work, this skips
fdt_pack()when bios=off as not packing the blob leaves some room for appending.
Quoted 8 lines
This assigns "phandles" to device tree nodes as there is no more SLOF and OF nodes addresses of which served as phandle values. This keeps predefined nodes (such as XICS/NVLINK/...) unchanged. phandles are regenerated at every FDT rebuild.
This defines phandles for VIO devices to have phandle assigned to the default stdout device at the point when we write "/chosen/stdout" which an ihandle which the OS uses to write to the console.
And I do not really need to preallocate phandles for stdout as it is a leftover from when I populated /chosen/stdout before populating VIO nodes, now /chosen/stdout is added at the very end. Thanks,
Quoted 16 lines
When bios=off, this adds "/chosen" every time QEMU builds a tree.
This implements "claim" which the client (Linux) uses for memory allocation; this is also used by QEMU for claiming kernel/initrd images, client interface entry point, RTAS and the initial stack.
While at this, add a "kernel-addr" machine parameter to allow moving the kernel in memory. This is useful for debugging if the kernel is loaded at @0, although not necessary.
This adds very basic instances support which are managed by a hashmap
ihandle->phandle.Note that a 64bit PCI fix is required for Linux:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=df5be5be8735e
Signature · 1 line
Alexey
Quoted 35 lines · Alexey Kardashevskiy
Quoted 32 lines · Alexey Kardashevskiy
The Petitboot bootloader is way more advanced than SLOF is ever going to be as Petitboot comes with the full-featured Linux kernel with all the drivers, and initramdisk with quite user friendly interface. The problem with ditching SLOF is that an unmodified pseries kernel can either start via:
1. kexec, this requires presence of RTAS and skips ibm,client-architecture-support entirely;
2. normal boot, this heavily relies on the OF1275 client interface to fetch the device tree and do early setup (claim memory).This adds a new bios-less mode to the pseries machine: "bios=on|off". When enabled, QEMU does not load SLOF and jumps to the kernel from "-kernel".
The client interface is implemented exactly as RTAS - a 20 bytes blob, right next after the RTAS blob. The entry point is passed to the kernel via GPR5.
This implements a handful of client interface methods just to get going. In particular, this implements the device tree fetching, ibm,client-architecture-support and instantiate-rtas.
This implements changing FDT properties for RTAS (for vmlinux and zImage) and initramdisk location (for zImage). To make this work, this skips
fdt_pack()when bios=off as not packing the blob leaves some room for appending.This assigns "phandles" to device tree nodes as there is no more SLOF and OF nodes addresses of which served as phandle values. This keeps predefined nodes (such as XICS/NVLINK/...) unchanged. phandles are regenerated at every FDT rebuild.
Quoted 8 lines
Quoted 3 lines
This defines phandles for VIO devices to have phandle assigned to the default stdout device at the point when we write "/chosen/stdout" which an ihandle which the OS uses to write to the console.
And I do not really need to preallocate phandles for stdout as it is a leftover from when I populated /chosen/stdout before populating VIO nodes, now /chosen/stdout is added at the very end. Thanks,
Ah noo, I do, to implement "write" to the selected stdout as I need to trace ihandle back to Object* and object_resolve_path() does not know about FDT path, it is /machine/peripheral/svty0 in QOM. The commit log needs an update, or this needs a fix but I cannot think of a nicer one. Thanks,
Quoted 22 lines
Quoted 19 lines
When bios=off, this adds "/chosen" every time QEMU builds a tree.
This implements "claim" which the client (Linux) uses for memory allocation; this is also used by QEMU for claiming kernel/initrd images, client interface entry point, RTAS and the initial stack.
While at this, add a "kernel-addr" machine parameter to allow moving the kernel in memory. This is useful for debugging if the kernel is loaded at @0, although not necessary.
This adds very basic instances support which are managed by a hashmap
ihandle->phandle.Note that a 64bit PCI fix is required for Linux:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=df5be5be8735e
Signature · 1 line
Alexey
Quoted 48 lines · Alexey Kardashevskiy
Quoted 35 lines · Alexey Kardashevskiy
Quoted 32 lines · Alexey Kardashevskiy
The Petitboot bootloader is way more advanced than SLOF is ever going to be as Petitboot comes with the full-featured Linux kernel with all the drivers, and initramdisk with quite user friendly interface. The problem with ditching SLOF is that an unmodified pseries kernel can either start via:
1. kexec, this requires presence of RTAS and skips ibm,client-architecture-support entirely;
2. normal boot, this heavily relies on the OF1275 client interface to fetch the device tree and do early setup (claim memory).This adds a new bios-less mode to the pseries machine: "bios=on|off". When enabled, QEMU does not load SLOF and jumps to the kernel from "-kernel".
The client interface is implemented exactly as RTAS - a 20 bytes blob, right next after the RTAS blob. The entry point is passed to the kernel via GPR5.
This implements a handful of client interface methods just to get going. In particular, this implements the device tree fetching, ibm,client-architecture-support and instantiate-rtas.
This implements changing FDT properties for RTAS (for vmlinux and zImage) and initramdisk location (for zImage). To make this work, this skips
fdt_pack()when bios=off as not packing the blob leaves some room for appending.This assigns "phandles" to device tree nodes as there is no more SLOF and OF nodes addresses of which served as phandle values. This keeps predefined nodes (such as XICS/NVLINK/...) unchanged. phandles are regenerated at every FDT rebuild.
Quoted 8 lines
Quoted 3 lines
This defines phandles for VIO devices to have phandle assigned to the default stdout device at the point when we write "/chosen/stdout" which an ihandle which the OS uses to write to the console.
And I do not really need to preallocate phandles for stdout as it is a leftover from when I populated /chosen/stdout before populating VIO nodes, now /chosen/stdout is added at the very end. Thanks,
Quoted 5 lines
Ah noo, I do, to implement "write" to the selected stdout as I need to trace ihandle back to Object* and
object_resolve_path()does not know about FDT path, it is /machine/peripheral/svty0 in QOM. The commit log needs an update, or this needs a fix but I cannot think of a nicer one. Thanks,
I just might extend instances to do real instances, i.e. associate ihandle with phandle _and_ Object*, I just need a helper to find Object which matches what qdev_get_fw_dev_path() returns. Fun :)
Quoted 25 lines
Quoted 24 lines
Quoted 21 lines
When bios=off, this adds "/chosen" every time QEMU builds a tree.
This implements "claim" which the client (Linux) uses for memory allocation; this is also used by QEMU for claiming kernel/initrd images, client interface entry point, RTAS and the initial stack.
While at this, add a "kernel-addr" machine parameter to allow moving the kernel in memory. This is useful for debugging if the kernel is loaded at @0, although not necessary.
This adds very basic instances support which are managed by a hashmap
ihandle->phandle.Note that a 64bit PCI fix is required for Linux:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=df5be5be8735e
Signature · 1 line
Alexey
Quoted 58 lines · Alexey Kardashevskiy
Quoted 48 lines · Alexey Kardashevskiy
Quoted 35 lines · Alexey Kardashevskiy
Quoted 32 lines · Alexey Kardashevskiy
The Petitboot bootloader is way more advanced than SLOF is ever going to be as Petitboot comes with the full-featured Linux kernel with all the drivers, and initramdisk with quite user friendly interface. The problem with ditching SLOF is that an unmodified pseries kernel can either start via:
1. kexec, this requires presence of RTAS and skips ibm,client-architecture-support entirely;
2. normal boot, this heavily relies on the OF1275 client interface to fetch the device tree and do early setup (claim memory).This adds a new bios-less mode to the pseries machine: "bios=on|off". When enabled, QEMU does not load SLOF and jumps to the kernel from "-kernel".
The client interface is implemented exactly as RTAS - a 20 bytes blob, right next after the RTAS blob. The entry point is passed to the kernel via GPR5.
This implements a handful of client interface methods just to get going. In particular, this implements the device tree fetching, ibm,client-architecture-support and instantiate-rtas.
This implements changing FDT properties for RTAS (for vmlinux and zImage) and initramdisk location (for zImage). To make this work, this skips
fdt_pack()when bios=off as not packing the blob leaves some room for appending.This assigns "phandles" to device tree nodes as there is no more SLOF and OF nodes addresses of which served as phandle values. This keeps predefined nodes (such as XICS/NVLINK/...) unchanged. phandles are regenerated at every FDT rebuild.
Quoted 8 lines
Quoted 3 lines
This defines phandles for VIO devices to have phandle assigned to the default stdout device at the point when we write "/chosen/stdout" which an ihandle which the OS uses to write to the console.
And I do not really need to preallocate phandles for stdout as it is a leftover from when I populated /chosen/stdout before populating VIO nodes, now /chosen/stdout is added at the very end. Thanks,
Quoted 5 lines
Ah noo, I do, to implement "write" to the selected stdout as I need to trace ihandle back to Object* and
object_resolve_path()does not know about FDT path, it is /machine/peripheral/svty0 in QOM. The commit log needs an update, or this needs a fix but I cannot think of a nicer one. Thanks,
Quoted 3 lines
I just might extend instances to do real instances, i.e. associate ihandle with phandle _and_ Object*, I just need a helper to find Object which matches what
qdev_get_fw_dev_path()returns. Fun :)
If you only allow one instance per device, could you just make ihandles == phandle | CONSTANT?
Signature · 4 lines
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
Quoted 59 lines · David Gibson
Quoted 58 lines · Alexey Kardashevskiy
Quoted 53 lines · Alexey Kardashevskiy
Quoted 35 lines · Alexey Kardashevskiy
Quoted 32 lines · Alexey Kardashevskiy
The Petitboot bootloader is way more advanced than SLOF is ever going to be as Petitboot comes with the full-featured Linux kernel with all the drivers, and initramdisk with quite user friendly interface. The problem with ditching SLOF is that an unmodified pseries kernel can either start via:
1. kexec, this requires presence of RTAS and skips ibm,client-architecture-support entirely;
2. normal boot, this heavily relies on the OF1275 client interface to fetch the device tree and do early setup (claim memory).This adds a new bios-less mode to the pseries machine: "bios=on|off". When enabled, QEMU does not load SLOF and jumps to the kernel from "-kernel".
The client interface is implemented exactly as RTAS - a 20 bytes blob, right next after the RTAS blob. The entry point is passed to the kernel via GPR5.
This implements a handful of client interface methods just to get going. In particular, this implements the device tree fetching, ibm,client-architecture-support and instantiate-rtas.
This implements changing FDT properties for RTAS (for vmlinux and zImage) and initramdisk location (for zImage). To make this work, this skips
fdt_pack()when bios=off as not packing the blob leaves some room for appending.This assigns "phandles" to device tree nodes as there is no more SLOF and OF nodes addresses of which served as phandle values. This keeps predefined nodes (such as XICS/NVLINK/...) unchanged. phandles are regenerated at every FDT rebuild.
Quoted 8 lines
Quoted 3 lines
This defines phandles for VIO devices to have phandle assigned to the default stdout device at the point when we write "/chosen/stdout" which an ihandle which the OS uses to write to the console.
And I do not really need to preallocate phandles for stdout as it is a leftover from when I populated /chosen/stdout before populating VIO nodes, now /chosen/stdout is added at the very end. Thanks,
Ah noo, I do, to implement "write" to the selected stdout as I need to trace ihandle back to Object* and
object_resolve_path()does not know about FDT path, it is /machine/peripheral/svty0 in QOM. The commit log needs an update, or this needs a fix but I cannot think of a nicer one. Thanks,
Quoted 6 lines
Quoted 3 lines
I just might extend instances to do real instances, i.e. associate ihandle with phandle _and_ Object*, I just need a helper to find Object which matches what
qdev_get_fw_dev_path()returns. Fun :)If you only allow one instance per device, could you just make ihandles == phandle | CONSTANT?
I started doing real instances so I am not sure such limiting is worth it.
Signature · 1 line
Alexey