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

[RFC,FUTURE 3/3] tools: libxl: use "vslot" parameter when assigning a PCI device


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Date: Wed, 13 Dec 2023 23:44:58 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=YpRsE4hzDvT+283KhRaNySn9/iNEhYA8xfPItLgPBVE=; b=VmtLGRjOOiKw1o/IzNQWy+yT2ygjytJaqQPk8ZT9hA7o5+cPM3vJxD3BtrDjA+06itBLMwKmcy15e5qW6RxxYlwVms/FTE1YX9BHAZ5+K1Zak5GM3DmBgo+4AQH3HY58ApVuVTCHcujxMiE0xPUPueekt5sJqwnslmqZ1hOiBuucXJS1OtFzCFf8lMeXePrfv8wB0tnGIZv9WedJta23p1y04494wGZqwrsJm10siyhTeyXFs/viCfLfV8qR48UVUi4+BAH43QRGqW1+nMXoLomaXfDQ4P6wmlG0JC5+FngztxPWjatVV4he4eIAVSM4GjcN6zq+Ux/CZqilr+M+aA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=itAaYzhZY9Wp/aQ+boY7W3UK35VF9yEAd1O3Yh+a5ht6XbJ1UcQGystEJmxWmt+EeLQifxECsIQNhFDXba8N0HSI2YOvL1EhGbgcMCW/SXocdyLnrmLi5p/+Ar+TsyoczQFYzDjaNLkY08iuqXH4fUwwkhQennoVtqu7xuHCciDJnnrBz+7MBNqReGFz8NrUge9jVPh8qlzsRG7Ba0sGFYkeCnggPyDdNGOVfqUoOw4tdQjKUEAqMdTYx+fKn5V4gAzyhZYZRHfFpGobDdy7wCsv7fpEBEc6mKBMXdaP7eBl/MihXjCD03FgyOeCjNkyESs+KoKpV7yMtVm8sLYQGw==
  • Cc: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Wei Liu <wl@xxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>
  • Delivery-date: Wed, 13 Dec 2023 23:45:23 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHaLh5hhUhc1caE+UyL8B+mLfWnJg==
  • Thread-topic: [RFC,FUTURE 3/3] tools: libxl: use "vslot" parameter when assigning a PCI device

Now, when "assign_device" domctl supports providing a virtual SBDF, we
can leverage "vslot" option from PCI_SPEC_STRING and pass user
requested function number to the hypervisor.

Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@xxxxxxxx>
---
 tools/libs/light/libxl_pci.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tools/libs/light/libxl_pci.c b/tools/libs/light/libxl_pci.c
index 723e577ef5..13c7b12343 100644
--- a/tools/libs/light/libxl_pci.c
+++ b/tools/libs/light/libxl_pci.c
@@ -1421,6 +1421,7 @@ static void pci_add_dm_done(libxl__egc *egc,
     uint32_t flag = XEN_DOMCTL_DEV_RDM_RELAXED;
     uint32_t domainid = domid;
     bool isstubdom = libxl_is_stubdom(ctx, domid, &domainid);
+    uint32_t vsbdf = XEN_DOMCTL_DEV_SDBF_ANY;
 
     /* Convenience aliases */
     bool starting = pas->starting;
@@ -1524,12 +1525,16 @@ out_no_irq:
             rc = ERROR_FAIL;
             goto out;
         }
-        r = xc_assign_device(ctx->xch, domid, pci_encode_bdf(pci), NULL, flag);
+        if (pci->vdevfn)
+            vsbdf = pci->vdevfn;
+
+        r = xc_assign_device(ctx->xch, domid, pci_encode_bdf(pci), &vsbdf, 
flag);
         if (r < 0 && (hvm || errno != ENOSYS)) {
             LOGED(ERROR, domainid, "xc_assign_device failed");
             rc = ERROR_FAIL;
             goto out;
         }
+        LOGD(DEBUG, domainid, "Got vSBDF %x", vsbdf);
     }
 
     if (!libxl_get_stubdom_id(CTX, domid))
-- 
2.43.0



 


Rackspace

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