]> xenbits.xensource.com Git - xen.git/commitdiff
xen/pci: remove logic catering to adding VF without PF
authorStewart Hildebrand <stewart.hildebrand@amd.com>
Tue, 26 Nov 2024 10:23:42 +0000 (11:23 +0100)
committerJan Beulich <jbeulich@suse.com>
Tue, 26 Nov 2024 10:23:42 +0000 (11:23 +0100)
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>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/drivers/passthrough/pci.c

index a5ad86267fcb83c2f4e490d3d2dd85ac5482ce15..777c6b1a7fdcac7feb00d59cc049fb6fdd57f151 100644 (file)
@@ -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 )