Received: from eggs.gnu.org ([2001:4830:134:3::10]:60294) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFivc-0005tG-AQ for qemu-devel@nongnu.org; Mon, 26 Jan 2015 07:38:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YFivW-0004T5-Bj for qemu-devel@nongnu.org; Mon, 26 Jan 2015 07:38:04 -0500 Received: from mx1.redhat.com ([209.132.183.28]:51554) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFivW-0004Sz-2n for qemu-devel@nongnu.org; Mon, 26 Jan 2015 07:37:58 -0500 From: Markus Armbruster References: <1422053517-23781-1-git-send-email-dvaleev@suse.de> <877fw9kiti.fsf@blackfin.pond.sub.org> <54C617A7.8050207@suse.de> Date: Mon, 26 Jan 2015 13:37:54 +0100 In-Reply-To: <54C617A7.8050207@suse.de> (Dinar Valeev's message of "Mon, 26 Jan 2015 11:32:07 +0100") Message-ID: <87mw55d8f1.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH 1/2] hw/ppc/spapr.c Set default boot order List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Dinar Valeev Cc: Dinar Valeev , qemu-devel@nongnu.org, Alexander Graf Dinar Valeev writes: > On 01/26/2015 10:11 AM, Markus Armbruster wrote: >> dvaleev@suse.de writes: >> >>> From: Dinar Valeev >>> >>> In order to use -boot once=X option we need to have default list >>> where restore to on reset. >> >> Really? What happens without this patch? >> > qemu segfaults on reset. > 0 > reset-all Segmentation fault Next time, include a backtrace, please. Here's what I think happens. Boot order comes from --boot parameter once, order, or else the machine type's .default_boot_order. The latter is null for you. It gets passed via ppc_spapr_init() to spapr_create_fdt_skel(), which sets qemu,boot-device in the FDT to it, but only when it isn't null. If it comes from parameter once, we additionally register a reset handler to switch it to parameter order or else .default_boot_order on reset. If you specify once, but not order, this is null for you. On reset, reset handler restore_boot_order() runs. Unlike spapr_create_fdt_skel(), it doesn't check for null, and crashes in validate_bootdevices(). Correct? For me, a null .default_boot_order means "machine type does not support boot order" (this is how commit c165473 treats it). Arguably, --boot order and once should be rejected then. If I understand you correctly, your machine type does support boot order. Giving it a non-null .default_boot_order makes sense then. The appropriate value depends on firmware. It could even be "". The null check in spapr_create_fdt_skel() looks superfluous then. Consider dropping it. Makes sense?