x86/cpu: Make alternative_msr_write work for 32-bit code
authorJim Mattson <jmattson@google.com>
Sun, 13 May 2018 21:33:57 +0000 (17:33 -0400)
committerThomas Gleixner <tglx@linutronix.de>
Mon, 14 May 2018 08:34:28 +0000 (10:34 +0200)
Cast val and (val >> 32) to (u32), so that they fit in a
general-purpose register in both 32-bit and 64-bit code.

[ tglx: Made it u32 instead of uintptr_t ]

Fixes: c65732e4f721 ("x86/cpu: Restore CPUID_8000_0008_EBX reload")
Signed-off-by: Jim Mattson <jmattson@google.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/x86/include/asm/nospec-branch.h

index 328ea3cb769f85097f9fc7489bf38984aa9993b4..bc258e644e5e8b3cc814f103f24ad522cc040eea 100644 (file)
@@ -265,8 +265,8 @@ void alternative_msr_write(unsigned int msr, u64 val, unsigned int feature)
 {
        asm volatile(ALTERNATIVE("", "wrmsr", %c[feature])
                : : "c" (msr),
-                   "a" (val),
-                   "d" (val >> 32),
+                   "a" ((u32)val),
+                   "d" ((u32)(val >> 32)),
                    [feature] "i" (feature)
                : "memory");
 }