File 5ba5188c-libxl-keep-assigned-pci-devices-across-domain-reboots.patch of Package xen.19016

Subject: libxl: keep assigned pci devices across domain reboots
From: Roger Pau Monne roger.pau@citrix.com Thu Sep 20 12:40:25 2018 +0200
Date: Fri Sep 21 17:13:00 2018 +0100:
Git: 99a9c70583bd6dc2555b242353821a32cf1948a9

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@posteo.de>
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>

Index: xen-4.10.3-testing/tools/libxl/libxl_pci.c
===================================================================
--- xen-4.10.3-testing.orig/tools/libxl/libxl_pci.c
+++ xen-4.10.3-testing/tools/libxl/libxl_pci.c
@@ -1544,8 +1544,7 @@ int libxl_device_pci_destroy(libxl_ctx *
 
 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;
@@ -1598,7 +1597,7 @@ libxl_device_pci *libxl_device_pci_list(
     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:
@@ -1682,7 +1681,9 @@ static int libxl_device_pci_compare(libx
 
 #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:
openSUSE Build Service is sponsored by