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

[Xen-changelog] [xen master] libxl: keep assigned pci devices across domain reboots



commit 99a9c70583bd6dc2555b242353821a32cf1948a9
Author:     Roger Pau Monne <roger.pau@xxxxxxxxxx>
AuthorDate: Thu Sep 20 12:40:25 2018 +0200
Commit:     Wei Liu <wei.liu2@xxxxxxxxxx>
CommitDate: Fri Sep 21 17:13:00 2018 +0100

    libxl: keep assigned pci devices across domain reboots
    
    Fill the from_xenstore libxl_device_type hook for PCI devices so that
    libxl_retrieve_domain_configuration can properly retrieve PCI devices
    from xenstore.
    
    This fixes disappearing pci devices across domain reboots.
    
    Reported-by: Andreas Kinzler <hfp@xxxxxxxxx>
    Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
    Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
    Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
 tools/libxl/libxl_pci.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/tools/libxl/libxl_pci.c b/tools/libxl/libxl_pci.c
index 4755a0c93c..87afa03d9e 100644
--- a/tools/libxl/libxl_pci.c
+++ b/tools/libxl/libxl_pci.c
@@ -1549,8 +1549,7 @@ int libxl_device_pci_destroy(libxl_ctx *ctx, uint32_t 
domid,
 
 static void libxl__device_pci_from_xs_be(libxl__gc *gc,
                                          const char *be_path,
-                                         libxl_device_pci *pci,
-                                         int nr)
+                                         int nr, libxl_device_pci *pci)
 {
     char *s;
     unsigned int domain = 0, bus = 0, dev = 0, func = 0, vdevfn = 0;
@@ -1604,7 +1603,7 @@ libxl_device_pci *libxl_device_pci_list(libxl_ctx *ctx, 
uint32_t domid, int *num
     pcidevs = calloc(n, sizeof(libxl_device_pci));
 
     for (i = 0; i < n; i++)
-        libxl__device_pci_from_xs_be(gc, be_path, pcidevs + i, i);
+        libxl__device_pci_from_xs_be(gc, be_path, i, pcidevs + i);
 
     *num = n;
 out:
@@ -1688,7 +1687,9 @@ static int libxl_device_pci_compare(libxl_device_pci *d1,
 
 #define libxl__device_pci_update_devid NULL
 
-DEFINE_DEVICE_TYPE_STRUCT_X(pcidev, pci, PCI);
+DEFINE_DEVICE_TYPE_STRUCT_X(pcidev, pci, PCI,
+    .from_xenstore = (device_from_xenstore_fn_t)libxl__device_pci_from_xs_be,
+);
 
 /*
  * Local variables:
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
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®.