All of lore.kernel.org
 help / color / mirror / Atom feed
From: Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
To: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Cc: Stewart Hildebrand <stewart.hildebrand@amd.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Julien Grall <julien@xen.org>,
	Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>,
	Wei Liu <wl@xen.org>, Anthony PERARD <anthony.perard@citrix.com>,
	Juergen Gross <jgross@suse.com>
Subject: [RFC,FUTURE 3/3] tools: libxl: use "vslot" parameter when assigning a PCI device
Date: Wed, 13 Dec 2023 23:44:58 +0000	[thread overview]
Message-ID: <20231213234345.779722-4-volodymyr_babchuk@epam.com> (raw)
In-Reply-To: <20231213234345.779722-1-volodymyr_babchuk@epam.com>

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@epam.com>
---
 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


      parent reply	other threads:[~2023-12-13 23:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-13 23:44 [RFC,FUTURE 0/3] Make vSBDF configurable by toolstack Volodymyr Babchuk
2023-12-13 23:44 ` [RFC,FUTURE 1/3] domctl/pci: add ability to provide/request a virtual SBDF Volodymyr Babchuk
2024-04-22 15:28   ` Jan Beulich
2023-12-13 23:44 ` [RFC,FUTURE 2/3] tools: libxc: add virtual_sbdf parameter to xc_assign_device Volodymyr Babchuk
2023-12-13 23:44 ` Volodymyr Babchuk [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231213234345.779722-4-volodymyr_babchuk@epam.com \
    --to=volodymyr_babchuk@epam.com \
    --cc=anthony.perard@citrix.com \
    --cc=jgross@suse.com \
    --cc=julien@xen.org \
    --cc=sstabellini@kernel.org \
    --cc=stewart.hildebrand@amd.com \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.