From patchwork Fri Apr 26 12:12:48 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dominik Dingel X-Patchwork-Id: 239858 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 76A442C0114 for ; Fri, 26 Apr 2013 22:47:06 +1000 (EST) Received: from localhost ([::1]:48072 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UVi3M-0006dn-OY for incoming@patchwork.ozlabs.org; Fri, 26 Apr 2013 08:47:04 -0400 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 d06dlp01.portsmouth.uk.ibm.com (9.149.20.13) by e06smtp16.uk.ibm.com (192.168.101.146) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 26 Apr 2013 13:10:20 +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 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d06av09.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id r3QCD09O028870; Fri, 26 Apr 2013 06:13:01 -0600 Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 2944) id D5611122442E; Fri, 26 Apr 2013 14:13:00 +0200 (CEST) From: Dominik Dingel To: qemu-devel@nongnu.org Date: Fri, 26 Apr 2013 14:12:48 +0200 Message-Id: <1366978377-16823-2-git-send-email-dingel@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.12.4 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> X-TM-AS-MML: No X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13042612-3548-0000-0000-00000538329D X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 195.75.94.112 Cc: Christian Borntraeger , Alexander Graf , Dominik Dingel Subject: [Qemu-devel] [PATCH 01/10] Common: Add a default bootindex for all applicable devices X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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;