@@ -457,6 +457,7 @@ static void pcie_unplug_device(PCIBus *bus, PCIDevice *dev, void *opaque)
HotplugHandler *hotplug_ctrl = qdev_get_hotplug_handler(DEVICE(dev));
if (dev->partially_hotplugged) {
+ dev->qdev.pending_deleted_event = false;
return;
}
hotplug_handler_unplug(hotplug_ctrl, DEVICE(dev), &error_abort);
@@ -476,6 +477,8 @@ void pcie_cap_slot_unplug_request_cb(HotplugHandler *hotplug_dev,
return;
}
+ dev->pending_deleted_event = true;
+
/* In case user cancel the operation of multi-function hot-add,
* remove the function that is unexposed to guest individually,
* without interaction with guest.
Set pending_deleted_event before triggering the unplug request and reset it in the unplug handler when the device is marked as partially hotplugged. This is required to be able to plug it back in in case of a migration failure. Signed-off-by: Jens Freimann <jfreimann@redhat.com> --- hw/pci/pcie.c | 3 +++ 1 file changed, 3 insertions(+)