From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:56922) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TRTt6-00052m-Hj for qemu-devel@nongnu.org; Thu, 25 Oct 2012 16:18:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TRTt5-0005ur-Gn for qemu-devel@nongnu.org; Thu, 25 Oct 2012 16:18:44 -0400 Received: from e28smtp03.in.ibm.com ([122.248.162.3]:46680) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TRTt4-0005si-RD for qemu-devel@nongnu.org; Thu, 25 Oct 2012 16:18:43 -0400 Received: from /spool/local by e28smtp03.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 26 Oct 2012 01:48:36 +0530 From: Anthony Liguori In-Reply-To: References: <1351175895-27131-1-git-send-email-aviksil@linux.vnet.ibm.com> <1351175895-27131-2-git-send-email-aviksil@linux.vnet.ibm.com> Date: Thu, 25 Oct 2012 15:18:22 -0500 Message-ID: <877gqetiep.fsf@codemonkey.ws> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: [Qemu-devel] [PATCH v2 1/2] Make default boot order machine specific List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell , Avik Sil Cc: david@gibson.dropbear.id.au, qemu-ppc@nongnu.org, qemu-devel@nongnu.org, agraf@suse.de Peter Maydell writes: > On 25 October 2012 15:38, Avik Sil wrote: >> @@ -171,6 +171,7 @@ static QEMUMachine clipper_machine = { >> .init = clipper_init, >> .max_cpus = 4, >> .is_default = 1, >> + .default_machine_opts = DEFAULT_BOOT_ORDER, >> }; > >> @@ -86,6 +86,7 @@ static QEMUMachine an5206_machine = { >> .name = "an5206", >> .desc = "Arnewsh 5206", >> .init = an5206_init, >> + .default_machine_opts = DEFAULT_BOOT_ORDER, >> }; > >> +++ b/hw/axis_dev88.c >> @@ -355,6 +355,7 @@ static QEMUMachine axisdev88_machine = { >> .desc = "AXIS devboard 88", >> .init = axisdev88_init, >> .is_default = 1, >> + .default_machine_opts = DEFAULT_BOOT_ORDER, >> }; > > The thing about a default is that you shouldn't have to > explicitly say it in every QEMUMachine struct... Please > make the code handle a NULL in the struct in a way > that means you don't need to touch every board. I hate to spin a lot on a touch everything patch, but I also agree that this is the wrong approach. I think there are two reasonable approaches to this. One would be a macro to provide default initialization. Something along the lines of: #define DEFAULT_MACHINE_OPTIONS \ .boot_order = "cad" And then: static QEMUMachine axisdev88_machine = { DEFAULT_MACHINE_OPTIONS, ... }; static QEMUMachine pseries_machine = { DEFAULT_MACHINE_OPTIONS, /* no default boot order so we can detect absence of boot option */ .boot_order = NULL, }; Baking this into .default_machines_opts is too much overloading. The other approach to this would be: static QEMUMachine pseries_machine = { .no_boot_order = 1, }; Which I think is what Peter is suggesting. I'm not a huge fan of this because it's backwards logic but we already do this for a bunch of other things so I can't object too strongly to it. Regards, Anthony Liguori > > -- PMM