Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 31 Jan 2013 18:52:17 +0000
From:      Roger Pau Monne <roger.pau@citrix.com>
To:        <freebsd-xen@freebsd.org>
Subject:   [PATCH] xenbus: fix device detection
Message-ID:  <1359658337-24544-1-git-send-email-roger.pau@citrix.com>
In-Reply-To: <5109032D.7090100@citrix.com>
References:  <5109032D.7090100@citrix.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Devices that cannot be handled should not be closed, instead leave
them as is. This prevents closing the vkbd device, which has the
effect of making Qemu stop sending keys to the guest.

Tested with qemu-xen-traditional, qemu-xen and qemu stubdomains, all
working as expected.
---
 sys/xen/xenbus/xenbusb.c |   19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/sys/xen/xenbus/xenbusb.c b/sys/xen/xenbus/xenbusb.c
index 3e2d56f..8370195 100644
--- a/sys/xen/xenbus/xenbusb.c
+++ b/sys/xen/xenbus/xenbusb.c
@@ -418,6 +418,9 @@ xenbusb_probe_children(device_t dev)
 	device_t *kids;
 	struct xenbus_device_ivars *ivars;
 	int i, count;
+	struct xenbusb_softc *xbs;
+
+	xbs = device_get_softc(dev);
 
 	if (device_get_children(dev, &kids, &count) == 0) {
 		for (i = 0; i < count; i++) {
@@ -430,7 +433,21 @@ xenbusb_probe_children(device_t dev)
 				continue;
 			}
 
-			if (device_probe_and_attach(kids[i])) {
+			if (device_probe(kids[i])) {
+				/*
+				 * Don't mess the state of devices the kernel
+				 * cannot handle.
+				 */
+				xenbusb_delete_child(dev, kids[i]);
+
+				mtx_lock(&xbs->xbs_lock);
+				xbs->xbs_connecting_children--;
+				mtx_unlock(&xbs->xbs_lock);
+
+				continue;
+			}
+
+			if (device_attach(kids[i])) {
 				/*
 				 * Transition device to the closed state
 				 * so the world knows that attachment will
-- 
1.7.7.5 (Apple Git-26)




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1359658337-24544-1-git-send-email-roger.pau>