diff options
author | Jacob Pan <jacob.jun.pan@linux.intel.com> | 2013-10-11 19:54:58 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-10-16 18:36:06 -0400 |
commit | 1a6b991a9875a4c4811c7baf4058fa17aa1a9d9b (patch) | |
tree | 1c6238148f92459f10a855d6ee7ab40126dfa103 /arch/x86/lib | |
parent | 12cc4b3827f8cc5973f86330ccc9d9656a31bfa8 (diff) |
x86 / msr: add 64bit _on_cpu access functions
Having 64-bit MSR access methods on given CPU can avoid shifting and
simplify MSR content manipulation. We already have other combinations
of rdmsrl_xxx and wrmsrl_xxx but missing the _on_cpu version.
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
Reviewed-by: H. Peter Anvin <hpa@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'arch/x86/lib')
-rw-r--r-- | arch/x86/lib/msr-smp.c | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/arch/x86/lib/msr-smp.c b/arch/x86/lib/msr-smp.c index a6b1b86d2253..518532e6a3fa 100644 --- a/arch/x86/lib/msr-smp.c +++ b/arch/x86/lib/msr-smp.c | |||
@@ -47,6 +47,21 @@ int rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h) | |||
47 | } | 47 | } |
48 | EXPORT_SYMBOL(rdmsr_on_cpu); | 48 | EXPORT_SYMBOL(rdmsr_on_cpu); |
49 | 49 | ||
50 | int rdmsrl_on_cpu(unsigned int cpu, u32 msr_no, u64 *q) | ||
51 | { | ||
52 | int err; | ||
53 | struct msr_info rv; | ||
54 | |||
55 | memset(&rv, 0, sizeof(rv)); | ||
56 | |||
57 | rv.msr_no = msr_no; | ||
58 | err = smp_call_function_single(cpu, __rdmsr_on_cpu, &rv, 1); | ||
59 | *q = rv.reg.q; | ||
60 | |||
61 | return err; | ||
62 | } | ||
63 | EXPORT_SYMBOL(rdmsrl_on_cpu); | ||
64 | |||
50 | int wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h) | 65 | int wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h) |
51 | { | 66 | { |
52 | int err; | 67 | int err; |
@@ -63,6 +78,22 @@ int wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h) | |||
63 | } | 78 | } |
64 | EXPORT_SYMBOL(wrmsr_on_cpu); | 79 | EXPORT_SYMBOL(wrmsr_on_cpu); |
65 | 80 | ||
81 | int wrmsrl_on_cpu(unsigned int cpu, u32 msr_no, u64 q) | ||
82 | { | ||
83 | int err; | ||
84 | struct msr_info rv; | ||
85 | |||
86 | memset(&rv, 0, sizeof(rv)); | ||
87 | |||
88 | rv.msr_no = msr_no; | ||
89 | rv.reg.q = q; | ||
90 | |||
91 | err = smp_call_function_single(cpu, __wrmsr_on_cpu, &rv, 1); | ||
92 | |||
93 | return err; | ||
94 | } | ||
95 | EXPORT_SYMBOL(wrmsrl_on_cpu); | ||
96 | |||
66 | static void __rwmsr_on_cpus(const struct cpumask *mask, u32 msr_no, | 97 | static void __rwmsr_on_cpus(const struct cpumask *mask, u32 msr_no, |
67 | struct msr *msrs, | 98 | struct msr *msrs, |
68 | void (*msr_func) (void *info)) | 99 | void (*msr_func) (void *info)) |
@@ -159,6 +190,37 @@ int wrmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h) | |||
159 | } | 190 | } |
160 | EXPORT_SYMBOL(wrmsr_safe_on_cpu); | 191 | EXPORT_SYMBOL(wrmsr_safe_on_cpu); |
161 | 192 | ||
193 | int wrmsrl_safe_on_cpu(unsigned int cpu, u32 msr_no, u64 q) | ||
194 | { | ||
195 | int err; | ||
196 | struct msr_info rv; | ||
197 | |||
198 | memset(&rv, 0, sizeof(rv)); | ||
199 | |||
200 | rv.msr_no = msr_no; | ||
201 | rv.reg.q = q; | ||
202 | |||
203 | err = smp_call_function_single(cpu, __wrmsr_safe_on_cpu, &rv, 1); | ||
204 | |||
205 | return err ? err : rv.err; | ||
206 | } | ||
207 | EXPORT_SYMBOL(wrmsrl_safe_on_cpu); | ||
208 | |||
209 | int rdmsrl_safe_on_cpu(unsigned int cpu, u32 msr_no, u64 *q) | ||
210 | { | ||
211 | int err; | ||
212 | struct msr_info rv; | ||
213 | |||
214 | memset(&rv, 0, sizeof(rv)); | ||
215 | |||
216 | rv.msr_no = msr_no; | ||
217 | err = smp_call_function_single(cpu, __rdmsr_safe_on_cpu, &rv, 1); | ||
218 | *q = rv.reg.q; | ||
219 | |||
220 | return err ? err : rv.err; | ||
221 | } | ||
222 | EXPORT_SYMBOL(rdmsrl_safe_on_cpu); | ||
223 | |||
162 | /* | 224 | /* |
163 | * These variants are significantly slower, but allows control over | 225 | * These variants are significantly slower, but allows control over |
164 | * the entire 32-bit GPR set. | 226 | * the entire 32-bit GPR set. |