From: tip-bot for Andy Lutomirski <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: peterz@infradead.org, torvalds@linux-foundation.org,
luto@kernel.org, linux-kernel@vger.kernel.org, hpa@zytor.com,
tglx@linutronix.de, mingo@kernel.org, akpm@linux-foundation.org
Subject: [tip:x86/asm] x86/asm/msr: Make wrmsrl_safe() a function
Date: Fri, 5 Jun 2015 01:42:56 -0700 [thread overview]
Message-ID: <tip-cf991de2f614f454b3cb2a300c06ecdf69f3a70d@git.kernel.org> (raw)
Commit-ID: cf991de2f614f454b3cb2a300c06ecdf69f3a70d
Gitweb: http://git.kernel.org/tip/cf991de2f614f454b3cb2a300c06ecdf69f3a70d
Author: Andy Lutomirski <luto@kernel.org>
AuthorDate: Thu, 4 Jun 2015 17:13:44 -0700
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Fri, 5 Jun 2015 09:41:22 +0200
x86/asm/msr: Make wrmsrl_safe() a function
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>
Cc: <linux-kernel@vger.kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
[ Applied small improvements. ]
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
arch/x86/include/asm/msr.h | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/arch/x86/include/asm/msr.h b/arch/x86/include/asm/msr.h
index de36f22..13bf576 100644
--- a/arch/x86/include/asm/msr.h
+++ b/arch/x86/include/asm/msr.h
@@ -205,8 +205,13 @@ do { \
#endif /* !CONFIG_PARAVIRT */
-#define wrmsrl_safe(msr, val) wrmsr_safe((msr), (u32)(val), \
- (u32)((val) >> 32))
+/*
+ * 64-bit version of wrmsr_safe():
+ */
+static inline int wrmsrl_safe(u32 msr, u64 val)
+{
+ return wrmsr_safe(msr, (u32)val, (u32)(val >> 32));
+}
#define write_tsc(low, high) wrmsr(MSR_IA32_TSC, (low), (high))
next reply other threads:[~2015-06-05 8:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-05 8:42 tip-bot for Andy Lutomirski [this message]
2015-06-05 8:57 ` [tip:x86/asm] x86/asm/msr: Make wrmsrl_safe() a function H. Peter Anvin
2015-06-05 10:04 ` Ingo Molnar
2015-06-05 11:11 ` Borislav Petkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-cf991de2f614f454b3cb2a300c06ecdf69f3a70d@git.kernel.org \
--to=tipbot@zytor.com \
--cc=akpm@linux-foundation.org \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox