* [Qemu-devel] [PATCH 0/3] fix network booting when using "-device" instead of "-net nic"
@ 2010-04-06 22:22 Eduardo Habkost
2010-04-06 22:22 ` [Qemu-devel] [PATCH 1/3] net: remove NICInfo.bootable field Eduardo Habkost
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Eduardo Habkost @ 2010-04-06 22:22 UTC (permalink / raw)
To: qemu-devel
This series fixes the following issue:
$ 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
$
Patches 1 and 3 are just cleanups. The actual fix is on patch 2.
Eduardo Habkost (3):
Kill NICInfo.bootable field
kill broken net_set_boot_mask() boot device validation
kill unused boot_devices_bitmap variable
net.c | 20 --------------------
net.h | 2 --
vl.c | 13 ++++---------
3 files changed, 4 insertions(+), 31 deletions(-)
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH 1/3] net: remove NICInfo.bootable field
2010-04-06 22:22 [Qemu-devel] [PATCH 0/3] fix network booting when using "-device" instead of "-net nic" Eduardo Habkost
@ 2010-04-06 22:22 ` Eduardo Habkost
2010-04-06 22:22 ` [Qemu-devel] [PATCH 2/3] net: remove broken net_set_boot_mask() boot device validation Eduardo Habkost
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Eduardo Habkost @ 2010-04-06 22:22 UTC (permalink / raw)
To: qemu-devel
It is just set by net_set_boot_mask() and never used. The logic for rom loading
changed a lot since this field was introduced. It is not needed anymore.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
net.c | 1 -
net.h | 1 -
2 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/net.c b/net.c
index 3ede738..faa54b4 100644
--- a/net.c
+++ b/net.c
@@ -1207,7 +1207,6 @@ void net_set_boot_mask(int net_boot_mask)
for (i = 0; i < nb_nics; i++) {
if (net_boot_mask & (1 << i)) {
- nd_table[i].bootable = 1;
net_boot_mask &= ~(1 << i);
}
}
diff --git a/net.h b/net.h
index 16f19c5..991f0fa 100644
--- a/net.h
+++ b/net.h
@@ -132,7 +132,6 @@ struct NICInfo {
VLANState *vlan;
VLANClientState *netdev;
int used;
- int bootable;
int nvectors;
};
--
1.7.0.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH 2/3] net: remove broken net_set_boot_mask() boot device validation
2010-04-06 22:22 [Qemu-devel] [PATCH 0/3] fix network booting when using "-device" instead of "-net nic" Eduardo Habkost
2010-04-06 22:22 ` [Qemu-devel] [PATCH 1/3] net: remove NICInfo.bootable field Eduardo Habkost
@ 2010-04-06 22:22 ` Eduardo Habkost
2010-04-06 22:22 ` [Qemu-devel] [PATCH 3/3] boot: remove unused boot_devices_bitmap variable Eduardo Habkost
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Eduardo Habkost @ 2010-04-06 22:22 UTC (permalink / raw)
To: qemu-devel
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 <ehabkost@redhat.com>
---
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);
--
1.7.0.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH 3/3] boot: remove unused boot_devices_bitmap variable
2010-04-06 22:22 [Qemu-devel] [PATCH 0/3] fix network booting when using "-device" instead of "-net nic" Eduardo Habkost
2010-04-06 22:22 ` [Qemu-devel] [PATCH 1/3] net: remove NICInfo.bootable field Eduardo Habkost
2010-04-06 22:22 ` [Qemu-devel] [PATCH 2/3] net: remove broken net_set_boot_mask() boot device validation Eduardo Habkost
@ 2010-04-06 22:22 ` Eduardo Habkost
2010-04-07 9:59 ` [Qemu-devel] Re: [PATCH 0/3] fix network booting when using "-device" instead of "-net nic" Juan Quintela
2010-04-10 0:13 ` [Qemu-devel] " Aurelien Jarno
4 siblings, 0 replies; 6+ messages in thread
From: Eduardo Habkost @ 2010-04-06 22:22 UTC (permalink / raw)
To: qemu-devel
In addition to removing the variable, this also renames the parse_bootdevices()
function to validate_bootdevices(), as we don't need its return value anymore.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
vl.c | 8 +++-----
1 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/vl.c b/vl.c
index ea60bf4..41db7c5 100644
--- a/vl.c
+++ b/vl.c
@@ -1246,7 +1246,7 @@ int qemu_boot_set(const char *boot_devices)
return boot_set_handler(boot_set_opaque, boot_devices);
}
-static int parse_bootdevices(char *devices)
+static void validate_bootdevices(char *devices)
{
/* We just do some generic consistency checks */
const char *p;
@@ -1272,7 +1272,6 @@ static int parse_bootdevices(char *devices)
}
bitmap |= 1 << (*p - 'a');
}
- return bitmap;
}
static void restore_boot_devices(void *opaque)
@@ -2619,7 +2618,6 @@ static const QEMUOption *lookup_opt(int argc, char **argv,
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;
const char *icount_option = NULL;
@@ -2938,13 +2936,13 @@ int main(int argc, char **argv, char **envp)
if (legacy ||
get_param_value(buf, sizeof(buf), "order", optarg)) {
- boot_devices_bitmap = parse_bootdevices(buf);
+ validate_bootdevices(buf);
pstrcpy(boot_devices, sizeof(boot_devices), buf);
}
if (!legacy) {
if (get_param_value(buf, sizeof(buf),
"once", optarg)) {
- boot_devices_bitmap |= parse_bootdevices(buf);
+ validate_bootdevices(buf);
standard_boot_devices = qemu_strdup(boot_devices);
pstrcpy(boot_devices, sizeof(boot_devices), buf);
qemu_register_reset(restore_boot_devices,
--
1.7.0.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Qemu-devel] Re: [PATCH 0/3] fix network booting when using "-device" instead of "-net nic"
2010-04-06 22:22 [Qemu-devel] [PATCH 0/3] fix network booting when using "-device" instead of "-net nic" Eduardo Habkost
` (2 preceding siblings ...)
2010-04-06 22:22 ` [Qemu-devel] [PATCH 3/3] boot: remove unused boot_devices_bitmap variable Eduardo Habkost
@ 2010-04-07 9:59 ` Juan Quintela
2010-04-10 0:13 ` [Qemu-devel] " Aurelien Jarno
4 siblings, 0 replies; 6+ messages in thread
From: Juan Quintela @ 2010-04-07 9:59 UTC (permalink / raw)
To: Eduardo Habkost; +Cc: qemu-devel
Eduardo Habkost <ehabkost@redhat.com> wrote:
> This series fixes the following issue:
>
> $ 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
> $
>
> Patches 1 and 3 are just cleanups. The actual fix is on patch 2.
Nice cleanup. It just removes dead code that was hurting.
Acked-by: Juan Quintela <quintela@redhat.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH 0/3] fix network booting when using "-device" instead of "-net nic"
2010-04-06 22:22 [Qemu-devel] [PATCH 0/3] fix network booting when using "-device" instead of "-net nic" Eduardo Habkost
` (3 preceding siblings ...)
2010-04-07 9:59 ` [Qemu-devel] Re: [PATCH 0/3] fix network booting when using "-device" instead of "-net nic" Juan Quintela
@ 2010-04-10 0:13 ` Aurelien Jarno
4 siblings, 0 replies; 6+ messages in thread
From: Aurelien Jarno @ 2010-04-10 0:13 UTC (permalink / raw)
To: Eduardo Habkost; +Cc: qemu-devel
On Tue, Apr 06, 2010 at 07:22:05PM -0300, Eduardo Habkost wrote:
> This series fixes the following issue:
>
> $ 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
> $
>
> Patches 1 and 3 are just cleanups. The actual fix is on patch 2.
Thanks, all applied.
--
Aurelien Jarno GPG: 1024D/F1BCDB73
aurelien@aurel32.net http://www.aurel32.net
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-04-10 1:12 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-06 22:22 [Qemu-devel] [PATCH 0/3] fix network booting when using "-device" instead of "-net nic" Eduardo Habkost
2010-04-06 22:22 ` [Qemu-devel] [PATCH 1/3] net: remove NICInfo.bootable field Eduardo Habkost
2010-04-06 22:22 ` [Qemu-devel] [PATCH 2/3] net: remove broken net_set_boot_mask() boot device validation Eduardo Habkost
2010-04-06 22:22 ` [Qemu-devel] [PATCH 3/3] boot: remove unused boot_devices_bitmap variable Eduardo Habkost
2010-04-07 9:59 ` [Qemu-devel] Re: [PATCH 0/3] fix network booting when using "-device" instead of "-net nic" Juan Quintela
2010-04-10 0:13 ` [Qemu-devel] " Aurelien Jarno
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).