From owner-svn-src-all@FreeBSD.ORG Wed May 22 19:22:45 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 6E37D659; Wed, 22 May 2013 19:22:45 +0000 (UTC) (envelope-from gibbs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 607CC1BD; Wed, 22 May 2013 19:22:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r4MJMjHu029355; Wed, 22 May 2013 19:22:45 GMT (envelope-from gibbs@svn.freebsd.org) Received: (from gibbs@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r4MJMjDA029354; Wed, 22 May 2013 19:22:45 GMT (envelope-from gibbs@svn.freebsd.org) Message-Id: <201305221922.r4MJMjDA029354@svn.freebsd.org> From: "Justin T. Gibbs" Date: Wed, 22 May 2013 19:22:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r250917 - head/sys/xen/xenbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 May 2013 19:22:45 -0000 Author: gibbs Date: Wed May 22 19:22:44 2013 New Revision: 250917 URL: http://svnweb.freebsd.org/changeset/base/250917 Log: Fix loss of the emulated keyboard on Xen PV HVM domains. xen/xenbus/xenbusb.c: In xenbusb_probe_children(), do not modify the XenBus state of devices for which we have no PV driver support. An emulated device we do support may share this backend. Hide the node from XenBus instead. This prevents closing the vkbd device, which Qemu's emulated keyboard device is using as the source for keyboard events. Tested with qemu-xen-traditional, qemu-xen and qemu stubdomains, all working as expected. Submitted by: Roger Pau Monne Reviewed by: gibbs MFC after: 1 week Modified: head/sys/xen/xenbus/xenbusb.c Modified: head/sys/xen/xenbus/xenbusb.c ============================================================================== --- head/sys/xen/xenbus/xenbusb.c Wed May 22 19:00:05 2013 (r250916) +++ head/sys/xen/xenbus/xenbusb.c Wed May 22 19:22:44 2013 (r250917) @@ -404,6 +404,31 @@ xenbusb_device_sysctl_init(device_t dev) } /** + * \brief Decrement the number of XenBus child devices in the + * connecting state by one and release the xbs_attch_ch + * interrupt configuration hook if the connecting count + * drops to zero. + * + * \param xbs XenBus Bus device softc of the owner of the bus to enumerate. + */ +static void +xenbusb_release_confighook(struct xenbusb_softc *xbs) +{ + mtx_lock(&xbs->xbs_lock); + KASSERT(xbs->xbs_connecting_children > 0, + ("Connecting device count error\n")); + xbs->xbs_connecting_children--; + if (xbs->xbs_connecting_children == 0 + && (xbs->xbs_flags & XBS_ATTACH_CH_ACTIVE) != 0) { + xbs->xbs_flags &= ~XBS_ATTACH_CH_ACTIVE; + mtx_unlock(&xbs->xbs_lock); + config_intrhook_disestablish(&xbs->xbs_attach_ch); + } else { + mtx_unlock(&xbs->xbs_lock); + } +} + +/** * \brief Verify the existance of attached device instances and perform * probe/attach processing for newly arrived devices. * @@ -417,7 +442,7 @@ xenbusb_probe_children(device_t dev) { device_t *kids; struct xenbus_device_ivars *ivars; - int i, count; + int i, count, error; if (device_get_children(dev, &kids, &count) == 0) { for (i = 0; i < count; i++) { @@ -430,7 +455,30 @@ xenbusb_probe_children(device_t dev) continue; } - if (device_probe_and_attach(kids[i])) { + error = device_probe_and_attach(kids[i]); + if (error == ENXIO) { + struct xenbusb_softc *xbs; + + /* + * We don't have a PV driver for this device. + * However, an emulated device we do support + * may share this backend. Hide the node from + * XenBus until the next rescan, but leave it's + * state unchanged so we don't inadvertently + * prevent attachment of any emulated device. + */ + xenbusb_delete_child(dev, kids[i]); + + /* + * Since the XenStore state of this device + * still indicates a pending attach, manually + * release it's hold on the boot process. + */ + xbs = device_get_softc(dev); + xenbusb_release_confighook(xbs); + + continue; + } else if (error) { /* * Transition device to the closed state * so the world knows that attachment will @@ -579,31 +627,6 @@ xenbusb_nop_confighook_cb(void *arg __un { } -/** - * \brief Decrement the number of XenBus child devices in the - * connecting state by one and release the xbs_attch_ch - * interrupt configuration hook if the connecting count - * drops to zero. - * - * \param xbs XenBus Bus device softc of the owner of the bus to enumerate. - */ -static void -xenbusb_release_confighook(struct xenbusb_softc *xbs) -{ - mtx_lock(&xbs->xbs_lock); - KASSERT(xbs->xbs_connecting_children > 0, - ("Connecting device count error\n")); - xbs->xbs_connecting_children--; - if (xbs->xbs_connecting_children == 0 - && (xbs->xbs_flags & XBS_ATTACH_CH_ACTIVE) != 0) { - xbs->xbs_flags &= ~XBS_ATTACH_CH_ACTIVE; - mtx_unlock(&xbs->xbs_lock); - config_intrhook_disestablish(&xbs->xbs_attach_ch); - } else { - mtx_unlock(&xbs->xbs_lock); - } -} - /*--------------------------- Public Functions -------------------------------*/ /*--------- API comments for these methods can be found in xenbusb.h ---------*/ void