mirror of https://github.com/xemu-project/xemu.git
kill dead nic unplug code.
Cleanup on unplug happens via qdev->exit() callback now. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
1cc33683c8
commit
9ad4531e1e
|
@ -702,9 +702,6 @@ static void pciej_write(void *opaque, uint32_t addr, uint32_t val)
|
||||||
QLIST_FOREACH_SAFE(qdev, &bus->children, sibling, next) {
|
QLIST_FOREACH_SAFE(qdev, &bus->children, sibling, next) {
|
||||||
dev = DO_UPCAST(PCIDevice, qdev, qdev);
|
dev = DO_UPCAST(PCIDevice, qdev, qdev);
|
||||||
if (PCI_SLOT(dev->devfn) == slot) {
|
if (PCI_SLOT(dev->devfn) == slot) {
|
||||||
#if defined (TARGET_I386)
|
|
||||||
pci_device_hot_remove_success(dev);
|
|
||||||
#endif
|
|
||||||
qdev_free(qdev);
|
qdev_free(qdev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,19 +46,3 @@ DriveInfo *add_init_drive(const char *optstr)
|
||||||
|
|
||||||
return dinfo;
|
return dinfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
void destroy_nic(dev_match_fn *match_fn, void *arg)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
NICInfo *nic;
|
|
||||||
|
|
||||||
for (i = 0; i < MAX_NICS; i++) {
|
|
||||||
nic = &nd_table[i];
|
|
||||||
if (nic->used) {
|
|
||||||
if (nic->private && match_fn(nic->private, arg)) {
|
|
||||||
qemu_del_vlan_client(nic->vc);
|
|
||||||
net_client_uninit(nic);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -234,28 +234,3 @@ void do_pci_device_hot_remove(Monitor *mon, const QDict *qdict)
|
||||||
{
|
{
|
||||||
pci_device_hot_remove(mon, qdict_get_str(qdict, "pci_addr"));
|
pci_device_hot_remove(mon, qdict_get_str(qdict, "pci_addr"));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pci_match_fn(void *dev_private, void *arg)
|
|
||||||
{
|
|
||||||
PCIDevice *dev = dev_private;
|
|
||||||
PCIDevice *match = arg;
|
|
||||||
|
|
||||||
return (dev == match);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* OS has executed _EJ0 method, we now can remove the device
|
|
||||||
*/
|
|
||||||
void pci_device_hot_remove_success(PCIDevice *d)
|
|
||||||
{
|
|
||||||
int class_code;
|
|
||||||
|
|
||||||
class_code = d->config_read(d, PCI_CLASS_DEVICE+1, 1);
|
|
||||||
|
|
||||||
switch(class_code) {
|
|
||||||
case PCI_BASE_CLASS_NETWORK:
|
|
||||||
destroy_nic(pci_match_fn, d);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
4
sysemu.h
4
sysemu.h
|
@ -202,17 +202,13 @@ extern DriveInfo *drive_init(QemuOpts *arg, void *machine, int *fatal_error);
|
||||||
|
|
||||||
/* device-hotplug */
|
/* device-hotplug */
|
||||||
|
|
||||||
typedef int (dev_match_fn)(void *dev_private, void *arg);
|
|
||||||
|
|
||||||
DriveInfo *add_init_drive(const char *opts);
|
DriveInfo *add_init_drive(const char *opts);
|
||||||
void destroy_nic(dev_match_fn *match_fn, void *arg);
|
|
||||||
|
|
||||||
/* pci-hotplug */
|
/* pci-hotplug */
|
||||||
void pci_device_hot_add(Monitor *mon, const QDict *qdict);
|
void pci_device_hot_add(Monitor *mon, const QDict *qdict);
|
||||||
void drive_hot_add(Monitor *mon, const QDict *qdict);
|
void drive_hot_add(Monitor *mon, const QDict *qdict);
|
||||||
void pci_device_hot_remove(Monitor *mon, const char *pci_addr);
|
void pci_device_hot_remove(Monitor *mon, const char *pci_addr);
|
||||||
void do_pci_device_hot_remove(Monitor *mon, const QDict *qdict);
|
void do_pci_device_hot_remove(Monitor *mon, const QDict *qdict);
|
||||||
void pci_device_hot_remove_success(PCIDevice *dev);
|
|
||||||
|
|
||||||
/* serial ports */
|
/* serial ports */
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue