From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54370) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YM6Fl-00047C-SI for qemu-devel@nongnu.org; Thu, 12 Feb 2015 21:45:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YM6Fh-0003BJ-Mv for qemu-devel@nongnu.org; Thu, 12 Feb 2015 21:45:13 -0500 Received: from szxga02-in.huawei.com ([119.145.14.65]:34683) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YM6Fh-00038O-57 for qemu-devel@nongnu.org; Thu, 12 Feb 2015 21:45:09 -0500 Message-ID: <54DD651A.2060504@huawei.com> Date: Fri, 13 Feb 2015 10:44:42 +0800 From: Gonglei MIME-Version: 1.0 References: <1423293616-10736-1-git-send-email-arei.gonglei@huawei.com> <1423293616-10736-5-git-send-email-arei.gonglei@huawei.com> <87oaoza0qq.fsf@blackfin.pond.sub.org> In-Reply-To: <87oaoza0qq.fsf@blackfin.pond.sub.org> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v3 4/4] bootdevice: update boot_order in MachineState List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: peter.huangpeng@huawei.com, dvaleev@suse.de, Dinar Valeev , qemu-devel@nongnu.org, agraf@suse.de On 2015/2/12 18:21, Markus Armbruster wrote: > writes: > >> From: Dinar Valeev >> >> on sPAPR we need to update boot_order in MachineState in case it >> got changed on reset. >> >> Signed-off-by: Dinar Valeev >> Reviewed-by: Alexey Kardashevskiy >> Signed-off-by: Gonglei >> --- >> bootdevice.c | 4 ++++ >> 1 file changed, 4 insertions(+) >> >> diff --git a/bootdevice.c b/bootdevice.c >> index d3d4277..ac586b1 100644 >> --- a/bootdevice.c >> +++ b/bootdevice.c >> @@ -26,6 +26,7 @@ >> #include "qapi/visitor.h" >> #include "qemu/error-report.h" >> #include "hw/hw.h" >> +#include "hw/boards.h" >> >> typedef struct FWBootEntry FWBootEntry; >> >> @@ -50,6 +51,7 @@ void qemu_register_boot_set(QEMUBootSetHandler *func, void *opaque) >> void qemu_boot_set(const char *boot_order, Error **errp) >> { >> Error *local_err = NULL; >> + MachineState *machine = MACHINE(qdev_get_machine()); >> >> validate_bootdevices(boot_order, &local_err); >> if (local_err) { >> @@ -57,6 +59,8 @@ void qemu_boot_set(const char *boot_order, Error **errp) >> return; >> } >> >> + machine->boot_order = boot_order; >> + >> if (boot_set_handler) { >> boot_set_handler(boot_set_opaque, boot_order, errp); >> } > > Looks harmless enough, but I'm afraid I don't quite understand why we > need this. Can you explain it to me real slow? :) > Alex pointed that there is two reset logic for boot order, one is machine struct (machine->order) and another is set_boot_handler by parameter. But the qemu_boot_set() only support to use set_boot_handler to set boot order. So, I decide to remove the check for boot_set_handler if NULL or not (PATCH 1), and change the value of machine->boot_order in qemu_boot_set(). But I ignored this change cause a regression for HMP command set_boot. To avoid the regression, we only support one way to set boot_order, that is set_boot_handler. Fortunately the patches for supporting boot 'once' argument on sPAPR on the flight. We have the opportunity to drop this change and avoid the regression. Regards, -Gonglei