From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44400) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFtSd-0001oz-Cf for qemu-devel@nongnu.org; Mon, 26 Jan 2015 18:52:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YFtSa-000417-71 for qemu-devel@nongnu.org; Mon, 26 Jan 2015 18:52:51 -0500 From: dvaleev@suse.de Date: Tue, 27 Jan 2015 00:52:20 +0100 Message-Id: <1422316341-28983-2-git-send-email-dvaleev@suse.de> In-Reply-To: <1422316341-28983-1-git-send-email-dvaleev@suse.de> References: <1422316341-28983-1-git-send-email-dvaleev@suse.de> Subject: [Qemu-devel] [PATCH 1/2] sPAPR: reread boot_device on reset List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Dinar Valeev , Gonglei , qemu-ppc@nongnu.org, Alexander Graf , armbru@redhat.com From: Dinar Valeev Update boot_device on reset. This is required to have -boot once=X working. This patch is moving creating fdt qemu,boot-device entry from spapr_create_fdt_skel to spapr_finalize_fdt which is used on guest reset. Signed-off-by: Dinar Valeev --- hw/ppc/spapr.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index b560459..36b0bdb 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -318,7 +318,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) { @@ -411,9 +410,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))); } @@ -730,6 +726,8 @@ static void spapr_finalize_fdt(sPAPREnvironment *spapr, char *bootlist; void *fdt; sPAPRPHBState *phb; + MachineState *machine = MACHINE(qdev_get_machine()); + const char *boot_device = machine->boot_order; fdt = g_malloc(FDT_MAX_SIZE); @@ -769,6 +767,14 @@ static void spapr_finalize_fdt(sPAPREnvironment *spapr, fprintf(stderr, "Couldn't finalize CPU device tree properties\n"); } + if (boot_device) { + int offset = fdt_path_offset(fdt, "/chosen"); + ret = fdt_setprop_string(fdt, offset, "qemu,boot-device", boot_device); + if (ret < 0) { + fprintf(stderr, "Couldn't set up boot-device dt property\n"); + } + } + bootlist = get_boot_devices_list(&cb, true); if (cb && bootlist) { int offset = fdt_path_offset(fdt, "/chosen"); @@ -1347,7 +1353,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; @@ -1601,8 +1606,7 @@ 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); } -- 2.1.2