# HG changeset patch
# User Marek Marczykowski <marmarek@xxxxxxxxxxxx>
# Date 1308675047 -3600
# Node ID 72eafe80ebc16ea4b4cbe0477a506a4647c8a9e8
# Parent 441482ec869920cb93156a030d378d45633c7b3d
libxl: add all pci devices to xenstore at once (during VM create)
When adding pci devices one by one, pciback notice only the first one. For
every next, "state" is left as is (usualy "4" in that time), so backend will
not rescan xenstore. So when VM is starting all devices should be added at once
and then backend can initialize it.
This applies only to pci, because only pci backend have one xenstore dir for
multiple devices.
Signed-off-by: Marek Marczykowski <marmarek@xxxxxxxxxxxx>
Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Committed-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
diff -r 441482ec8699 -r 72eafe80ebc1 tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c Tue Jun 21 17:48:00 2011 +0100
+++ b/tools/libxl/libxl_create.c Tue Jun 21 17:50:47 2011 +0100
@@ -525,6 +525,14 @@
for (i = 0; i < d_config->num_pcidevs; i++)
libxl__device_pci_add(gc, domid, &d_config->pcidevs[i], 1);
+ ret = libxl__create_pci_backend(gc, domid, d_config->pcidevs,
+ d_config->num_pcidevs);
+ if (ret < 0) {
+ LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
+ "libxl_create_pci_backend failed: %d", ret);
+ goto error_out;
+ }
+
if (!d_config->c_info.hvm && d_config->b_info.u.pv.e820_host) {
int rc;
rc = libxl__e820_alloc(ctx, domid, d_config);
diff -r 441482ec8699 -r 72eafe80ebc1 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h Tue Jun 21 17:48:00 2011 +0100
+++ b/tools/libxl/libxl_internal.h Tue Jun 21 17:50:47 2011 +0100
@@ -226,6 +226,8 @@
/* from libxl_pci */
_hidden int libxl__device_pci_add(libxl__gc *gc, uint32_t domid,
libxl_device_pci *pcidev, int starting);
+_hidden int libxl__create_pci_backend(libxl__gc *gc, uint32_t domid,
+ libxl_device_pci *pcidev, int num);
/* xl_exec */
diff -r 441482ec8699 -r 72eafe80ebc1 tools/libxl/libxl_pci.c
--- a/tools/libxl/libxl_pci.c Tue Jun 21 17:48:00 2011 +0100
+++ b/tools/libxl/libxl_pci.c Tue Jun 21 17:50:47 2011 +0100
@@ -221,7 +221,8 @@
flexarray_append_pair(back, libxl__sprintf(gc, "state-%d", num),
libxl__sprintf(gc, "%d", 1));
}
-static int libxl__create_pci_backend(libxl__gc *gc, uint32_t domid,
libxl_device_pci *pcidev, int num)
+int libxl__create_pci_backend(libxl__gc *gc, uint32_t domid,
+ libxl_device_pci *pcidev, int num)
{
libxl_ctx *ctx = libxl__gc_owner(gc);
flexarray_t *front = NULL;
@@ -707,7 +708,10 @@
}
}
- rc = libxl__device_pci_add_xenstore(gc, domid, pcidev, starting);
+ if (!starting)
+ rc = libxl__device_pci_add_xenstore(gc, domid, pcidev, starting);
+ else
+ rc = 0;
return rc;
}
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|