From: Thomas Gleixner <[email protected]>

[peterz: added native_rdmsrl]

Signed-off-by: Thomas Gleixner <[email protected]>
Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
---
 arch/x86/include/asm/microcode.h |   14 --------------
 arch/x86/include/asm/msr.h       |   18 ++++++++++++++++++
 2 files changed, 18 insertions(+), 14 deletions(-)

--- a/arch/x86/include/asm/microcode.h
+++ b/arch/x86/include/asm/microcode.h
@@ -6,20 +6,6 @@
 #include <linux/earlycpio.h>
 #include <linux/initrd.h>
 
-#define native_rdmsr(msr, val1, val2)                  \
-do {                                                   \
-       u64 __val = __rdmsr((msr));                     \
-       (void)((val1) = (u32)__val);                    \
-       (void)((val2) = (u32)(__val >> 32));            \
-} while (0)
-
-#define native_wrmsr(msr, low, high)                   \
-       __wrmsr(msr, low, high)
-
-#define native_wrmsrl(msr, val)                                \
-       __wrmsr((msr), (u32)((u64)(val)),               \
-                      (u32)((u64)(val) >> 32))
-
 struct ucode_patch {
        struct list_head plist;
        void *data;             /* Intel uses only this one */
--- a/arch/x86/include/asm/msr.h
+++ b/arch/x86/include/asm/msr.h
@@ -175,6 +175,24 @@ native_write_msr_safe(unsigned int msr,
 extern int rdmsr_safe_regs(u32 regs[8]);
 extern int wrmsr_safe_regs(u32 regs[8]);
 
+/* Simple wrappers for microcode and speculation control */
+#define native_rdmsr(msr, val1, val2)                  \
+do {                                                   \
+       u64 __val = __rdmsr((msr));                     \
+       (void)((val1) = (u32)__val);                    \
+       (void)((val2) = (u32)(__val >> 32));            \
+} while (0)
+
+#define native_rdmsrl(msr)                             \
+       __rdmsr(msr)
+
+#define native_wrmsr(msr, low, high)                   \
+       __wrmsr(msr, low, high)
+
+#define native_wrmsrl(msr, val)                                \
+       __wrmsr((msr), (u32)((u64)(val)),               \
+                      (u32)((u64)(val) >> 32))
+
 /**
  * rdtsc() - returns the current TSC without ordering constraints
  *


Reply via email to