Blame 0054-net-remove-broken-net_set_boot_mask-boot-device-vali.patch

Justin M. Forbes 73d3c2
From 905a4bcaf9d4ed3662b901a2820b6e6ca80dc285 Mon Sep 17 00:00:00 2001
Justin M. Forbes 73d3c2
From: Eduardo Habkost <ehabkost@redhat.com>
Justin M. Forbes 73d3c2
Date: Tue, 6 Apr 2010 19:38:52 -0300
Justin M. Forbes 73d3c2
Subject: [PATCH] net: remove broken net_set_boot_mask() boot device validation
Justin M. Forbes 73d3c2
Justin M. Forbes 73d3c2
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=561078
Justin M. Forbes 73d3c2
Justin M. Forbes 73d3c2
There are many problems with net_set_boot_mask():
Justin M. Forbes 73d3c2
Justin M. Forbes 73d3c2
1) It is broken when using the device model instead of "-net nic". Example:
Justin M. Forbes 73d3c2
   $ 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
Justin M. Forbes 73d3c2
   Cannot boot from non-existent NIC
Justin M. Forbes 73d3c2
   $
Justin M. Forbes 73d3c2
2) The mask was previously used to set which boot ROMs were supposed to be
Justin M. Forbes 73d3c2
   loaded, but this was changed long time ago. Now all ROM images are loaded,
Justin M. Forbes 73d3c2
   and SeaBIOS takes care of jumping to the right boot entry point depending on
Justin M. Forbes 73d3c2
   the boot settings.
Justin M. Forbes 73d3c2
3) Interpretation and validation of the boot parameter letters is done on
Justin M. Forbes 73d3c2
   the machine type code. Examples: PC accepts only a,b,c,d,n as valid boot
Justin M. Forbes 73d3c2
   device letters. mac99 accepts only a,b,c,d,e,f.
Justin M. Forbes 73d3c2
Justin M. Forbes 73d3c2
As a side-effect of this change, qemu-kvm won't abort anymore if using "-boot n"
Justin M. Forbes 73d3c2
on a machine with no network devices. Checking if the requested boot device is
Justin M. Forbes 73d3c2
valid is now a task for the BIOS or the machine-type code.
Justin M. Forbes 73d3c2
Justin M. Forbes 73d3c2
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Justin M. Forbes 73d3c2
---
Justin M. Forbes 73d3c2
 net.c |   19 -------------------
Justin M. Forbes 73d3c2
 net.h |    1 -
Justin M. Forbes 73d3c2
 vl.c  |    5 +----
Justin M. Forbes 73d3c2
 3 files changed, 1 insertions(+), 24 deletions(-)
Justin M. Forbes 73d3c2
Justin M. Forbes 73d3c2
diff --git a/net.c b/net.c
Justin M. Forbes 73d3c2
index 5cebb1a..71c0f08 100644
Justin M. Forbes 73d3c2
--- a/net.c
Justin M. Forbes 73d3c2
+++ b/net.c
Justin M. Forbes 73d3c2
@@ -1195,25 +1195,6 @@ void net_host_device_remove(Monitor *mon, const QDict *qdict)
Justin M. Forbes 73d3c2
     qemu_del_vlan_client(vc);
Justin M. Forbes 73d3c2
 }
