Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1158900

[PATCH] x86/msr: Make wrmsrl_safe a function

From Andy Lutomirski <luto@kernel.org>
Newsgroups linux.kernel
Subject [PATCH] x86/msr: Make wrmsrl_safe a function
Date 2015-06-05 02:20 +0200
Message-ID <pxNwC-cs-13@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH] x86/msr: Make wrmsrl_safe a function Andy Lutomirski <luto@kernel.org> - 2015-06-05 02:20 +0200

csiph-web