]> xenbits.xensource.com Git - xen.git/commitdiff
libx86: Introduce lib/x86/msr.h and share msr_policy with userspace
authorAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 29 Jun 2018 13:05:52 +0000 (13:05 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 19 Jul 2018 18:31:31 +0000 (19:31 +0100)
To facilitate the shared Xen and toolstack code in libx86, struct msr_policy
needs to be available in the same way as struct cpuid_policy.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
tools/libxc/xc_cpuid_x86.c
xen/include/asm-x86/msr.h
xen/include/xen/lib/x86/msr.h [new file with mode: 0644]

index 483b1328e473d5fdf20c8715d98f652853c8a705..5a5b15f43cc3128eb96d35ca4cd17e26ade6afb9 100644 (file)
@@ -33,6 +33,7 @@ enum {
 };
 
 #include <xen/lib/x86/cpuid.h>
+#include <xen/lib/x86/msr.h>
 
 #define bitmaskof(idx)      (1u << ((idx) & 31))
 #define featureword_of(idx) ((idx) >> 5)
index 9b4e4e07f12f3c5d4d13366b786e3578eae31b5d..72342b77b8065af42bbe4a5805d09ba31bba7013 100644 (file)
@@ -8,6 +8,9 @@
 #include <xen/types.h>
 #include <xen/percpu.h>
 #include <xen/errno.h>
+
+#include <xen/lib/x86/msr.h>
+
 #include <asm/asm_defns.h>
 #include <asm/cpufeature.h>
 
@@ -257,26 +260,6 @@ static inline void wrmsr_tsc_aux(uint32_t val)
     }
 }
 
-/* MSR policy object for shared per-domain MSRs */
-struct msr_policy
-{
-    /*
-     * 0x000000ce - MSR_INTEL_PLATFORM_INFO
-     *
-     * This MSR is non-architectural, but for simplicy we allow it to be read
-     * unconditionally.  CPUID Faulting support can be fully emulated for HVM
-     * guests so can be offered unconditionally, while support for PV guests
-     * is dependent on real hardware support.
-     */
-    union {
-        uint32_t raw;
-        struct {
-            uint32_t :31;
-            bool cpuid_faulting:1;
-        };
-    } plaform_info;
-};
-
 extern struct msr_policy     raw_msr_policy,
                             host_msr_policy,
                          hvm_max_msr_policy,
diff --git a/xen/include/xen/lib/x86/msr.h b/xen/include/xen/lib/x86/msr.h
new file mode 100644 (file)
index 0000000..e6b13ad
--- /dev/null
@@ -0,0 +1,35 @@
+/* Common data structures and functions consumed by hypervisor and toolstack */
+#ifndef XEN_LIB_X86_MSR_H
+#define XEN_LIB_X86_MSR_H
+
+/* MSR policy object for shared per-domain MSRs */
+struct msr_policy
+{
+    /*
+     * 0x000000ce - MSR_INTEL_PLATFORM_INFO
+     *
+     * This MSR is non-architectural, but for simplicy we allow it to be read
+     * unconditionally.  CPUID Faulting support can be fully emulated for HVM
+     * guests so can be offered unconditionally, while support for PV guests
+     * is dependent on real hardware support.
+     */
+    union {
+        uint32_t raw;
+        struct {
+            uint32_t :31;
+            bool cpuid_faulting:1;
+        };
+    } plaform_info;
+};
+
+#endif /* !XEN_LIB_X86_MSR_H */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */