From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39127) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFhEG-0006G5-Sy for qemu-devel@nongnu.org; Mon, 26 Jan 2015 05:49:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YFhEC-0006kx-Fa for qemu-devel@nongnu.org; Mon, 26 Jan 2015 05:49:12 -0500 Message-ID: <54C61BA2.5000609@suse.de> Date: Mon, 26 Jan 2015 11:49:06 +0100 From: Dinar Valeev MIME-Version: 1.0 References: <1422053517-23781-1-git-send-email-dvaleev@suse.de> <1422053517-23781-2-git-send-email-dvaleev@suse.de> <54C2D399.3080307@suse.de> In-Reply-To: <54C2D399.3080307@suse.de> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 2/2] hw/ppc/spapr Add qemu_register_boot_set for SPAPR List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Graf , qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, Dinar Valeev On 01/24/2015 12:04 AM, Alexander Graf wrote: > > > On 23.01.15 23:51, dvaleev@suse.de wrote: >> From: Dinar Valeev >> >> In order to have -boot once=d functioning, it is required to have >> qemu_register_boot_set >> >> qemu-system-ppc64 -enable-kvm -boot once=d >> >> Ready! >> 0 > dev /chosen ok >> 0 > .properties >> ... >> qemu,boot-device d >> ... >> 0 > reset-all >> >> Ready! >> 0 > dev /chosen ok >> 0 > .properties >> ... >> qemu,boot-device cdn >> ... >> >> Signed-off-by: Dinar Valeev >> --- >> hw/ppc/spapr.c | 12 ++++++++++++ >> 1 file changed, 12 insertions(+) >> >> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c >> index 3d2cfa3..38b03fc 100644 >> --- a/hw/ppc/spapr.c >> +++ b/hw/ppc/spapr.c >> @@ -314,6 +314,16 @@ static void add_str(GString *s, const gchar *s1) >> g_string_append_len(s, s1, strlen(s1) + 1); >> } >> >> +static void spapr_boot_set(void *opaque, const char *boot_device, >> + Error **errp) >> +{ >> + int offset; >> + offset = fdt_path_offset(opaque, "/chosen"); >> + fdt_setprop_string(opaque, offset, "qemu,boot-device", boot_device); >> + >> +} >> + >> + >> static void *spapr_create_fdt_skel(hwaddr initrd_base, >> hwaddr initrd_size, >> hwaddr kernel_size, >> @@ -414,6 +424,8 @@ static void *spapr_create_fdt_skel(hwaddr initrd_base, >> if (boot_device) { >> _FDT((fdt_property_string(fdt, "qemu,boot-device", boot_device))); >> } >> + qemu_register_boot_set(spapr_boot_set, fdt); > > If you simply move the code above (the _FDT() one) from create_fdt_skel > to spapr_finalize_fdt() you should have the same net effect and much > cleaner code :). I've tried your proposal, on reset boot-device property stays "d" qemu,boot-device d 0 > reset-all qemu,boot-device d Here is what I tried: @@ -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"); Dinar, > > Alex > >> + >> if (boot_menu) { >> _FDT((fdt_property_cell(fdt, "qemu,boot-menu", boot_menu))); >> } >>