From owner-freebsd-xen@FreeBSD.ORG Thu Jan 31 18:53:47 2013 Return-Path: Delivered-To: freebsd-xen@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id BA7753D9 for ; Thu, 31 Jan 2013 18:53:47 +0000 (UTC) (envelope-from roger.pau@citrix.com) Received: from SMTP.EU.CITRIX.COM (smtp.eu.citrix.com [46.33.159.39]) by mx1.freebsd.org (Postfix) with ESMTP id 60FCCA98 for ; Thu, 31 Jan 2013 18:53:47 +0000 (UTC) X-IronPort-AV: E=Sophos;i="4.84,578,1355097600"; d="scan'208";a="1037306" Received: from lonpmailmx01.citrite.net ([10.30.203.162]) by LONPIPO01.EU.CITRIX.COM with ESMTP/TLS/RC4-MD5; 31 Jan 2013 18:53:39 +0000 Received: from dhcp-3-120.uk.xensource.com.com (10.80.3.120) by LONPMAILMX01.citrite.net (10.30.203.162) with Microsoft SMTP Server id 8.3.297.1; Thu, 31 Jan 2013 18:53:38 +0000 From: Roger Pau Monne To: Subject: [PATCH] xenbus: fix device detection Date: Thu, 31 Jan 2013 18:52:17 +0000 Message-ID: <1359658337-24544-1-git-send-email-roger.pau@citrix.com> X-Mailer: git-send-email 1.7.7.5 (Apple Git-26) In-Reply-To: <5109032D.7090100@citrix.com> References: <5109032D.7090100@citrix.com> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: freebsd-xen@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion of the freebsd port to xen - implementation and usage List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jan 2013 18:53:47 -0000 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)