Justin M. Forbes 73d3c2
Justin M. Forbes 73d3c2
-void net_set_boot_mask(int net_boot_mask)
Justin M. Forbes 73d3c2
-{
Justin M. Forbes 73d3c2
-    int i;
Justin M. Forbes 73d3c2
-
Justin M. Forbes 73d3c2
-    /* Only the first four NICs may be bootable */
Justin M. Forbes 73d3c2
-    net_boot_mask = net_boot_mask & 0xF;
Justin M. Forbes 73d3c2
-
Justin M. Forbes 73d3c2
-    for (i = 0; i < nb_nics; i++) {
Justin M. Forbes 73d3c2
-        if (net_boot_mask & (1 << i)) {
Justin M. Forbes 73d3c2
-            net_boot_mask &= ~(1 << i);
Justin M. Forbes 73d3c2
-        }
Justin M. Forbes 73d3c2
-    }
Justin M. Forbes 73d3c2
-
Justin M. Forbes 73d3c2
-    if (net_boot_mask) {
Justin M. Forbes 73d3c2
-        fprintf(stderr, "Cannot boot from non-existent NIC\n");
Justin M. Forbes 73d3c2
-        exit(1);
Justin M. Forbes 73d3c2
-    }
Justin M. Forbes 73d3c2
-}
Justin M. Forbes 73d3c2
-
Justin M. Forbes 73d3c2
 void do_info_network(Monitor *mon)
Justin M. Forbes 73d3c2
 {
Justin M. Forbes 73d3c2
     VLANState *vlan;
Justin M. Forbes 73d3c2
diff --git a/net.h b/net.h
Justin M. Forbes 73d3c2
index 5b6e814..2b2ee4c 100644
Justin M. Forbes 73d3c2
--- a/net.h
Justin M. Forbes 73d3c2
+++ b/net.h
Justin M. Forbes 73d3c2
@@ -165,7 +165,6 @@ int net_client_parse(QemuOptsList *opts_list, const char *str);
Justin M. Forbes 73d3c2
 int net_init_clients(void);
Justin M. Forbes 73d3c2
 void net_check_clients(void);
Justin M. Forbes 73d3c2
 void net_cleanup(void);
Justin M. Forbes 73d3c2
-void net_set_boot_mask(int boot_mask);
Justin M. Forbes 73d3c2
 void net_host_device_add(Monitor *mon, const QDict *qdict);
Justin M. Forbes 73d3c2
 void net_host_device_remove(Monitor *mon, const QDict *qdict);
Justin M. Forbes 73d3c2
Justin M. Forbes 73d3c2
diff --git a/vl.c b/vl.c
Justin M. Forbes 73d3c2
index c75f891..349f945 100644
Justin M. Forbes 73d3c2
--- a/vl.c
Justin M. Forbes 73d3c2
+++ b/vl.c
Justin M. Forbes 73d3c2
@@ -4922,7 +4922,7 @@ int main(int argc, char **argv, char **envp)
Justin M. Forbes 73d3c2
     const char *gdbstub_dev = NULL;
Justin M. Forbes 73d3c2
     uint32_t boot_devices_bitmap = 0;
Justin M. Forbes 73d3c2
     int i;
Justin M. Forbes 73d3c2
-    int snapshot, linux_boot, net_boot;
Justin M. Forbes 73d3c2
+    int snapshot, linux_boot;
Justin M. Forbes 73d3c2
     const char *initrd_filename;
Justin M. Forbes 73d3c2
     const char *kernel_filename, *kernel_cmdline;
Justin M. Forbes 73d3c2
     char boot_devices[33] = "cad"; /* default to HD->floppy->CD-ROM */
Justin M. Forbes 73d3c2
@@ -5961,9 +5961,6 @@ int main(int argc, char **argv, char **envp)
Justin M. Forbes 73d3c2
         exit(1);
Justin M. Forbes 73d3c2
     }
Justin M. Forbes 73d3c2
Justin M. Forbes 73d3c2
-    net_boot = (boot_devices_bitmap >> ('n' - 'a')) & 0xF;
Justin M. Forbes 73d3c2
-    net_set_boot_mask(net_boot);
Justin M. Forbes 73d3c2
-
Justin M. Forbes 73d3c2
     /* init the bluetooth world */
Justin M. Forbes 73d3c2
     if (foreach_device_config(DEV_BT, bt_parse))
Justin M. Forbes 73d3c2
         exit(1);
Justin M. Forbes 73d3c2
-- 
Justin M. Forbes 73d3c2
1.6.6.1
Justin M. Forbes 73d3c2