diff options
author | Alexander Graf <agraf@suse.de> | 2015-03-18 13:30:44 +0100 |
---|---|---|
committer | Alexander Graf <agraf@suse.de> | 2015-03-25 22:49:46 +0100 |
commit | 5b2128d27051fe036ac36e8e860e72490b27a369 (patch) | |
tree | 46537f6b62cb6c8227a4d017adeb4cec7572b3c8 /hw | |
parent | fda276c7aafe2bfc9df808e61abd25cb834a0254 (diff) |
PPC: pseries: Implement boot once=foo
On sPAPR we haven't supported boot once ever since it emerged, but
recently grew need for it. This patch implements boot once logic
to it.
While at it, we also move to the new bootdevice handling that got
introduced to the tree recently.
Reported-by: Dinar Valeev <dvaleev@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'hw')
-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; |