summary refs log tree commit diff stats
path: root/hw/pci/pcie.c
diff options
context:
space:
mode:
authorKnut Omang <knut.omang@oracle.com>2022-02-17 18:44:50 +0100
committerMichael S. Tsirkin <mst@redhat.com>2022-03-06 05:08:23 -0500
commit7c0fa8dff811b5648964630a1334c3bb97e1e1c6 (patch)
tree3cb11701448115f4033bf78ef3175dff3e3c38c3 /hw/pci/pcie.c
parent0ea5778f066ea5c5e73246a4c11f0773edc4c45d (diff)
downloadfocaccia-qemu-7c0fa8dff811b5648964630a1334c3bb97e1e1c6.tar.gz
focaccia-qemu-7c0fa8dff811b5648964630a1334c3bb97e1e1c6.zip
pcie: Add support for Single Root I/O Virtualization (SR/IOV)
This patch provides the building blocks for creating an SR/IOV
PCIe Extended Capability header and register/unregister
SR/IOV Virtual Functions.

Signed-off-by: Knut Omang <knuto@ifi.uio.no>
Message-Id: <20220217174504.1051716-2-lukasz.maniak@linux.intel.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/pci/pcie.c')
-rw-r--r--hw/pci/pcie.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/hw/pci/pcie.c b/hw/pci/pcie.c
index d7d73a31e4..3c44204cf3 100644
--- a/hw/pci/pcie.c
+++ b/hw/pci/pcie.c
@@ -446,6 +446,11 @@ void pcie_cap_slot_plug_cb(HotplugHandler *hotplug_dev, DeviceState *dev,
     PCIDevice *pci_dev = PCI_DEVICE(dev);
     uint32_t lnkcap = pci_get_long(exp_cap + PCI_EXP_LNKCAP);
 
+    if (pci_is_vf(pci_dev)) {
+        /* Virtual function cannot be physically disconnected */
+        return;
+    }
+
     /* Don't send event when device is enabled during qemu machine creation:
      * it is present on boot, no hotplug event is necessary. We do send an
      * event when the device is disabled later. */