linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86/msr: Make wrmsrl_safe a function
@ 2015-06-05  0:13 Andy Lutomirski
  0 siblings, 0 replies; only message in thread
From: Andy Lutomirski @ 2015-06-05  0:13 UTC (permalink / raw)
  To: x86; +Cc: linux-kernel, Borislav Petkov, Andy Lutomirski

The wrmsrl_safe macro performs invalid shifts if the value argument
is 32 bits.  This makes it unnecessarily awkward to write code that
puts an unsigned long into an MSR.

Convert it to a real inline function.

For inspiration, see 7c74d5b7b7b6 ("x86/asm/entry/64: Fix
MSR_IA32_SYSENTER_CS MSR value").

Signed-off-by: Andy Lutomirski <luto@kernel.org>
---
 arch/x86/include/asm/msr.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/x86/include/asm/msr.h b/arch/x86/include/asm/msr.h
index de36f22eb0b9..4c576877396c 100644
--- a/arch/x86/include/asm/msr.h
+++ b/arch/x86/include/asm/msr.h
@@ -205,8 +205,10 @@ do {                                                            \
 
 #endif	/* !CONFIG_PARAVIRT */
 
-#define wrmsrl_safe(msr, val) wrmsr_safe((msr), (u32)(val),		\
-					     (u32)((val) >> 32))
+static inline int wrmsrl_safe(unsigned msr, u64 val)
+{
+	return wrmsr_safe((msr), (u32)val,  (u32)(val >> 32));
+}
 
 #define write_tsc(low, high) wrmsr(MSR_IA32_TSC, (low), (high))
 
-- 
2.4.2


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-06-05  0:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-05  0:13 [PATCH] x86/msr: Make wrmsrl_safe a function Andy Lutomirski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).