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

[Xen-changelog] [xen staging] libxl: do not attach xen-pciback to HVM domain, if stubdomain is in use



commit 83aa53f110941a6a4609ad1842dd7dc033d9fe44
Author:     Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
AuthorDate: Sat Sep 28 15:20:35 2019 +0100
Commit:     Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
CommitDate: Fri Oct 4 17:04:51 2019 +0100

    libxl: do not attach xen-pciback to HVM domain, if stubdomain is in use
    
    HVM domains use IOMMU and device model assistance for communicating with
    PCI devices, xen-pcifront/pciback isn't directly needed by HVM domain.
    But pciback serve also second function - it reset the device when it is
    deassigned from the guest and for this reason pciback needs to be used
    with HVM domain too.
    When HVM domain has device model in stubdomain, attaching xen-pciback to
    the target domain itself may prevent attaching xen-pciback to the
    (PV) stubdomain, effectively breaking PCI passthrough.
    
    Fix this by attaching pciback only to one domain: if PV stubdomain is in
    use, let it be stubdomain (the commit prevents attaching device to target
    HVM in this case); otherwise, attach it to the target domain.
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
    Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx>
    Release-acked-by: Juergen Gross <jgross@xxxxxxxx>
---
 tools/libxl/libxl_pci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/libxl/libxl_pci.c b/tools/libxl/libxl_pci.c
index eae086e503..46c18c8689 100644
--- a/tools/libxl/libxl_pci.c
+++ b/tools/libxl/libxl_pci.c
@@ -1399,7 +1399,7 @@ out_no_irq:
         }
     }
 
-    if (!starting)
+    if (!starting && !libxl_get_stubdom_id(CTX, domid))
         rc = libxl__device_pci_add_xenstore(gc, domid, pcidev, starting);
     else
         rc = 0;
@@ -1699,7 +1699,7 @@ static void add_pcidevs_done(libxl__egc *egc, 
libxl__multidev *multidev,
 
     if (rc) goto out;
 
-    if (d_config->num_pcidevs > 0) {
+    if (d_config->num_pcidevs > 0 && !libxl_get_stubdom_id(CTX, domid)) {
         rc = libxl__create_pci_backend(gc, domid, d_config->pcidevs,
             d_config->num_pcidevs);
         if (rc < 0) {
--
generated by git-patchbot for /home/xen/git/xen.git#staging

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

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