diff options
Diffstat (limited to 'hw/ppc/spapr.c')
-rw-r--r-- | hw/ppc/spapr.c | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 7febff7ed2..ca0a060b92 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -314,7 +314,6 @@ static void *spapr_create_fdt_skel(hwaddr initrd_base, hwaddr initrd_size, hwaddr kernel_size, bool little_endian, - const char *boot_device, const char *kernel_cmdline, uint32_t epow_irq) { @@ -407,9 +406,6 @@ static void *spapr_create_fdt_skel(hwaddr initrd_base, _FDT((fdt_property(fdt, "qemu,boot-kernel-le", NULL, 0))); } } - if (boot_device) { - _FDT((fdt_property_string(fdt, "qemu,boot-device", boot_device))); - } if (boot_menu) { _FDT((fdt_property_cell(fdt, "qemu,boot-menu", boot_menu))); } @@ -721,6 +717,8 @@ static void spapr_finalize_fdt(sPAPREnvironment *spapr, hwaddr rtas_addr, hwaddr rtas_size) { + MachineState *machine = MACHINE(qdev_get_machine()); + const char *boot_device = machine->boot_order; int ret, i; size_t cb = 0; char *bootlist; @@ -780,6 +778,15 @@ static void spapr_finalize_fdt(sPAPREnvironment *spapr, ret = fdt_setprop_string(fdt, offset, "qemu,boot-list", bootlist); } + if (boot_device && strlen(boot_device)) { + int offset = fdt_path_offset(fdt, "/chosen"); + + if (offset < 0) { + exit(1); + } + fdt_setprop_string(fdt, offset, "qemu,boot-device", boot_device); + } + if (!spapr->has_graphics) { spapr_populate_chosen_stdout(fdt, spapr->vio_bus); } @@ -1370,6 +1377,13 @@ static SaveVMHandlers savevm_htab_handlers = { .load_state = htab_load, }; +static void spapr_boot_set(void *opaque, const char *boot_device, + Error **errp) +{ + MachineState *machine = MACHINE(qdev_get_machine()); + machine->boot_order = g_strdup(boot_device); +} + /* pSeries LPAR / sPAPR hardware init */ static void ppc_spapr_init(MachineState *machine) { @@ -1378,7 +1392,6 @@ static void ppc_spapr_init(MachineState *machine) const char *kernel_filename = machine->kernel_filename; const char *kernel_cmdline = machine->kernel_cmdline; const char *initrd_filename = machine->initrd_filename; - const char *boot_device = machine->boot_order; PowerPCCPU *cpu; CPUPPCState *env; PCIHostState *phb; @@ -1647,9 +1660,10 @@ static void ppc_spapr_init(MachineState *machine) /* Prepare the device tree */ spapr->fdt_skel = spapr_create_fdt_skel(initrd_base, initrd_size, kernel_size, kernel_le, - boot_device, kernel_cmdline, - spapr->epow_irq); + kernel_cmdline, spapr->epow_irq); assert(spapr->fdt_skel != NULL); + + qemu_register_boot_set(spapr_boot_set, spapr); } static int spapr_kvm_type(const char *vm_type) @@ -1779,7 +1793,7 @@ static void spapr_machine_class_init(ObjectClass *oc, void *data) mc->block_default_type = IF_SCSI; mc->max_cpus = MAX_CPUS; mc->no_parallel = 1; - mc->default_boot_order = NULL; + mc->default_boot_order = ""; mc->kvm_type = spapr_kvm_type; mc->has_dynamic_sysbus = true; |