[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v8 3/3] xen/pci: remove logic catering to adding VF without PF


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
  • Date: Fri, 15 Nov 2024 11:09:04 -0500
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=h7wZt1IMcuMFrVXQ5VvCHPZJN8BgmZL4SJb/J4aUccI=; b=E+6MKcwchzuMCUlQLjlDTl+vCookiq+mlQ80eEgWTtx9Fv0Z1/4k881kvx5ZGuc/bIxgIWQgXDcoYqLiswI9hnukHp2BkXDjd2xjSR/8WPJC5ARAJj+nXmobCZvR9igrW1lsFLfHlT/ajVxZIgRd9uBot4456/hvfEgCgk52M+olrnmCSEqvjxmeHK3Y79hWvoViquDVcYFurguEGsS3Y2PnGYWX1rUWKXgmaRZvgamMtw2hMwkR9NJQ85odBoQEqA0KoaH6fO3ftUGsJ335644R6iImcy71689p6GSD6KDdgYnp7ZKIsv9RnEB1wdx4JCxvGSsU0LHzbgWei1BL0A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=s7PNeZvildj1e/UGOukygLOJYFvd8+M49rvjZf8tQsQ17fskhNSbp9gpjizWmrWz99K4YhMtYs7jMaQ3r7zSmOmXlIcflGCuxD/4YdKoqtH2UwfmYuLEfJU48dEyzzsZz92zXZI6/t44r4FCJ+6TfXJ7LXWC3v3oQVNy3gCXHrOMueqHWpFtFk0cpvlL7GE063LnPjJ93UlWxRqvUjE0/IwrUzL+r62PlKA76NGOStAioub9v92MNTsKqJZ21rdFUWrSXCP8Cw33sV5ZDCJBUu+I/jO6ytnMDLUONo+s4Vr+yPSeWgv/p2bkvKwIJ15uOtvMXWcmlfChog+8b0Wtew==
  • Cc: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Fri, 15 Nov 2024 16:09:38 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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@xxxxxxx>
---
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




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.