mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 00:03:54 -06:00
hw/i386/pc: support '-nic' for xen-net-device
The default NIC creation seems a bit hackish to me. I don't understand why each platform has to call pci_nic_init_nofail() from a point in the code where it actually has a pointer to the PCI bus, and then we have the special cases for things like ne2k_isa. If qmp_device_add() can *find* the appropriate bus and instantiate the device on it, why can't we just do that from generic code for creating the default NICs too? But that isn't a yak I want to shave today. Add a xenbus field to the PCMachineState so that it can make its way from pc_basic_device_init() to pc_nic_init() and be handled as a special case like ne2k_isa is. Now we can launch emulated Xen guests with '-nic user'. Signed-off-by: David Woodhouse <dwmw@amazon.co.uk> Reviewed-by: Paul Durrant <paul@xen.org>
This commit is contained in:
parent
25967ff69f
commit
c10b4b3c0d
6 changed files with 17 additions and 8 deletions
|
@ -1133,11 +1133,13 @@ static void xen_register_types(void)
|
|||
|
||||
type_init(xen_register_types)
|
||||
|
||||
void xen_bus_init(void)
|
||||
BusState *xen_bus_init(void)
|
||||
{
|
||||
DeviceState *dev = qdev_new(TYPE_XEN_BRIDGE);
|
||||
BusState *bus = qbus_new(TYPE_XEN_BUS, dev, NULL);
|
||||
|
||||
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
|
||||
qbus_set_bus_hotplug_handler(bus);
|
||||
|
||||
return bus;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue