diff options
author | Borislav Petkov <borislav.petkov@amd.com> | 2012-06-01 10:52:38 -0400 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2012-06-07 14:43:30 -0400 |
commit | 2c929ce6f1ed1302be225512b433e6a6554f71a4 (patch) | |
tree | f5d6a3ad8a98eca809ac1ad1c348a9a1a8986b9d | |
parent | 169e9cbd77db23fe50bc8ba68bf081adb67b4220 (diff) |
x86, cpu, amd: Deprecate AMD-specific MSR variants
Now that all users of {rd,wr}msr_amd_safe have been fixed, deprecate its
use by making them private to amd.c and adding warnings when used on
anything else beside K8.
Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
Link: http://lkml.kernel.org/r/1338562358-28182-5-git-send-email-bp@amd64.org
Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r-- | arch/x86/include/asm/msr.h | 27 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/amd.c | 33 |
2 files changed, 33 insertions, 27 deletions
diff --git a/arch/x86/include/asm/msr.h b/arch/x86/include/asm/msr.h index 81860cc012d1..cb33b5f00267 100644 --- a/arch/x86/include/asm/msr.h +++ b/arch/x86/include/asm/msr.h | |||
@@ -211,33 +211,6 @@ do { \ | |||
211 | 211 | ||
212 | #endif /* !CONFIG_PARAVIRT */ | 212 | #endif /* !CONFIG_PARAVIRT */ |
213 | 213 | ||
214 | static inline int rdmsrl_amd_safe(unsigned msr, unsigned long long *p) | ||
215 | { | ||
216 | u32 gprs[8] = { 0 }; | ||
217 | int err; | ||
218 | |||
219 | gprs[1] = msr; | ||
220 | gprs[7] = 0x9c5a203a; | ||
221 | |||
222 | err = rdmsr_safe_regs(gprs); | ||
223 | |||
224 | *p = gprs[0] | ((u64)gprs[2] << 32); | ||
225 | |||
226 | return err; | ||
227 | } | ||
228 | |||
229 | static inline int wrmsrl_amd_safe(unsigned msr, unsigned long long val) | ||
230 | { | ||
231 | u32 gprs[8] = { 0 }; | ||
232 | |||
233 | gprs[0] = (u32)val; | ||
234 | gprs[1] = msr; | ||
235 | gprs[2] = val >> 32; | ||
236 | gprs[7] = 0x9c5a203a; | ||
237 | |||
238 | return wrmsr_safe_regs(gprs); | ||
239 | } | ||
240 | |||
241 | #define checking_wrmsrl(msr, val) wrmsr_safe((msr), (u32)(val), \ | 214 | #define checking_wrmsrl(msr, val) wrmsr_safe((msr), (u32)(val), \ |
242 | (u32)((val) >> 32)) | 215 | (u32)((val) >> 32)) |
243 | 216 | ||
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c index 80ccd99542e6..c928eb26ada6 100644 --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c | |||
@@ -19,6 +19,39 @@ | |||
19 | 19 | ||
20 | #include "cpu.h" | 20 | #include "cpu.h" |
21 | 21 | ||
22 | static inline int rdmsrl_amd_safe(unsigned msr, unsigned long long *p) | ||
23 | { | ||
24 | struct cpuinfo_x86 *c = &cpu_data(smp_processor_id()); | ||
25 | u32 gprs[8] = { 0 }; | ||
26 | int err; | ||
27 | |||
28 | WARN_ONCE((c->x86 != 0xf), "%s should only be used on K8!\n", __func__); | ||
29 | |||
30 | gprs[1] = msr; | ||
31 | gprs[7] = 0x9c5a203a; | ||
32 | |||
33 | err = rdmsr_safe_regs(gprs); | ||
34 | |||
35 | *p = gprs[0] | ((u64)gprs[2] << 32); | ||
36 | |||
37 | return err; | ||
38 | } | ||
39 | |||
40 | static inline int wrmsrl_amd_safe(unsigned msr, unsigned long long val) | ||
41 | { | ||
42 | struct cpuinfo_x86 *c = &cpu_data(smp_processor_id()); | ||
43 | u32 gprs[8] = { 0 }; | ||
44 | |||
45 | WARN_ONCE((c->x86 != 0xf), "%s should only be used on K8!\n", __func__); | ||
46 | |||
47 | gprs[0] = (u32)val; | ||
48 | gprs[1] = msr; | ||
49 | gprs[2] = val >> 32; | ||
50 | gprs[7] = 0x9c5a203a; | ||
51 | |||
52 | return wrmsr_safe_regs(gprs); | ||
53 | } | ||
54 | |||
22 | #ifdef CONFIG_X86_32 | 55 | #ifdef CONFIG_X86_32 |
23 | /* | 56 | /* |
24 | * B step AMD K6 before B 9730xxxx have hardware bugs that can cause | 57 | * B step AMD K6 before B 9730xxxx have hardware bugs that can cause |