All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pci: Skip power-off reset when pending unplug
@ 2021-12-20 18:26 Alex Williamson
  2021-12-20 23:03 ` Michael S. Tsirkin
  0 siblings, 1 reply; 10+ messages in thread
From: Alex Williamson @ 2021-12-20 18:26 UTC (permalink / raw)
  To: mst, qemu-devel; +Cc: kraxel

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-stable@nongnu.org
Fixes: d5daff7d3126 ("pcie: implement slot power control for pcie root ports")
Signed-off-by: Alex Williamson <alex.williamson@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);
     }
 }




^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-01-05 19:27 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-20 18:26 [PATCH] pci: Skip power-off reset when pending unplug Alex Williamson
2021-12-20 23:03 ` Michael S. Tsirkin
2021-12-21 16:36   ` Alex Williamson
2021-12-21 23:40     ` Michael S. Tsirkin
2021-12-22 19:08       ` Alex Williamson
2021-12-22 20:48         ` Michael S. Tsirkin
2021-12-22 23:10           ` Alex Williamson
2021-12-23 13:33             ` Michael S. Tsirkin
2022-01-05 19:17               ` Alex Williamson
2021-12-23  7:11         ` Gerd Hoffmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.