All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: xen-devel@lists.xensource.com
Subject: Re: [PATCH 1/2] PV framebuffer
Date: Fri, 17 Nov 2006 14:24:48 +0100	[thread overview]
Message-ID: <87wt5ucijj.fsf@pike.pond.sub.org> (raw)
In-Reply-To: <8764dedx78.fsf@pike.pond.sub.org> (Markus Armbruster's message of "Fri, 17 Nov 2006 14:22:51 +0100")

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.

  reply	other threads:[~2006-11-17 13:24 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-10  8:53 [PATCH 1/2] PV framebuffer Markus Armbruster
2006-11-12 14:20 ` Steven Smith
2006-11-12 19:05   ` Keir Fraser
2006-11-13 13:09     ` Markus Armbruster
2006-11-13 13:32       ` Keir Fraser
2006-11-14 14:01   ` Markus Armbruster
2006-11-15 12:11     ` Steven Smith
2006-11-15 16:57       ` Markus Armbruster
2006-11-17  9:46         ` Steven Smith
2006-11-17 15:33     ` Markus Armbruster
2006-11-17 13:22 ` Markus Armbruster
2006-11-17 13:24   ` Markus Armbruster [this message]
2006-11-24  8:05   ` Markus Armbruster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wt5ucijj.fsf@pike.pond.sub.org \
    --to=armbru@redhat.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.