pcie_sriov_pf_init_vf_bar: PCI_ROM_SLOT is already out of the SR-IOV
regions.

pcie_sriov_pf_init_from_user_created_vfs: ROM region must never have a
non-zero size.

Signed-off-by: Clement Mathieu--Drif <[email protected]>
---
 hw/pci/pcie_sriov.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/hw/pci/pcie_sriov.c b/hw/pci/pcie_sriov.c
index 6a748c3626..e6891436d3 100644
--- a/hw/pci/pcie_sriov.c
+++ b/hw/pci/pcie_sriov.c
@@ -230,7 +230,6 @@ void pcie_sriov_pf_init_vf_bar(PCIDevice *dev, int 
region_num,
     assert(sriov_cap > 0);
     assert(region_num >= 0);
     assert(region_num < PCI_SRIOV_NUM_BARS);
-    assert(region_num != PCI_ROM_SLOT);
 
     wmask = ~(size - 1);
     addr = sriov_cap + PCI_SRIOV_BAR + region_num * 4;
@@ -344,6 +343,8 @@ int16_t pcie_sriov_pf_init_from_user_created_vfs(PCIDevice 
*dev,
     dev->exp.sriov_pf.vf = vfs;
     dev->exp.sriov_pf.vf_user_created = true;
 
+    assert(vfs[0]->io_regions[PCI_ROM_SLOT].size == 0);
+
     for (i = 0; i < PCI_SRIOV_NUM_BARS; i++) {
         PCIIORegion *region = &vfs[0]->io_regions[i];
 
-- 
2.56.0

Reply via email to