From: Gonglei <arei.gong...@huawei.com> Device should be removed from global boot list when it is hot-unplugged.
Signed-off-by: Chenliang <chenlian...@huawei.com> Signed-off-by: Gonglei <arei.gong...@huawei.com> --- hw/block/virtio-blk.c | 1 + hw/i386/kvm/pci-assign.c | 1 + hw/misc/vfio.c | 1 + hw/net/e1000.c | 1 + hw/net/eepro100.c | 1 + hw/net/ne2000.c | 1 + hw/net/rtl8139.c | 1 + hw/net/virtio-net.c | 1 + hw/net/vmxnet3.c | 1 + hw/scsi/scsi-generic.c | 1 + hw/usb/dev-network.c | 1 + hw/usb/host-libusb.c | 1 + hw/usb/redirect.c | 1 + 13 files changed, 13 insertions(+) diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c index c241c50..49813d5 100644 --- a/hw/block/virtio-blk.c +++ b/hw/block/virtio-blk.c @@ -786,6 +786,7 @@ static void virtio_blk_device_unrealize(DeviceState *dev, Error **errp) VirtIODevice *vdev = VIRTIO_DEVICE(dev); VirtIOBlock *s = VIRTIO_BLK(dev); + del_boot_device_path(dev); #ifdef CONFIG_VIRTIO_BLK_DATA_PLANE remove_migration_state_change_notifier(&s->migration_state_notifier); virtio_blk_data_plane_destroy(s->dataplane); diff --git a/hw/i386/kvm/pci-assign.c b/hw/i386/kvm/pci-assign.c index de33657..1322479 100644 --- a/hw/i386/kvm/pci-assign.c +++ b/hw/i386/kvm/pci-assign.c @@ -1853,6 +1853,7 @@ static void assigned_exitfn(struct PCIDevice *pci_dev) { AssignedDevice *dev = DO_UPCAST(AssignedDevice, dev, pci_dev); + del_boot_device_path(&pci_dev->qdev); deassign_device(dev); free_assigned_device(dev); } diff --git a/hw/misc/vfio.c b/hw/misc/vfio.c index 0b9eba0..f891312 100644 --- a/hw/misc/vfio.c +++ b/hw/misc/vfio.c @@ -4304,6 +4304,7 @@ static void vfio_exitfn(PCIDevice *pdev) VFIODevice *vdev = DO_UPCAST(VFIODevice, pdev, pdev); VFIOGroup *group = vdev->group; + del_boot_device_path(&pdev->qdev); vfio_unregister_err_notifier(vdev); pci_device_set_intx_routing_notifier(&vdev->pdev, NULL); vfio_disable_interrupts(vdev); diff --git a/hw/net/e1000.c b/hw/net/e1000.c index 0fc29a0..fa4e858 100644 --- a/hw/net/e1000.c +++ b/hw/net/e1000.c @@ -1492,6 +1492,7 @@ pci_e1000_uninit(PCIDevice *dev) { E1000State *d = E1000(dev); + del_boot_device_path(DEVICE(dev)); timer_del(d->autoneg_timer); timer_free(d->autoneg_timer); timer_del(d->mit_timer); diff --git a/hw/net/eepro100.c b/hw/net/eepro100.c index 3263e3f..62951e4 100644 --- a/hw/net/eepro100.c +++ b/hw/net/eepro100.c @@ -1843,6 +1843,7 @@ static void pci_nic_uninit(PCIDevice *pci_dev) { EEPRO100State *s = DO_UPCAST(EEPRO100State, dev, pci_dev); + del_boot_device_path(&pci_dev->qdev); memory_region_destroy(&s->mmio_bar); memory_region_destroy(&s->io_bar); memory_region_destroy(&s->flash_bar); diff --git a/hw/net/ne2000.c b/hw/net/ne2000.c index d558b8c..62afa65 100644 --- a/hw/net/ne2000.c +++ b/hw/net/ne2000.c @@ -748,6 +748,7 @@ static void pci_ne2000_exit(PCIDevice *pci_dev) PCINE2000State *d = DO_UPCAST(PCINE2000State, dev, pci_dev); NE2000State *s = &d->ne2000; + del_boot_device_path(&pci_dev->qdev); memory_region_destroy(&s->io); qemu_del_nic(s->nic); qemu_free_irq(s->irq); diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c index 90bc5ec..b34c91a 100644 --- a/hw/net/rtl8139.c +++ b/hw/net/rtl8139.c @@ -3462,6 +3462,7 @@ static void pci_rtl8139_uninit(PCIDevice *dev) { RTL8139State *s = RTL8139(dev); + del_boot_device_path(DEVICE(dev)); memory_region_destroy(&s->bar_io); memory_region_destroy(&s->bar_mem); if (s->cplus_txbuffer) { diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 268eff9..0419575 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -1654,6 +1654,7 @@ static void virtio_net_device_unrealize(DeviceState *dev, Error **errp) virtio_net_set_status(vdev, 0); unregister_savevm(dev, "virtio-net", n); + del_boot_device_path(dev); g_free(n->netclient_name); n->netclient_name = NULL; diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c index 77bea6f..c10d84e 100644 --- a/hw/net/vmxnet3.c +++ b/hw/net/vmxnet3.c @@ -2176,6 +2176,7 @@ static void vmxnet3_pci_uninit(PCIDevice *pci_dev) VMW_CBPRN("Starting uninit..."); unregister_savevm(dev, "vmxnet3-msix", s); + del_boot_device_path(dev); vmxnet3_net_uninit(s); diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c index 3733d2c..b270bc7 100644 --- a/hw/scsi/scsi-generic.c +++ b/hw/scsi/scsi-generic.c @@ -388,6 +388,7 @@ static void scsi_generic_reset(DeviceState *dev) static void scsi_destroy(SCSIDevice *s) { + del_boot_device_path(&s->qdev); scsi_device_purge_requests(s, SENSE_CODE(NO_SENSE)); blockdev_mark_auto_del(s->conf.bs); } diff --git a/hw/usb/dev-network.c b/hw/usb/dev-network.c index 518d536..be39802 100644 --- a/hw/usb/dev-network.c +++ b/hw/usb/dev-network.c @@ -1331,6 +1331,7 @@ static void usb_net_handle_destroy(USBDevice *dev) /* TODO: remove the nd_table[] entry */ rndis_clear_responsequeue(s); qemu_del_nic(s->nic); + del_boot_device_path(&dev->qdev); } static NetClientInfo net_usbnet_info = { diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c index c189147..919a0d2 100644 --- a/hw/usb/host-libusb.c +++ b/hw/usb/host-libusb.c @@ -984,6 +984,7 @@ static void usb_host_handle_destroy(USBDevice *udev) { USBHostDevice *s = USB_HOST_DEVICE(udev); + del_boot_device_path(&udev->qdev); qemu_remove_exit_notifier(&s->exit); QTAILQ_REMOVE(&hostdevs, s, next); usb_host_close(s); diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c index 44522d9..33df3af 100644 --- a/hw/usb/redirect.c +++ b/hw/usb/redirect.c @@ -1416,6 +1416,7 @@ static void usbredir_handle_destroy(USBDevice *udev) { USBRedirDevice *dev = DO_UPCAST(USBRedirDevice, dev, udev); + del_boot_device_path(&udev->qdev); qemu_chr_delete(dev->cs); dev->cs = NULL; /* Note must be done after qemu_chr_close, as that causes a close event */ -- 1.7.12.4