Received: from eggs.gnu.org ([208.118.235.92]:41621) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UVi33-00060b-R0 for qemu-devel@nongnu.org; Fri, 26 Apr 2013 08:46:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UVhXR-0002X7-Vp for qemu-devel@nongnu.org; Fri, 26 Apr 2013 08:14:36 -0400 Received: from e06smtp16.uk.ibm.com ([195.75.94.112]:58503) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UVhXR-0002WL-I3 for qemu-devel@nongnu.org; Fri, 26 Apr 2013 08:14:05 -0400 Received: from /spool/local by e06smtp16.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 26 Apr 2013 13:10:22 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id 4E33117D8017 for ; Fri, 26 Apr 2013 13:15:01 +0100 (BST) Received: from d06av09.portsmouth.uk.ibm.com (d06av09.portsmouth.uk.ibm.com [9.149.37.250]) by b06cxnps3074.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r3QCCq4i50528480 for ; Fri, 26 Apr 2013 12:12:52 GMT Received: from d06av09.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av09.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r3QCD1Cr028875 for ; Fri, 26 Apr 2013 06:13:01 -0600 From: Dominik Dingel Date: Fri, 26 Apr 2013 14:12:48 +0200 Message-Id: <1366978377-16823-2-git-send-email-dingel@linux.vnet.ibm.com> In-Reply-To: <1366978377-16823-1-git-send-email-dingel@linux.vnet.ibm.com> References: <1366978377-16823-1-git-send-email-dingel@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH 01/10] Common: Add a default bootindex for all applicable devices List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Christian Borntraeger , Alexander Graf , Dominik Dingel Currently only devices with a positive boot index will be pushed in the fw_boot_order queue, so if no boot index at all will be specified, the queue ends up empty. Instead we push exactly as docs/bootindex.txt says the devices with the lowest possible boot priority at the tail of the queue, because we give them the highest available boot index. Signed-off-by: Dominik Dingel diff --git a/vl.c b/vl.c index 6caa5f4..84d7031 100644 --- a/vl.c +++ b/vl.c @@ -248,7 +248,7 @@ struct FWBootEntry { char *suffix; }; -static QTAILQ_HEAD(, FWBootEntry) fw_boot_order = +static QTAILQ_HEAD(FWBootOrder, FWBootEntry) fw_boot_order = QTAILQ_HEAD_INITIALIZER(fw_boot_order); int nb_numa_nodes; @@ -1213,10 +1213,21 @@ void add_boot_device_path(int32_t bootindex, DeviceState *dev, FWBootEntry *node, *i; if (bootindex < 0) { - return; + bootindex = INT32_MAX; + if (!QTAILQ_EMPTY(&fw_boot_order) && + (QTAILQ_LAST(&fw_boot_order, FWBootOrder)->bootindex == INT32_MAX)) { + /* there is a device at the end of the queue, so we need to walk + the queue reverse to get the next free bootindex */ + QTAILQ_FOREACH_REVERSE(i, &fw_boot_order, FWBootOrder, link) { + if (i->bootindex != bootindex) { + break; + } + bootindex--; + } + } } - assert(dev != NULL || suffix != NULL); + assert(dev != NULL || suffix != NULL || bootindex >= 0); node = g_malloc0(sizeof(FWBootEntry)); node->bootindex = bootindex; -- 1.7.9.5