The below referenced commit introduced a change where devices under a root port slot are reset in response to removing power to the slot. This improves emulation relative to bare metal when the slot is powered off, but introduces an unnecessary step when devices under that slot are slated for removal.
In the case of an assigned device, there are mandatory delays associated with many device reset mechanisms which can stall the hot unplug operation. Also, in cases where the unplug request is triggered via a release operation of the host driver, internal device locking in the host kernel may result in a failure of the device reset mechanism, which generates unnecessary log warnings. Skip the reset for devices that are slated for unplug. Cc: qemu-sta...@nongnu.org Fixes: d5daff7d3126 ("pcie: implement slot power control for pcie root ports") Signed-off-by: Alex Williamson <alex.william...@redhat.com> --- hw/pci/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index e5993c1ef52b..f594da410797 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -2869,7 +2869,7 @@ void pci_set_power(PCIDevice *d, bool state) memory_region_set_enabled(&d->bus_master_enable_region, (pci_get_word(d->config + PCI_COMMAND) & PCI_COMMAND_MASTER) && d->has_power); - if (!d->has_power) { + if (!d->has_power && !d->qdev.pending_deleted_event) { pci_device_reset(d); } }