From patchwork Mon Jan 26 23:52:20 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: dvaleev@suse.de X-Patchwork-Id: 433077 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 80FBA140145 for ; Tue, 27 Jan 2015 10:53:54 +1100 (AEDT) Received: from localhost ([::1]:44627 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFtTc-00035r-Qr for incoming@patchwork.ozlabs.org; Mon, 26 Jan 2015 18:53:52 -0500 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 Received: from cantor2.suse.de ([195.135.220.15]:56327 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFtSa-00040z-0k; Mon, 26 Jan 2015 18:52:48 -0500 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 77737AD8B; Mon, 26 Jan 2015 23:52:47 +0000 (UTC) From: dvaleev@suse.de To: qemu-devel@nongnu.org Date: Tue, 27 Jan 2015 00:52:20 +0100 Message-Id: <1422316341-28983-2-git-send-email-dvaleev@suse.de> X-Mailer: git-send-email 2.1.2 In-Reply-To: <1422316341-28983-1-git-send-email-dvaleev@suse.de> References: <1422316341-28983-1-git-send-email-dvaleev@suse.de> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 195.135.220.15 Cc: Dinar Valeev , Gonglei , qemu-ppc@nongnu.org, Alexander Graf , armbru@redhat.com Subject: [Qemu-devel] [PATCH 1/2] sPAPR: reread boot_device on reset X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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); }