From patchwork Tue Apr 6 22:22:07 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 49552 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 1D9A8B7D6A for ; Wed, 7 Apr 2010 08:26:30 +1000 (EST) Received: from localhost ([127.0.0.1]:47794 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NzHE2-0004gn-O9 for incoming@patchwork.ozlabs.org; Tue, 06 Apr 2010 18:26:26 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NzHAC-0003rI-Nl for qemu-devel@nongnu.org; Tue, 06 Apr 2010 18:22:28 -0400 Received: from [140.186.70.92] (port=39668 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NzHAB-0003pv-BD for qemu-devel@nongnu.org; Tue, 06 Apr 2010 18:22:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NzHA8-0005Es-Ck for qemu-devel@nongnu.org; Tue, 06 Apr 2010 18:22:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:2162) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NzHA8-0005Ec-45 for qemu-devel@nongnu.org; Tue, 06 Apr 2010 18:22:24 -0400 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o36MMHo9014200 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 6 Apr 2010 18:22:18 -0400 Received: from blackpad.lan.raisama.net (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx04.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o36MMC3V016596 for ; Tue, 6 Apr 2010 18:22:14 -0400 Received: by blackpad.lan.raisama.net (Postfix, from userid 500) id EEFD817FE23; Tue, 6 Apr 2010 19:22:08 -0300 (BRT) From: Eduardo Habkost To: qemu-devel@nongnu.org Date: Tue, 6 Apr 2010 19:22:07 -0300 Message-Id: <1270592528-23371-3-git-send-email-ehabkost@redhat.com> In-Reply-To: <1270592528-23371-1-git-send-email-ehabkost@redhat.com> References: <1270592528-23371-1-git-send-email-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.17 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Subject: [Qemu-devel] [PATCH 2/3] net: remove broken net_set_boot_mask() boot device validation X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org There are many problems with net_set_boot_mask(): 1) It is broken when using the device model instead of "-net nic". Example: $ qemu-system-x86_64 -device rtl8139,vlan=0,id=net0,mac=52:54:00:82:41:fd,bus=pci.0,addr=0x4 -net user,vlan=0,name=hostnet0 -vnc 0.0.0.0:0 -boot n Cannot boot from non-existent NIC $ 2) The mask was previously used to set which boot ROMs were supposed to be loaded, but this was changed long time ago. Now all ROM images are loaded, and SeaBIOS takes care of jumping to the right boot entry point depending on the boot settings. 3) Interpretation and validation of the boot parameter letters is done on the machine type code. Examples: PC accepts only a,b,c,d,n as valid boot device letters. mac99 accepts only a,b,c,d,e,f. As a side-effect of this change, qemu-kvm won't abort anymore if using "-boot n" on a machine with no network devices. Checking if the requested boot device is valid is now a task for the BIOS or the machine-type code. Signed-off-by: Eduardo Habkost --- net.c | 19 ------------------- net.h | 1 - vl.c | 5 +---- 3 files changed, 1 insertions(+), 24 deletions(-) diff --git a/net.c b/net.c index faa54b4..b66ec7d 100644 --- a/net.c +++ b/net.c @@ -1198,25 +1198,6 @@ void net_host_device_remove(Monitor *mon, const QDict *qdict) qemu_del_vlan_client(vc); } -void net_set_boot_mask(int net_boot_mask) -{ - int i; - - /* Only the first four NICs may be bootable */ - net_boot_mask = net_boot_mask & 0xF; - - for (i = 0; i < nb_nics; i++) { - if (net_boot_mask & (1 << i)) { - net_boot_mask &= ~(1 << i); - } - } - - if (net_boot_mask) { - fprintf(stderr, "Cannot boot from non-existent NIC\n"); - exit(1); - } -} - void do_info_network(Monitor *mon) { VLANState *vlan; diff --git a/net.h b/net.h index 991f0fa..20be8d7 100644 --- a/net.h +++ b/net.h @@ -162,7 +162,6 @@ int net_client_parse(QemuOptsList *opts_list, const char *str); int net_init_clients(void); void net_check_clients(void); void net_cleanup(void); -void net_set_boot_mask(int boot_mask); void net_host_device_add(Monitor *mon, const QDict *qdict); void net_host_device_remove(Monitor *mon, const QDict *qdict); diff --git a/vl.c b/vl.c index 6768cf1..ea60bf4 100644 --- a/vl.c +++ b/vl.c @@ -2621,7 +2621,7 @@ int main(int argc, char **argv, char **envp) const char *gdbstub_dev = NULL; uint32_t boot_devices_bitmap = 0; int i; - int snapshot, linux_boot, net_boot; + int snapshot, linux_boot; const char *icount_option = NULL; const char *initrd_filename; const char *kernel_filename, *kernel_cmdline; @@ -3630,9 +3630,6 @@ int main(int argc, char **argv, char **envp) exit(1); } - net_boot = (boot_devices_bitmap >> ('n' - 'a')) & 0xF; - net_set_boot_mask(net_boot); - /* init the bluetooth world */ if (foreach_device_config(DEV_BT, bt_parse)) exit(1);