The hardware domain is expected to add a PF first before adding
associated VFs. If adding happens out of order, print a warning and
return an error. Drop the recursive call to pci_add_device().
Signed-off-by: Stewart Hildebrand <stewart.hildebrand@amd.com>
---
Not for backport
v7->v8:
* new patch, split from PF<->VF links
---
xen/drivers/passthrough/pci.c | 31 +++++++------------------------
1 file changed, 7 insertions(+), 24 deletions(-)
diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
index 6af1136b6350..f50dfaed75ba 100644
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -699,30 +699,13 @@ int pci_add_device(u16 seg, u8 bus, u8 devfn,
if ( !pf_pdev )
{
- ret = pci_add_device(seg, info->physfn.bus, info->physfn.devfn,
- NULL, node);
- if ( ret )
- {
- printk(XENLOG_WARNING
- "Failed to add SR-IOV device PF %pp for VF %pp\n",
- &PCI_SBDF(seg, info->physfn.bus, info->physfn.devfn),
- &pdev->sbdf);
- free_pdev(pseg, pdev);
- goto out;
- }
- pf_pdev = pci_get_pdev(NULL, PCI_SBDF(seg, info->physfn.bus,
- info->physfn.devfn));
- if ( !pf_pdev )
- {
- printk(XENLOG_ERR
- "Inconsistent PCI state: failed to find newly added PF %pp for VF %pp\n",
- &PCI_SBDF(seg, info->physfn.bus, info->physfn.devfn),
- &pdev->sbdf);
- ASSERT_UNREACHABLE();
- free_pdev(pseg, pdev);
- ret = -EILSEQ;
- goto out;
- }
+ printk(XENLOG_WARNING
+ "Attempted to add SR-IOV VF %pp without PF %pp\n",
+ &pdev->sbdf,
+ &PCI_SBDF(seg, info->physfn.bus, info->physfn.devfn));
+ free_pdev(pseg, pdev);
+ ret = -ENODEV;
+ goto out;
}
if ( !pdev->pf_pdev )
--
2.47.0