diff options
author | Borislav Petkov <borislav.petkov@amd.com> | 2009-05-22 06:12:01 -0400 |
---|---|---|
committer | Borislav Petkov <borislav.petkov@amd.com> | 2009-06-10 06:18:42 -0400 |
commit | 6bc1096d7ab3621b3ffcf06616d1f4e0325d903d (patch) | |
tree | 286d1e4545fbd69c25fb4a5044d1d51122169a1d /arch/x86/lib | |
parent | 07a2039b8eb0af4ff464efd3dfd95de5c02648c6 (diff) |
x86: MSR: add a struct representation of an MSR
Add a struct representing a 64bit MSR pair consisting of a low and high
register part and convert msr_info to use it. Also, rename msr-on-cpu.c
to msr.c.
Side note: Put the cpumask.h include in __KERNEL__ space thus fixing an
allmodconfig build failure in the headers_check target.
CC: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
Diffstat (limited to 'arch/x86/lib')
-rw-r--r-- | arch/x86/lib/Makefile | 2 | ||||
-rw-r--r-- | arch/x86/lib/msr.c (renamed from arch/x86/lib/msr-on-cpu.c) | 26 |
2 files changed, 14 insertions, 14 deletions
diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile index 55e11aa6d66c..f9d35632666b 100644 --- a/arch/x86/lib/Makefile +++ b/arch/x86/lib/Makefile | |||
@@ -2,7 +2,7 @@ | |||
2 | # Makefile for x86 specific library files. | 2 | # Makefile for x86 specific library files. |
3 | # | 3 | # |
4 | 4 | ||
5 | obj-$(CONFIG_SMP) := msr-on-cpu.o | 5 | obj-$(CONFIG_SMP) := msr.o |
6 | 6 | ||
7 | lib-y := delay.o | 7 | lib-y := delay.o |
8 | lib-y += thunk_$(BITS).o | 8 | lib-y += thunk_$(BITS).o |
diff --git a/arch/x86/lib/msr-on-cpu.c b/arch/x86/lib/msr.c index 321cf720dbb6..cade714e57f9 100644 --- a/arch/x86/lib/msr-on-cpu.c +++ b/arch/x86/lib/msr.c | |||
@@ -5,7 +5,7 @@ | |||
5 | 5 | ||
6 | struct msr_info { | 6 | struct msr_info { |
7 | u32 msr_no; | 7 | u32 msr_no; |
8 | u32 l, h; | 8 | struct msr reg; |
9 | int err; | 9 | int err; |
10 | }; | 10 | }; |
11 | 11 | ||
@@ -13,14 +13,14 @@ static void __rdmsr_on_cpu(void *info) | |||
13 | { | 13 | { |
14 | struct msr_info *rv = info; | 14 | struct msr_info *rv = info; |
15 | 15 | ||
16 | rdmsr(rv->msr_no, rv->l, rv->h); | 16 | rdmsr(rv->msr_no, rv->reg.l, rv->reg.h); |
17 | } | 17 | } |
18 | 18 | ||
19 | static void __wrmsr_on_cpu(void *info) | 19 | static void __wrmsr_on_cpu(void *info) |
20 | { | 20 | { |
21 | struct msr_info *rv = info; | 21 | struct msr_info *rv = info; |
22 | 22 | ||
23 | wrmsr(rv->msr_no, rv->l, rv->h); | 23 | wrmsr(rv->msr_no, rv->reg.l, rv->reg.h); |
24 | } | 24 | } |
25 | 25 | ||
26 | int rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h) | 26 | int rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h) |
@@ -30,8 +30,8 @@ int rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h) | |||
30 | 30 | ||
31 | rv.msr_no = msr_no; | 31 | rv.msr_no = msr_no; |
32 | err = smp_call_function_single(cpu, __rdmsr_on_cpu, &rv, 1); | 32 | err = smp_call_function_single(cpu, __rdmsr_on_cpu, &rv, 1); |
33 | *l = rv.l; | 33 | *l = rv.reg.l; |
34 | *h = rv.h; | 34 | *h = rv.reg.h; |
35 | 35 | ||
36 | return err; | 36 | return err; |
37 | } | 37 | } |
@@ -42,8 +42,8 @@ int wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h) | |||
42 | struct msr_info rv; | 42 | struct msr_info rv; |
43 | 43 | ||
44 | rv.msr_no = msr_no; | 44 | rv.msr_no = msr_no; |
45 | rv.l = l; | 45 | rv.reg.l = l; |
46 | rv.h = h; | 46 | rv.reg.h = h; |
47 | err = smp_call_function_single(cpu, __wrmsr_on_cpu, &rv, 1); | 47 | err = smp_call_function_single(cpu, __wrmsr_on_cpu, &rv, 1); |
48 | 48 | ||
49 | return err; | 49 | return err; |
@@ -55,14 +55,14 @@ static void __rdmsr_safe_on_cpu(void *info) | |||
55 | { | 55 | { |
56 | struct msr_info *rv = info; | 56 | struct msr_info *rv = info; |
57 | 57 | ||
58 | rv->err = rdmsr_safe(rv->msr_no, &rv->l, &rv->h); | 58 | rv->err = rdmsr_safe(rv->msr_no, &rv->reg.l, &rv->reg.h); |
59 | } | 59 | } |
60 | 60 | ||
61 | static void __wrmsr_safe_on_cpu(void *info) | 61 | static void __wrmsr_safe_on_cpu(void *info) |
62 | { | 62 | { |
63 | struct msr_info *rv = info; | 63 | struct msr_info *rv = info; |
64 | 64 | ||
65 | rv->err = wrmsr_safe(rv->msr_no, rv->l, rv->h); | 65 | rv->err = wrmsr_safe(rv->msr_no, rv->reg.l, rv->reg.h); |
66 | } | 66 | } |
67 | 67 | ||
68 | int rdmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h) | 68 | int rdmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h) |
@@ -72,8 +72,8 @@ int rdmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h) | |||
72 | 72 | ||
73 | rv.msr_no = msr_no; | 73 | rv.msr_no = msr_no; |
74 | err = smp_call_function_single(cpu, __rdmsr_safe_on_cpu, &rv, 1); | 74 | err = smp_call_function_single(cpu, __rdmsr_safe_on_cpu, &rv, 1); |
75 | *l = rv.l; | 75 | *l = rv.reg.l; |
76 | *h = rv.h; | 76 | *h = rv.reg.h; |
77 | 77 | ||
78 | return err ? err : rv.err; | 78 | return err ? err : rv.err; |
79 | } | 79 | } |
@@ -84,8 +84,8 @@ int wrmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h) | |||
84 | struct msr_info rv; | 84 | struct msr_info rv; |
85 | 85 | ||
86 | rv.msr_no = msr_no; | 86 | rv.msr_no = msr_no; |
87 | rv.l = l; | 87 | rv.reg.l = l; |
88 | rv.h = h; | 88 | rv.reg.h = h; |
89 | err = smp_call_function_single(cpu, __wrmsr_safe_on_cpu, &rv, 1); | 89 | err = smp_call_function_single(cpu, __wrmsr_safe_on_cpu, &rv, 1); |
90 | 90 | ||
91 | return err ? err : rv.err; | 91 | return err ? err : rv.err; |