xen/xenbus: Fix compile warning.
[pandora-kernel.git] / drivers / xen / xenbus / xenbus_xs.c
index bce15cf..f5dda83 100644 (file)
 #include <linux/rwsem.h>
 #include <linux/module.h>
 #include <linux/mutex.h>
+#include <asm/xen/hypervisor.h>
 #include <xen/xenbus.h>
 #include <xen/xen.h>
 #include "xenbus_comms.h"
+#include <asm/xen/hypervisor.h>
 
 struct xs_stored_msg {
        struct list_head list;
@@ -617,12 +619,32 @@ static struct xenbus_watch *find_watch(const char *token)
 
        return NULL;
 }
+/*
+ * Certain older XenBus toolstack cannot handle reading values that are
+ * not populated. Some Xen 3.4 installation are incapable of doing this
+ * so if we are running on anything older than 4 do not attempt to read
+ * control/platform-feature-xs_reset_watches.
+ */
+static bool xen_strict_xenbus_quirk(void)
+{
+       uint32_t eax, ebx, ecx, edx, base;
+
+       base = xen_cpuid_base();
+       cpuid(base + 1, &eax, &ebx, &ecx, &edx);
 
+       if ((eax >> 16) < 4)
+               return true;
+       return false;
+
+}
 static void xs_reset_watches(void)
 {
        int err, supported = 0;
 
-       if (!xen_hvm_domain())
+       if (!xen_hvm_domain() || xen_initial_domain())
+               return;
+
+       if (xen_strict_xenbus_quirk())
                return;
 
        err = xenbus_scanf(XBT_NIL, "control",