summary refs log tree commit diff stats
path: root/hw/pci/pci.c
diff options
context:
space:
mode:
authorAkihiko Odaki <akihiko.odaki@daynix.com>2024-06-27 15:07:55 +0900
committerMichael S. Tsirkin <mst@redhat.com>2024-07-03 18:14:07 -0400
commit139610ae67f6ecf92127bb7bf53ac6265b459ec8 (patch)
tree776fd6f68a3bd5c92bb244b025ccb9d50078228f /hw/pci/pci.c
parent77718701157f6ca77ea7a57b536fa0a22f676082 (diff)
downloadfocaccia-qemu-139610ae67f6ecf92127bb7bf53ac6265b459ec8.tar.gz
focaccia-qemu-139610ae67f6ecf92127bb7bf53ac6265b459ec8.zip
pcie_sriov: Reuse SR-IOV VF device instances
Disable SR-IOV VF devices by reusing code to power down PCI devices
instead of removing them when the guest requests to disable VFs. This
allows to realize devices and report VF realization errors at PF
realization time.

Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Message-Id: <20240627-reuse-v10-6-7ca0b8ed3d9f@daynix.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/pci/pci.c')
-rw-r--r--hw/pci/pci.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index 68d30feb86..e32a69f3fa 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -2895,7 +2895,7 @@ void pci_set_enabled(PCIDevice *d, bool state)
     memory_region_set_enabled(&d->bus_master_enable_region,
                               (pci_get_word(d->config + PCI_COMMAND)
                                & PCI_COMMAND_MASTER) && d->enabled);
-    if (!d->enabled) {
+    if (d->qdev.realized) {
         pci_device_reset(d);
     }
 }