libxl: keep assigned pci devices across domain reboots
PATCH 1/1 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.
---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>
Cc: Andreas Kinzler <[email protected]>
--- tools/libxl/libxl_pci.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
tools/libxl/libxl_pci.c +5 -4
@@ -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:
Signature · 7 lines
2.19.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Roger Pau Monne writes ("[PATCH] libxl: keep assigned pci devices across domain reboots"):
Quoted 5 lines
Fill the
from_xenstorelibxl_device_typehook for PCI devices so thatlibxl_retrieve_domain_configurationcan properly retrieve PCI devices from xenstore.This fixes disappearing pci devices across domain reboots.
It would have been nice to mention, in the commit message, the reason for swapping the arguments to libxl__device_pci_from_xs_be. But it's fine as it is.
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 8 lines · Roger Pau Monne
Fill the
from_xenstorelibxl_device_typehook for PCI devices so thatlibxl_retrieve_domain_configurationcan properly retrieve PCI devices from xenstore.This fixes disappearing pci devices across domain reboots.
Reported-by Andreas Kinzler <[email protected]>Signed-off-by Roger Pau Monné <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Hi,
Quoted 6 lines · Roger Pau Monne
Fill the
from_xenstorelibxl_device_typehook for PCI devices so thatlibxl_retrieve_domain_configurationcan properly retrieve PCI devices from xenstore.This fixes disappearing pci devices across domain reboots.
This patch seems to be committed now. Please backport this to Xen 4.10 stable branch, for upcoming 4.10.3, because original bugreport was about Xen 4.10.
Thanks,
-- Pasi
Quoted 47 lines
Reported-by Andreas Kinzler <[email protected]>Signed-off-by Roger Pau Monné <[email protected]>---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>
Cc: Andreas Kinzler <[email protected]>--- tools/libxl/libxl_pci.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)tools/libxl/libxl_pci.c +5
-4@@ -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: Signature · 1 line
2.19.0
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 5 lines
Quoted 4 lines
Fill the
from_xenstorelibxl_device_typehook for PCI devices so thatlibxl_retrieve_domain_configurationcan properly retrieve PCI devices from xenstore.
This fixes disappearing pci devices across domain reboots.This patch seems to be committed now. Please backport this to Xen 4.10 stable branch, for upcoming 4.10.3, because original bugreport was about Xen 4.10.
Thanks to devs for the patch. I tested the patch and I can confirm that it fixes my original problem on Xen 4.10. To use with Xen 4.10 you need a small backport patch (attached).
Regards Andreas
keep-pcipt-during-reboot.patch +2 -2
@@ -27,8 +27,8 @@ #define libxl__device_pci_update_devid NULL --DEFINE_DEVICE_TYPE_STRUCT_X(pcidev, pci, PCI); -+DEFINE_DEVICE_TYPE_STRUCT_X(pcidev, pci, PCI, +-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, +);
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel