diff options
author | Akihiko Odaki <akihiko.odaki@daynix.com> | 2024-07-15 14:19:09 +0900 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2024-07-22 20:15:41 -0400 |
commit | 78f9d7fd1989311040beff54979bcb2a1ba0aff2 (patch) | |
tree | 80c60f13814eee53d291800a5e29b585c36b4da1 /hw/pci/pcie_sriov.c | |
parent | ca6dd3aef8a103138c99788bcba8195d4905ddc5 (diff) | |
download | qemu-78f9d7fd1989311040beff54979bcb2a1ba0aff2.zip qemu-78f9d7fd1989311040beff54979bcb2a1ba0aff2.tar.gz qemu-78f9d7fd1989311040beff54979bcb2a1ba0aff2.tar.bz2 |
pcie_sriov: Ensure PF and VF are mutually exclusive
A device cannot be a SR-IOV PF and a VF at the same time.
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Message-Id: <20240715-sriov-v5-3-3f5539093ffc@daynix.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/pci/pcie_sriov.c')
-rw-r--r-- | hw/pci/pcie_sriov.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/hw/pci/pcie_sriov.c b/hw/pci/pcie_sriov.c index 56523ab..6c79658 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_vf(dev)) { + error_setg(errp, "a device cannot be both an SR-IOV PF and a VF"); + return false; + } + if (total_vfs) { uint16_t ari_cap = pcie_find_capability(dev, PCI_EXT_CAP_ID_ARI); uint16_t first_vf_devfn = dev->devfn + vf_offset; |