aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkihiko Odaki <akihiko.odaki@daynix.com>2024-07-15 14:19:10 +0900
committerMichael S. Tsirkin <mst@redhat.com>2024-07-22 20:15:41 -0400
commit47cc753e50076c25334091783738be9f716253b1 (patch)
treeaa5fcc807f669ea040ab741306eaf270425faeef
parent78f9d7fd1989311040beff54979bcb2a1ba0aff2 (diff)
downloadqemu-47cc753e50076c25334091783738be9f716253b1.zip
qemu-47cc753e50076c25334091783738be9f716253b1.tar.gz
qemu-47cc753e50076c25334091783738be9f716253b1.tar.bz2
pcie_sriov: Check PCI Express for SR-IOV PF
SR-IOV requires PCI Express. Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Message-Id: <20240715-sriov-v5-4-3f5539093ffc@daynix.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
-rw-r--r--hw/pci/pcie_sriov.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/hw/pci/pcie_sriov.c b/hw/pci/pcie_sriov.c
index 6c79658..15a4aac 100644
--- a/hw/pci/pcie_sriov.c
+++ b/hw/pci/pcie_sriov.c
@@ -42,6 +42,11 @@ bool pcie_sriov_pf_init(PCIDevice *dev, uint16_t offset,
uint8_t *cfg = dev->config + offset;
uint8_t *wmask;
+ if (!pci_is_express(dev)) {
+ error_setg(errp, "PCI Express is required for SR-IOV PF");
+ return false;
+ }
+
if (pci_is_vf(dev)) {
error_setg(errp, "a device cannot be both an SR-IOV PF and a VF");
return false;