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

[Xen-devel] Re: [PATCH 1/2] PV framebuffer


  • To: xen-devel@xxxxxxxxxxxxxxxxxxx
  • From: Markus Armbruster <armbru@xxxxxxxxxx>
  • Date: Fri, 17 Nov 2006 14:24:48 +0100
  • Delivery-date: Fri, 17 Nov 2006 05:24:58 -0800
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>

Diffs since last iteration:

diff -rupN -x '*.orig' 
linux-2.6.16.29-xen-pvfb.old/drivers/xen/console/console.c 
linux-2.6.16.29-xen-pvfb/drivers/xen/console/console.c
--- linux-2.6.16.29-xen-pvfb.old/drivers/xen/console/console.c  2006-11-17 
13:38:58.000000000 +0100
+++ linux-2.6.16.29-xen-pvfb/drivers/xen/console/console.c      2006-11-17 
13:38:02.000000000 +0100
@@ -712,18 +712,13 @@ static int __init xencons_init(void)
        printk("Xen virtual console successfully installed as %s%d\n",
               DRV(xencons_driver)->name, xc_num);
 
-        /* Don't need to check about graphical fb for domain 0 */
-        if (is_initial_xendomain())
-               return 0;
-
-       rc = 0;
-       if (xenbus_scanf(XBT_NIL, "console", "use_graphics", "%d", &rc) < 0)
-               printk(KERN_ERR "Unable to read console/use_graphics\n");
-       if (rc == 0) {
-               /* FIXME: this is ugly */
-              unregister_console(&kcons_info);
-              kcons_info.flags |= CON_CONSDEV;
-              register_console(&kcons_info);
+        /* Check about framebuffer messing up the console */
+        if (!is_initial_xendomain() &&
+           !xenbus_exists(XBT_NIL, "device", "vfb")) {
+               /* FIXME: this is ugly */
+               unregister_console(&kcons_info);
+               kcons_info.flags |= CON_CONSDEV;
+               register_console(&kcons_info);
        }
 
        return 0;
diff -rupN -x '*.orig' linux-2.6.16.29-xen-pvfb.old/drivers/xen/Kconfig 
linux-2.6.16.29-xen-pvfb/drivers/xen/Kconfig
--- linux-2.6.16.29-xen-pvfb.old/drivers/xen/Kconfig    2006-11-17 
13:38:58.000000000 +0100
+++ linux-2.6.16.29-xen-pvfb/drivers/xen/Kconfig        2006-11-17 
13:38:02.000000000 +0100
@@ -187,7 +187,7 @@ config XEN_FRAMEBUFFER
 
 config XEN_KEYBOARD
        tristate "Keyboard-device frontend driver"
-       depends on XEN
+       depends on XEN && XEN_FRAMEBUFFER && INPUT
        default y
        help
          The keyboard-device frontend driver allows the kernel to create a
diff -rupN -x '*.orig' linux-2.6.16.29-xen-pvfb.old/drivers/xen/xenfb/xenfb.c 
linux-2.6.16.29-xen-pvfb/drivers/xen/xenfb/xenfb.c
--- linux-2.6.16.29-xen-pvfb.old/drivers/xen/xenfb/xenfb.c      2006-11-17 
13:38:58.000000000 +0100
+++ linux-2.6.16.29-xen-pvfb/drivers/xen/xenfb/xenfb.c  2006-11-17 
13:38:02.000000000 +0100
@@ -67,7 +67,7 @@ struct xenfb_info
 static int xenfb_fps = 20;
 static unsigned long xenfb_mem_len = XENFB_WIDTH * XENFB_HEIGHT * XENFB_DEPTH 
/ 8;
 
-static int __devexit xenfb_remove(struct xenbus_device *);
+static int xenfb_remove(struct xenbus_device *);
 
 static void xenfb_do_update(struct xenfb_info *info,
                            int x, int y, int w, int h)
@@ -482,7 +482,6 @@ static int __devinit xenfb_probe(struct 
                goto error;
        }
 
-       /* FIXME should this be delayed until backend XenbusStateConnected? */
        ret = register_framebuffer(fb_info);
        if (ret) {
                fb_dealloc_cmap(&info->fb_info->cmap);
@@ -492,9 +491,11 @@ static int __devinit xenfb_probe(struct 
        }
        info->fb_info = fb_info;
 
+       /* FIXME should this be delayed until backend XenbusStateConnected? */
        info->kthread = kthread_run(xenfb_thread, info, "xenfb thread");
        if (IS_ERR(info->kthread)) {
                ret = PTR_ERR(info->kthread);
+               info->kthread = NULL;
                xenbus_dev_fatal(dev, ret, "register_framebuffer");
                goto error;
        }
@@ -553,10 +554,19 @@ static void xenfb_backend_changed(struct
                break;
 
        case XenbusStateInitWait:
+       InitWait:
                xenbus_switch_state(dev, XenbusStateConnected);
                break;
 
        case XenbusStateConnected:
+               /*
+                * Work around xenbus race condition: If backend goes
+                * through InitWait to Connected fast enough, we can
+                * get Connected twice here.
+                */
+               if (dev->state != XenbusStateConnected)
+                       goto InitWait; /* no InitWait seen yet, fudge it */
+
                if (xenbus_scanf(XBT_NIL, info->xbdev->otherend,
                                 "request-update", "%d", &val) < 0)
                        val = 0;
@@ -565,12 +575,13 @@ static void xenfb_backend_changed(struct
                break;
 
        case XenbusStateClosing:
+               // FIXME is this safe in any dev->state?
                xenbus_frontend_closed(dev);
                break;
        }
 }
 
-static int __devexit xenfb_remove(struct xenbus_device *dev)
+static int xenfb_remove(struct xenbus_device *dev)
 {
        struct xenfb_info *info = dev->dev.driver_data;
 
@@ -610,19 +621,12 @@ static struct xenbus_driver xenfb = {
 
 static int __init xenfb_init(void)
 {
-       int ret;
-
        if (!is_running_on_xen())
                return -ENODEV;
 
        /* Nothing to do if running in dom0. */
        if (is_initial_xendomain())
                return -ENODEV;
-       /* if we're not set up to use graphics mode, then don't initialize */
-       if (xenbus_scanf(XBT_NIL, "console", "use_graphics", "%d", &ret) < 0)
-               return -ENODEV;
-       if (ret == 0)
-               return -ENODEV;
 
        return xenbus_register_frontend(&xenfb);
 }
diff -rupN -x '*.orig' linux-2.6.16.29-xen-pvfb.old/drivers/xen/xenkbd/xenkbd.c 
linux-2.6.16.29-xen-pvfb/drivers/xen/xenkbd/xenkbd.c
--- linux-2.6.16.29-xen-pvfb.old/drivers/xen/xenkbd/xenkbd.c    2006-11-17 
13:38:58.000000000 +0100
+++ linux-2.6.16.29-xen-pvfb/drivers/xen/xenkbd/xenkbd.c        2006-11-17 
13:38:02.000000000 +0100
@@ -36,7 +36,7 @@ struct xenkbd_info
        struct xenbus_device    *xbdev;
 };
 
-static int __devexit xenkbd_remove(struct xenbus_device *);
+static int xenkbd_remove(struct xenbus_device *);
 
 /*
  * Note: if you need to send out events, see xenfb_do_update() for how
@@ -108,7 +108,7 @@ int __devinit xenkbd_probe(struct xenbus
        input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REL) | BIT(EV_ABS);
        input_dev->keybit[LONG(BTN_MOUSE)]
                = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT);
-       /* FIXME more buttons? */
+       /* TODO additional buttons */
        input_dev->relbit[0] = BIT(REL_X) | BIT(REL_Y);
 
        /* FIXME not sure this is quite right */
@@ -191,6 +191,7 @@ static void xenkbd_backend_changed(struc
                break;
 
        case XenbusStateInitWait:
+       InitWait:
                ret = xenbus_scanf(XBT_NIL, info->xbdev->otherend,
                                   "feature-abs-pointer", "%d", &val);
                if (ret < 0)
@@ -205,6 +206,13 @@ static void xenkbd_backend_changed(struc
                break;
 
        case XenbusStateConnected:
+               /*
+                * Work around xenbus race condition: If backend goes
+                * through InitWait to Connected fast enough, we can
+                * get Connected twice here.
+                */
+               if (dev->state != XenbusStateConnected)
+                       goto InitWait; /* no InitWait seen yet, fudge it */
                break;
 
        case XenbusStateClosing:
@@ -213,7 +221,7 @@ static void xenkbd_backend_changed(struc
        }
 }
 
-static int __devexit xenkbd_remove(struct xenbus_device *dev)
+static int xenkbd_remove(struct xenbus_device *dev)
 {
        struct xenkbd_info *info = dev->dev.driver_data;
 
@@ -242,20 +250,12 @@ static struct xenbus_driver xenkbd = {
 
 static int __init xenkbd_init(void)
 {
-       int ret;
-
        if (!is_running_on_xen())
                return -ENODEV;
 
        /* Nothing to do if running in dom0. */
        if (is_initial_xendomain())
                return -ENODEV;
-       /* if we're not set up to use graphics mode, then don't initialize */
-       if (xenbus_scanf(XBT_NIL, "console", "use_graphics", "%d", &ret) < 0)
-               return -ENODEV;
-       if (ret == 0)
-               return -ENODEV;
-
 
        return xenbus_register_frontend(&xenkbd);
 }
diff -rupN -x '*.orig' linux-2.6.16.29-xen-pvfb.old/mm/memory.c 
linux-2.6.16.29-xen-pvfb/mm/memory.c
--- linux-2.6.16.29-xen-pvfb.old/mm/memory.c    2006-10-13 19:47:16.000000000 
+0200
+++ linux-2.6.16.29-xen-pvfb/mm/memory.c        2006-11-17 13:38:02.000000000 
+0100
@@ -882,6 +882,7 @@ unsigned long zap_page_range(struct vm_a
                tlb_finish_mmu(tlb, address, end);
        return end;
 }
+EXPORT_SYMBOL(zap_page_range);
 
 /*
  * Do a quick page-table lookup for a single page.

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


 


Rackspace

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