WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] pcifront: fix multiple initialization bug

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] pcifront: fix multiple initialization bug
From: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Date: Fri, 20 Nov 2009 15:45:49 +0000
Delivery-date: Fri, 20 Nov 2009 07:43:19 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Alpine 2.00 (DEB 1167 2008-08-23)
Hi all,
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>

---

diff -r 5a89f54b0195 extras/mini-os/pcifront.c
--- a/extras/mini-os/pcifront.c Fri Nov 20 10:55:28 2009 +0000
+++ b/extras/mini-os/pcifront.c Fri Nov 20 15:30:40 2009 +0000
@@ -276,15 +276,24 @@
 {
     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 5a89f54b0195 stubdom/pciutils.patch
--- a/stubdom/pciutils.patch    Fri Nov 20 10:55:28 2009 +0000
+++ b/stubdom/pciutils.patch    Fri Nov 20 15:30:40 2009 +0000
@@ -64,7 +64,7 @@
  
 --- 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 @@
 +static void
 +minios_init(struct pci_access *a)
 +{
-+  if (!init_pcifront(NULL))
-+    a->warning("minios_init open failed");
 +}
 +
 +static void

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] pcifront: fix multiple initialization bug, Stefano Stabellini <=