xen/pv: support selecting safe/unsafe msr accesses
[linux-2.6-microblaze.git] / arch / x86 / xen / enlighten_pv.c
index 8c2accc..0ad3d4b 100644 (file)
@@ -108,6 +108,16 @@ struct tls_descs {
  */
 static DEFINE_PER_CPU(struct tls_descs, shadow_tls_desc);
 
+static __read_mostly bool xen_msr_safe = IS_ENABLED(CONFIG_XEN_PV_MSR_SAFE);
+
+static int __init parse_xen_msr_safe(char *str)
+{
+       if (str)
+               return strtobool(str, &xen_msr_safe);
+       return -EINVAL;
+}
+early_param("xen_msr_safe", parse_xen_msr_safe);
+
 static void __init xen_pv_init_platform(void)
 {
        /* PV guests can't operate virtio devices without grants. */
@@ -1010,22 +1020,16 @@ static int xen_write_msr_safe(unsigned int msr, unsigned int low,
 
 static u64 xen_read_msr(unsigned int msr)
 {
-       /*
-        * This will silently swallow a #GP from RDMSR.  It may be worth
-        * changing that.
-        */
        int err;
 
-       return xen_read_msr_safe(msr, &err);
+       return xen_do_read_msr(msr, xen_msr_safe ? &err : NULL);
 }
 
 static void xen_write_msr(unsigned int msr, unsigned low, unsigned high)
 {
-       /*
-        * This will silently swallow a #GP from WRMSR.  It may be worth
-        * changing that.
-        */
-       xen_write_msr_safe(msr, low, high);
+       int err;
+
+       xen_do_write_msr(msr, low, high, xen_msr_safe ? &err : NULL);
 }
 
 /* This is called once we have the cpu_possible_mask */