aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/cpu
diff options
context:
space:
mode:
authorBorislav Petkov <borislav.petkov@amd.com>2012-04-27 06:53:59 -0400
committerBorislav Petkov <borislav.petkov@amd.com>2012-06-07 06:43:46 -0400
commit2c9c42fa98c283961b7f6b6542fb4bf0c0539e15 (patch)
tree59130b1547fefd1ede9e41671d5f14e9a76527a8 /arch/x86/kernel/cpu
parent18c20f373b76a64270a991396b06542abaf9f530 (diff)
x86, MCE, AMD: Cleanup reading of error_count
We have rdmsr_on_cpu() now so remove locally defined solution in favor of the generic one. No functionality change. Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
Diffstat (limited to 'arch/x86/kernel/cpu')
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce_amd.c23
1 files changed, 5 insertions, 18 deletions
diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd.c b/arch/x86/kernel/cpu/mcheck/mce_amd.c
index 0b1bb0e15881..a7204ef37223 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_amd.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_amd.c
@@ -359,27 +359,14 @@ store_threshold_limit(struct threshold_block *b, const char *buf, size_t size)
359 return size; 359 return size;
360} 360}
361 361
362struct threshold_block_cross_cpu {
363 struct threshold_block *tb;
364 long retval;
365};
366
367static void local_error_count_handler(void *_tbcc)
368{
369 struct threshold_block_cross_cpu *tbcc = _tbcc;
370 struct threshold_block *b = tbcc->tb;
371 u32 low, high;
372
373 rdmsr(b->address, low, high);
374 tbcc->retval = (high & 0xFFF) - (THRESHOLD_MAX - b->threshold_limit);
375}
376
377static ssize_t show_error_count(struct threshold_block *b, char *buf) 362static ssize_t show_error_count(struct threshold_block *b, char *buf)
378{ 363{
379 struct threshold_block_cross_cpu tbcc = { .tb = b, }; 364 u32 lo, hi;
365
366 rdmsr_on_cpu(b->cpu, b->address, &lo, &hi);
380 367
381 smp_call_function_single(b->cpu, local_error_count_handler, &tbcc, 1); 368 return sprintf(buf, "%u\n", ((hi & THRESHOLD_MAX) -
382 return sprintf(buf, "%lu\n", tbcc.retval); 369 (THRESHOLD_MAX - b->threshold_limit)));
383} 370}
384 371
385static ssize_t store_error_count(struct threshold_block *b, 372static ssize_t store_error_count(struct threshold_block *b,