summaryrefslogtreecommitdiffstats
path: root/sys/xen/xenbus
diff options
context:
space:
mode:
authorgibbs <gibbs@FreeBSD.org>2013-05-22 19:22:44 +0000
committergibbs <gibbs@FreeBSD.org>2013-05-22 19:22:44 +0000
commit1402439a41c6454aff84f83ab3d46fbc88cb72cb (patch)
treef20034bd17af91658a4ed3bb905b2ba13624e5c7 /sys/xen/xenbus
parent9a25769d2eb60b95b2bbfc62199cea4744389c18 (diff)
downloadFreeBSD-src-1402439a41c6454aff84f83ab3d46fbc88cb72cb.zip
FreeBSD-src-1402439a41c6454aff84f83ab3d46fbc88cb72cb.tar.gz
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 <roger.pau@citrix.com> Reviewed by: gibbs MFC after: 1 week
Diffstat (limited to 'sys/xen/xenbus')
-rw-r--r--sys/xen/xenbus/xenbusb.c77
1 files changed, 50 insertions, 27 deletions
diff --git a/sys/xen/xenbus/xenbusb.c b/sys/xen/xenbus/xenbusb.c
index 3e2d56f..1f84795 100644
--- a/sys/xen/xenbus/xenbusb.c
+++ b/sys/xen/xenbus/xenbusb.c
@@ -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 __unused)
{
}
-/**
- * \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
OpenPOWER on IntegriCloud