diff options
author | H. Peter Anvin <hpa@zytor.com> | 2009-02-24 19:11:51 -0500 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2009-02-24 19:11:51 -0500 |
commit | 638bee71c83a2837b48062fdc5b222163cf53d79 (patch) | |
tree | 9c1699c07a5aa547d769138317279b8ee1ba89e8 /arch/x86/kernel/cpu/mcheck | |
parent | 2aaa822984b97efd894d10d1e1382206ef0291a7 (diff) | |
parent | a852cbfaaf8122827602027b1614971cfd832304 (diff) |
Merge branch 'x86/core' into x86/mce2
Diffstat (limited to 'arch/x86/kernel/cpu/mcheck')
-rw-r--r-- | arch/x86/kernel/cpu/mcheck/mce_amd_64.c | 21 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/mcheck/mce_intel_64.c | 7 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/mcheck/p4.c | 4 |
3 files changed, 20 insertions, 12 deletions
diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd_64.c b/arch/x86/kernel/cpu/mcheck/mce_amd_64.c index ee8bfcd3aa32..c5a32f92d07e 100644 --- a/arch/x86/kernel/cpu/mcheck/mce_amd_64.c +++ b/arch/x86/kernel/cpu/mcheck/mce_amd_64.c | |||
@@ -67,7 +67,7 @@ static struct threshold_block threshold_defaults = { | |||
67 | struct threshold_bank { | 67 | struct threshold_bank { |
68 | struct kobject *kobj; | 68 | struct kobject *kobj; |
69 | struct threshold_block *blocks; | 69 | struct threshold_block *blocks; |
70 | cpumask_t cpus; | 70 | cpumask_var_t cpus; |
71 | }; | 71 | }; |
72 | static DEFINE_PER_CPU(struct threshold_bank *, threshold_banks[NR_BANKS]); | 72 | static DEFINE_PER_CPU(struct threshold_bank *, threshold_banks[NR_BANKS]); |
73 | 73 | ||
@@ -477,7 +477,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank) | |||
477 | 477 | ||
478 | #ifdef CONFIG_SMP | 478 | #ifdef CONFIG_SMP |
479 | if (cpu_data(cpu).cpu_core_id && shared_bank[bank]) { /* symlink */ | 479 | if (cpu_data(cpu).cpu_core_id && shared_bank[bank]) { /* symlink */ |
480 | i = first_cpu(per_cpu(cpu_core_map, cpu)); | 480 | i = cpumask_first(&per_cpu(cpu_core_map, cpu)); |
481 | 481 | ||
482 | /* first core not up yet */ | 482 | /* first core not up yet */ |
483 | if (cpu_data(i).cpu_core_id) | 483 | if (cpu_data(i).cpu_core_id) |
@@ -497,7 +497,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank) | |||
497 | if (err) | 497 | if (err) |
498 | goto out; | 498 | goto out; |
499 | 499 | ||
500 | b->cpus = per_cpu(cpu_core_map, cpu); | 500 | cpumask_copy(b->cpus, &per_cpu(cpu_core_map, cpu)); |
501 | per_cpu(threshold_banks, cpu)[bank] = b; | 501 | per_cpu(threshold_banks, cpu)[bank] = b; |
502 | goto out; | 502 | goto out; |
503 | } | 503 | } |
@@ -508,15 +508,20 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank) | |||
508 | err = -ENOMEM; | 508 | err = -ENOMEM; |
509 | goto out; | 509 | goto out; |
510 | } | 510 | } |
511 | if (!alloc_cpumask_var(&b->cpus, GFP_KERNEL)) { | ||
512 | kfree(b); | ||
513 | err = -ENOMEM; | ||
514 | goto out; | ||
515 | } | ||
511 | 516 | ||
512 | b->kobj = kobject_create_and_add(name, &per_cpu(device_mce, cpu).kobj); | 517 | b->kobj = kobject_create_and_add(name, &per_cpu(device_mce, cpu).kobj); |
513 | if (!b->kobj) | 518 | if (!b->kobj) |
514 | goto out_free; | 519 | goto out_free; |
515 | 520 | ||
516 | #ifndef CONFIG_SMP | 521 | #ifndef CONFIG_SMP |
517 | b->cpus = CPU_MASK_ALL; | 522 | cpumask_setall(b->cpus); |
518 | #else | 523 | #else |
519 | b->cpus = per_cpu(cpu_core_map, cpu); | 524 | cpumask_copy(b->cpus, &per_cpu(cpu_core_map, cpu)); |
520 | #endif | 525 | #endif |
521 | 526 | ||
522 | per_cpu(threshold_banks, cpu)[bank] = b; | 527 | per_cpu(threshold_banks, cpu)[bank] = b; |
@@ -525,7 +530,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank) | |||
525 | if (err) | 530 | if (err) |
526 | goto out_free; | 531 | goto out_free; |
527 | 532 | ||
528 | for_each_cpu_mask_nr(i, b->cpus) { | 533 | for_each_cpu(i, b->cpus) { |
529 | if (i == cpu) | 534 | if (i == cpu) |
530 | continue; | 535 | continue; |
531 | 536 | ||
@@ -541,6 +546,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank) | |||
541 | 546 | ||
542 | out_free: | 547 | out_free: |
543 | per_cpu(threshold_banks, cpu)[bank] = NULL; | 548 | per_cpu(threshold_banks, cpu)[bank] = NULL; |
549 | free_cpumask_var(b->cpus); | ||
544 | kfree(b); | 550 | kfree(b); |
545 | out: | 551 | out: |
546 | return err; | 552 | return err; |
@@ -615,7 +621,7 @@ static void threshold_remove_bank(unsigned int cpu, int bank) | |||
615 | #endif | 621 | #endif |
616 | 622 | ||
617 | /* remove all sibling symlinks before unregistering */ | 623 | /* remove all sibling symlinks before unregistering */ |
618 | for_each_cpu_mask_nr(i, b->cpus) { | 624 | for_each_cpu(i, b->cpus) { |
619 | if (i == cpu) | 625 | if (i == cpu) |
620 | continue; | 626 | continue; |
621 | 627 | ||
@@ -628,6 +634,7 @@ static void threshold_remove_bank(unsigned int cpu, int bank) | |||
628 | free_out: | 634 | free_out: |
629 | kobject_del(b->kobj); | 635 | kobject_del(b->kobj); |
630 | kobject_put(b->kobj); | 636 | kobject_put(b->kobj); |
637 | free_cpumask_var(b->cpus); | ||
631 | kfree(b); | 638 | kfree(b); |
632 | per_cpu(threshold_banks, cpu)[bank] = NULL; | 639 | per_cpu(threshold_banks, cpu)[bank] = NULL; |
633 | } | 640 | } |
diff --git a/arch/x86/kernel/cpu/mcheck/mce_intel_64.c b/arch/x86/kernel/cpu/mcheck/mce_intel_64.c index 7a2e10fcfa34..aaa7d9730938 100644 --- a/arch/x86/kernel/cpu/mcheck/mce_intel_64.c +++ b/arch/x86/kernel/cpu/mcheck/mce_intel_64.c | |||
@@ -9,6 +9,7 @@ | |||
9 | #include <linux/interrupt.h> | 9 | #include <linux/interrupt.h> |
10 | #include <linux/percpu.h> | 10 | #include <linux/percpu.h> |
11 | #include <asm/processor.h> | 11 | #include <asm/processor.h> |
12 | #include <asm/apic.h> | ||
12 | #include <asm/msr.h> | 13 | #include <asm/msr.h> |
13 | #include <asm/mce.h> | 14 | #include <asm/mce.h> |
14 | #include <asm/hw_irq.h> | 15 | #include <asm/hw_irq.h> |
@@ -51,13 +52,13 @@ static void intel_init_thermal(struct cpuinfo_x86 *c) | |||
51 | */ | 52 | */ |
52 | rdmsr(MSR_IA32_MISC_ENABLE, l, h); | 53 | rdmsr(MSR_IA32_MISC_ENABLE, l, h); |
53 | h = apic_read(APIC_LVTTHMR); | 54 | h = apic_read(APIC_LVTTHMR); |
54 | if ((l & (1 << 3)) && (h & APIC_DM_SMI)) { | 55 | if ((l & MSR_IA32_MISC_ENABLE_TM1) && (h & APIC_DM_SMI)) { |
55 | printk(KERN_DEBUG | 56 | printk(KERN_DEBUG |
56 | "CPU%d: Thermal monitoring handled by SMI\n", cpu); | 57 | "CPU%d: Thermal monitoring handled by SMI\n", cpu); |
57 | return; | 58 | return; |
58 | } | 59 | } |
59 | 60 | ||
60 | if (cpu_has(c, X86_FEATURE_TM2) && (l & (1 << 13))) | 61 | if (cpu_has(c, X86_FEATURE_TM2) && (l & MSR_IA32_MISC_ENABLE_TM2)) |
61 | tm2 = 1; | 62 | tm2 = 1; |
62 | 63 | ||
63 | if (h & APIC_VECTOR_MASK) { | 64 | if (h & APIC_VECTOR_MASK) { |
@@ -75,7 +76,7 @@ static void intel_init_thermal(struct cpuinfo_x86 *c) | |||
75 | wrmsr(MSR_IA32_THERM_INTERRUPT, l | 0x03, h); | 76 | wrmsr(MSR_IA32_THERM_INTERRUPT, l | 0x03, h); |
76 | 77 | ||
77 | rdmsr(MSR_IA32_MISC_ENABLE, l, h); | 78 | rdmsr(MSR_IA32_MISC_ENABLE, l, h); |
78 | wrmsr(MSR_IA32_MISC_ENABLE, l | (1 << 3), h); | 79 | wrmsr(MSR_IA32_MISC_ENABLE, l | MSR_IA32_MISC_ENABLE_TM1, h); |
79 | 80 | ||
80 | l = apic_read(APIC_LVTTHMR); | 81 | l = apic_read(APIC_LVTTHMR); |
81 | apic_write(APIC_LVTTHMR, l & ~APIC_LVT_MASKED); | 82 | apic_write(APIC_LVTTHMR, l & ~APIC_LVT_MASKED); |
diff --git a/arch/x86/kernel/cpu/mcheck/p4.c b/arch/x86/kernel/cpu/mcheck/p4.c index 9b60fce09f75..f53bdcbaf382 100644 --- a/arch/x86/kernel/cpu/mcheck/p4.c +++ b/arch/x86/kernel/cpu/mcheck/p4.c | |||
@@ -85,7 +85,7 @@ static void intel_init_thermal(struct cpuinfo_x86 *c) | |||
85 | */ | 85 | */ |
86 | rdmsr(MSR_IA32_MISC_ENABLE, l, h); | 86 | rdmsr(MSR_IA32_MISC_ENABLE, l, h); |
87 | h = apic_read(APIC_LVTTHMR); | 87 | h = apic_read(APIC_LVTTHMR); |
88 | if ((l & (1<<3)) && (h & APIC_DM_SMI)) { | 88 | if ((l & MSR_IA32_MISC_ENABLE_TM1) && (h & APIC_DM_SMI)) { |
89 | printk(KERN_DEBUG "CPU%d: Thermal monitoring handled by SMI\n", | 89 | printk(KERN_DEBUG "CPU%d: Thermal monitoring handled by SMI\n", |
90 | cpu); | 90 | cpu); |
91 | return; /* -EBUSY */ | 91 | return; /* -EBUSY */ |
@@ -111,7 +111,7 @@ static void intel_init_thermal(struct cpuinfo_x86 *c) | |||
111 | vendor_thermal_interrupt = intel_thermal_interrupt; | 111 | vendor_thermal_interrupt = intel_thermal_interrupt; |
112 | 112 | ||
113 | rdmsr(MSR_IA32_MISC_ENABLE, l, h); | 113 | rdmsr(MSR_IA32_MISC_ENABLE, l, h); |
114 | wrmsr(MSR_IA32_MISC_ENABLE, l | (1<<3), h); | 114 | wrmsr(MSR_IA32_MISC_ENABLE, l | MSR_IA32_MISC_ENABLE_TM1, h); |
115 | 115 | ||
116 | l = apic_read(APIC_LVTTHMR); | 116 | l = apic_read(APIC_LVTTHMR); |
117 | apic_write(APIC_LVTTHMR, l & ~APIC_LVT_MASKED); | 117 | apic_write(APIC_LVTTHMR, l & ~APIC_LVT_MASKED); |