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

[Xen-changelog] [xen-unstable] pcifront: fix multiple initialization bug



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1258960473 0
# Node ID 302e0877e4cf99482c3baa2b692cd438f37ebce3
# Parent  95f01bfd26672fdd5076699bb2ea7b65ce2e26e5
pcifront: fix multiple initialization bug

Now that we have pcifront_watches to dynamically initialize pcifront
we don't need a call to init_pcifront in pcilib and pcifront_scan
anymore; we should just wait for the frontend to connect to the
backend instead.

Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
---
 extras/mini-os/pcifront.c |   19 ++++++++++++++-----
 stubdom/pciutils.patch    |    4 +---
 2 files changed, 15 insertions(+), 8 deletions(-)

diff -r 95f01bfd2667 -r 302e0877e4cf extras/mini-os/pcifront.c
--- a/extras/mini-os/pcifront.c Mon Nov 23 07:13:59 2009 +0000
+++ b/extras/mini-os/pcifront.c Mon Nov 23 07:14:33 2009 +0000
@@ -276,15 +276,24 @@ void pcifront_scan(struct pcifront_dev *
 {
     char *path;
     int i, n, len;
-    char *s, *msg;
+    char *s, *msg = NULL, *err = NULL;
     unsigned int domain, bus, slot, fun;
 
     if (!dev)
         dev = pcidev;
-    if (!dev)
-        dev = init_pcifront(NULL);
-    if (!dev)
-        return;
+    if (!dev) {
+        xenbus_event_queue events = NULL;
+        char *fe_state = "device/pci/0/state";
+        xenbus_watch_path_token(XBT_NIL, fe_state, fe_state, &events);
+        while ((err = xenbus_read(XBT_NIL, fe_state, &msg)) != NULL || msg[0] 
!= '4') {
+            free(msg);
+            free(err);
+            printk("pcifront_scan: waiting for pcifront to become ready\n");
+            xenbus_wait_for_watch(&events);
+        }
+        xenbus_unwatch_path_token(XBT_NIL, fe_state, fe_state);
+        dev = pcidev;
+    }
 
     len = strlen(dev->backend) + 1 + 5 + 10 + 1;
     path = (char *) malloc(len);
diff -r 95f01bfd2667 -r 302e0877e4cf stubdom/pciutils.patch
--- a/stubdom/pciutils.patch    Mon Nov 23 07:13:59 2009 +0000
+++ b/stubdom/pciutils.patch    Mon Nov 23 07:14:33 2009 +0000
@@ -64,7 +64,7 @@ diff -urN pciutils-2.2.9.orig/lib/access
  
 --- pciutils-2.2.9.orig/lib/minios.c   1970-01-01 01:00:00.000000000 +0100
 +++ pciutils-2.2.9/lib/minios.c        2008-07-01 12:31:40.554260000 +0100
-@@ -0,0 +1,108 @@
+@@ -0,0 +1,106 @@
 +/*
 + *    The PCI Library -- MiniOS PCI frontend access
 + *
@@ -87,8 +87,6 @@ diff -urN pciutils-2.2.9.orig/lib/access
 +static void
 +minios_init(struct pci_access *a)
 +{
-+  if (!init_pcifront(NULL))
-+    a->warning("minios_init open failed");
 +}
 +
 +static void

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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