aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86_64/kernel/mce.c2
-rw-r--r--arch/x86_64/kernel/mce_amd.c40
-rw-r--r--include/asm-x86_64/mce.h2
3 files changed, 13 insertions, 31 deletions
diff --git a/arch/x86_64/kernel/mce.c b/arch/x86_64/kernel/mce.c
index c69fc43cee7b..acd5816b1a6f 100644
--- a/arch/x86_64/kernel/mce.c
+++ b/arch/x86_64/kernel/mce.c
@@ -562,7 +562,7 @@ static struct sysdev_class mce_sysclass = {
562 set_kset_name("machinecheck"), 562 set_kset_name("machinecheck"),
563}; 563};
564 564
565static DEFINE_PER_CPU(struct sys_device, device_mce); 565DEFINE_PER_CPU(struct sys_device, device_mce);
566 566
567/* Why are there no generic functions for this? */ 567/* Why are there no generic functions for this? */
568#define ACCESSOR(name, var, start) \ 568#define ACCESSOR(name, var, start) \
diff --git a/arch/x86_64/kernel/mce_amd.c b/arch/x86_64/kernel/mce_amd.c
index 86e1e022b20e..b96682e5ff77 100644
--- a/arch/x86_64/kernel/mce_amd.c
+++ b/arch/x86_64/kernel/mce_amd.c
@@ -30,7 +30,7 @@
30#include <asm/idle.h> 30#include <asm/idle.h>
31 31
32#define PFX "mce_threshold: " 32#define PFX "mce_threshold: "
33#define VERSION "version 1.00.9" 33#define VERSION "version 1.0.10"
34#define NR_BANKS 5 34#define NR_BANKS 5
35#define THRESHOLD_MAX 0xFFF 35#define THRESHOLD_MAX 0xFFF
36#define INT_TYPE_APIC 0x00020000 36#define INT_TYPE_APIC 0x00020000
@@ -166,12 +166,6 @@ asmlinkage void mce_threshold_interrupt(void)
166 * Sysfs Interface 166 * Sysfs Interface
167 */ 167 */
168 168
169static struct sysdev_class threshold_sysclass = {
170 set_kset_name("threshold"),
171};
172
173static DEFINE_PER_CPU(struct sys_device, device_threshold);
174
175struct threshold_attr { 169struct threshold_attr {
176 struct attribute attr; 170 struct attribute attr;
177 ssize_t(*show) (struct threshold_bank *, char *); 171 ssize_t(*show) (struct threshold_bank *, char *);
@@ -332,8 +326,8 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, int bank)
332 b = per_cpu(threshold_banks, lcpu)[bank]; 326 b = per_cpu(threshold_banks, lcpu)[bank];
333 if (!b) 327 if (!b)
334 goto out; 328 goto out;
335 sprintf(name, "bank%i", bank); 329 sprintf(name, "threshold_bank%i", bank);
336 err = sysfs_create_link(&per_cpu(device_threshold, cpu).kobj, 330 err = sysfs_create_link(&per_cpu(device_mce, cpu).kobj,
337 &b->kobj, name); 331 &b->kobj, name);
338 if (err) 332 if (err)
339 goto out; 333 goto out;
@@ -353,8 +347,8 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, int bank)
353 b->bank = bank; 347 b->bank = bank;
354 b->interrupt_enable = 0; 348 b->interrupt_enable = 0;
355 b->threshold_limit = THRESHOLD_MAX; 349 b->threshold_limit = THRESHOLD_MAX;
356 kobject_set_name(&b->kobj, "bank%i", bank); 350 kobject_set_name(&b->kobj, "threshold_bank%i", bank);
357 b->kobj.parent = &per_cpu(device_threshold, cpu).kobj; 351 b->kobj.parent = &per_cpu(device_mce, cpu).kobj;
358 b->kobj.ktype = &threshold_ktype; 352 b->kobj.ktype = &threshold_ktype;
359 353
360 err = kobject_register(&b->kobj); 354 err = kobject_register(&b->kobj);
@@ -373,12 +367,6 @@ static __cpuinit int threshold_create_device(unsigned int cpu)
373 int bank; 367 int bank;
374 int err = 0; 368 int err = 0;
375 369
376 per_cpu(device_threshold, cpu).id = cpu;
377 per_cpu(device_threshold, cpu).cls = &threshold_sysclass;
378 err = sysdev_register(&per_cpu(device_threshold, cpu));
379 if (err)
380 goto out;
381
382 for (bank = 0; bank < NR_BANKS; ++bank) { 370 for (bank = 0; bank < NR_BANKS; ++bank) {
383 if (!(per_cpu(bank_map, cpu) & 1 << bank)) 371 if (!(per_cpu(bank_map, cpu) & 1 << bank))
384 continue; 372 continue;
@@ -407,8 +395,8 @@ static __cpuinit void threshold_remove_bank(unsigned int cpu, int bank)
407 if (!b) 395 if (!b)
408 return; 396 return;
409 if (shared_bank[bank] && atomic_read(&b->kobj.kref.refcount) > 2) { 397 if (shared_bank[bank] && atomic_read(&b->kobj.kref.refcount) > 2) {
410 sprintf(name, "bank%i", bank); 398 sprintf(name, "threshold_bank%i", bank);
411 sysfs_remove_link(&per_cpu(device_threshold, cpu).kobj, name); 399 sysfs_remove_link(&per_cpu(device_mce, cpu).kobj, name);
412 per_cpu(threshold_banks, cpu)[bank] = NULL; 400 per_cpu(threshold_banks, cpu)[bank] = NULL;
413 } else { 401 } else {
414 kobject_unregister(&b->kobj); 402 kobject_unregister(&b->kobj);
@@ -425,7 +413,6 @@ static __cpuinit void threshold_remove_device(unsigned int cpu)
425 continue; 413 continue;
426 threshold_remove_bank(cpu, bank); 414 threshold_remove_bank(cpu, bank);
427 } 415 }
428 sysdev_unregister(&per_cpu(device_threshold, cpu));
429} 416}
430 417
431/* link all existing siblings when first core comes up */ 418/* link all existing siblings when first core comes up */
@@ -518,23 +505,16 @@ static struct notifier_block threshold_cpu_notifier = {
518 505
519static __init int threshold_init_device(void) 506static __init int threshold_init_device(void)
520{ 507{
521 int err;
522 int lcpu = 0; 508 int lcpu = 0;
523 509
524 err = sysdev_class_register(&threshold_sysclass);
525 if (err)
526 goto out;
527
528 /* to hit CPUs online before the notifier is up */ 510 /* to hit CPUs online before the notifier is up */
529 for_each_online_cpu(lcpu) { 511 for_each_online_cpu(lcpu) {
530 err = threshold_create_device(lcpu); 512 int err = threshold_create_device(lcpu);
531 if (err) 513 if (err)
532 goto out; 514 return err;
533 } 515 }
534 register_cpu_notifier(&threshold_cpu_notifier); 516 register_cpu_notifier(&threshold_cpu_notifier);
535 517 return 0;
536 out:
537 return err;
538} 518}
539 519
540device_initcall(threshold_init_device); 520device_initcall(threshold_init_device);
diff --git a/include/asm-x86_64/mce.h b/include/asm-x86_64/mce.h
index 7229785094e3..08f721e1b7e8 100644
--- a/include/asm-x86_64/mce.h
+++ b/include/asm-x86_64/mce.h
@@ -74,6 +74,8 @@ struct mce_log {
74#include <asm/atomic.h> 74#include <asm/atomic.h>
75 75
76void mce_log(struct mce *m); 76void mce_log(struct mce *m);
77DECLARE_PER_CPU(struct sys_device, device_mce);
78
77#ifdef CONFIG_X86_MCE_INTEL 79#ifdef CONFIG_X86_MCE_INTEL
78void mce_intel_feature_init(struct cpuinfo_x86 *c); 80void mce_intel_feature_init(struct cpuinfo_x86 *c);
79#else 81#else