[PATCH] xen/xenbus: Add quirk to deal with misconfigured backends.

From: Konrad Rzeszutek Wilk
Date: Wed Mar 21 2012 - 23:04:19 EST


A rather annoying and common case is when booting a PVonHVM guest
and exposing the PV KBD and PV VFB - as both of those do not
make any sense. The HVM guest is using the VGA driver and the emulated
keyboard for this. So we provide a very basic quirk framework
(can be expanded in the future) to not wait for 6 minutes for those devices
to initialize - they never wont.

To trigger this, put this in your guest config:

vfb = [ 'vnc=1, vnclisten=0.0.0.0 ,vncunused=1']

instead of this:
vnc=1
vnclisten="0.0.0.0"

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
---
drivers/xen/xenbus/xenbus_probe_frontend.c | 30 ++++++++++++++++++++++++++++
1 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/drivers/xen/xenbus/xenbus_probe_frontend.c b/drivers/xen/xenbus/xenbus_probe_frontend.c
index f20c5f1..80325cf 100644
--- a/drivers/xen/xenbus/xenbus_probe_frontend.c
+++ b/drivers/xen/xenbus/xenbus_probe_frontend.c
@@ -134,7 +134,31 @@ static int read_backend_details(struct xenbus_device *xendev)
{
return xenbus_read_otherend_details(xendev, "backend-id", "backend");
}
+static bool skip_if_quirk(struct device *dev, void *data)
+{
+ struct xenbus_device *xendev = to_xenbus_device(dev);
+ struct device_driver *drv = data;
+
+ /* Is this operation limited to a particular driver? */
+ if (drv && (dev->driver != drv))
+ return false;
+
+ if (xen_pv_domain())
+ return false;
+
+ /* With older QEMU, for PVonHVM guests the guest config files could
+ * contain: vfb = [ 'vnc=1, vnclisten=0.0.0.0 ,vncunused=1']
+ * which is nonsensical as there is no PV FB (or PV KBD) when
+ * running as HVM guest. */

+ if ((strncmp(xendev->nodename, "device/vkbd", 11) == 0))
+ return true;
+
+ if ((strncmp(xendev->nodename, "device/vfb", 10) == 0))
+ return true;
+
+ return false;
+}
static int is_device_connecting(struct device *dev, void *data)
{
struct xenbus_device *xendev = to_xenbus_device(dev);
@@ -153,6 +177,12 @@ static int is_device_connecting(struct device *dev, void *data)
return 0;

xendrv = to_xenbus_driver(dev->driver);
+
+ if (skip_if_quirk(dev, data)) {
+ printk(KERN_INFO "XENBUS: (quirk) Skipping : %s\n",
+ xendev->nodename);
+ return 0;
+ }
return (xendev->state < XenbusStateConnected ||
(xendev->state == XenbusStateConnected &&
xendrv->is_ready && !xendrv->is_ready(xendev)));
--
1.7.7.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/