2005-04-16 15:20:36 -07:00
|
|
|
/*
|
|
|
|
* Intel specific MCE features.
|
|
|
|
* Copyright 2004 Zwane Mwaikambo <zwane@linuxpower.ca>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/interrupt.h>
|
|
|
|
#include <linux/percpu.h>
|
|
|
|
#include <asm/processor.h>
|
|
|
|
#include <asm/msr.h>
|
|
|
|
#include <asm/mce.h>
|
|
|
|
#include <asm/hw_irq.h>
|
2006-01-11 14:44:36 -07:00
|
|
|
#include <asm/idle.h>
|
2006-09-26 01:52:42 -07:00
|
|
|
#include <asm/therm_throt.h>
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
asmlinkage void smp_thermal_interrupt(void)
|
|
|
|
{
|
2006-09-26 01:52:42 -07:00
|
|
|
__u64 msr_val;
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
ack_APIC_irq();
|
|
|
|
|
2006-01-11 14:44:36 -07:00
|
|
|
exit_idle();
|
2005-04-16 15:20:36 -07:00
|
|
|
irq_enter();
|
2006-09-26 01:52:42 -07:00
|
|
|
|
|
|
|
rdmsrl(MSR_IA32_THERM_STATUS, msr_val);
|
|
|
|
if (therm_throt_process(msr_val & 1))
|
|
|
|
mce_log_therm_throt_event(smp_processor_id(), msr_val);
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
irq_exit();
|
|
|
|
}
|
|
|
|
|
[PATCH] x86_64: Change init sections for CPU hotplug support
This patch adds __cpuinit and __cpuinitdata sections that need to exist past
boot to support cpu hotplug.
Caveat: This is done *only* for EM64T CPU Hotplug support, on request from
Andi Kleen. Much of the generic hotplug code in kernel, and none of the other
archs that support CPU hotplug today, i386, ia64, ppc64, s390 and parisc dont
mark sections with __cpuinit, but only mark them as __devinit, and
__devinitdata.
If someone is motivated to change generic code, we need to make sure all
existing hotplug code does not break, on other arch's that dont use __cpuinit,
and __cpudevinit.
Signed-off-by: Ashok Raj <ashok.raj@intel.com>
Acked-by: Andi Kleen <ak@muc.de>
Acked-by: Zwane Mwaikambo <zwane@arm.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-25 14:54:58 -07:00
|
|
|
static void __cpuinit intel_init_thermal(struct cpuinfo_x86 *c)
|
2005-04-16 15:20:36 -07:00
|
|
|
{
|
|
|
|
u32 l, h;
|
|
|
|
int tm2 = 0;
|
|
|
|
unsigned int cpu = smp_processor_id();
|
|
|
|
|
|
|
|
if (!cpu_has(c, X86_FEATURE_ACPI))
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (!cpu_has(c, X86_FEATURE_ACC))
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* first check if TM1 is already enabled by the BIOS, in which
|
|
|
|
* case there might be some SMM goo which handles it, so we can't even
|
|
|
|
* put a handler since it might be delivered via SMI already.
|
|
|
|
*/
|
|
|
|
rdmsr(MSR_IA32_MISC_ENABLE, l, h);
|
|
|
|
h = apic_read(APIC_LVTTHMR);
|
|
|
|
if ((l & (1 << 3)) && (h & APIC_DM_SMI)) {
|
|
|
|
printk(KERN_DEBUG
|
|
|
|
"CPU%d: Thermal monitoring handled by SMI\n", cpu);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (cpu_has(c, X86_FEATURE_TM2) && (l & (1 << 13)))
|
|
|
|
tm2 = 1;
|
|
|
|
|
|
|
|
if (h & APIC_VECTOR_MASK) {
|
|
|
|
printk(KERN_DEBUG
|
|
|
|
"CPU%d: Thermal LVT vector (%#x) already "
|
|
|
|
"installed\n", cpu, (h & APIC_VECTOR_MASK));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
h = THERMAL_APIC_VECTOR;
|
|
|
|
h |= (APIC_DM_FIXED | APIC_LVT_MASKED);
|
2006-01-11 14:46:51 -07:00
|
|
|
apic_write(APIC_LVTTHMR, h);
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
rdmsr(MSR_IA32_THERM_INTERRUPT, l, h);
|
|
|
|
wrmsr(MSR_IA32_THERM_INTERRUPT, l | 0x03, h);
|
|
|
|
|
|
|
|
rdmsr(MSR_IA32_MISC_ENABLE, l, h);
|
|
|
|
wrmsr(MSR_IA32_MISC_ENABLE, l | (1 << 3), h);
|
|
|
|
|
|
|
|
l = apic_read(APIC_LVTTHMR);
|
2006-01-11 14:46:51 -07:00
|
|
|
apic_write(APIC_LVTTHMR, l & ~APIC_LVT_MASKED);
|
2005-04-16 15:20:36 -07:00
|
|
|
printk(KERN_INFO "CPU%d: Thermal monitoring enabled (%s)\n",
|
|
|
|
cpu, tm2 ? "TM2" : "TM1");
|
2006-09-26 01:52:42 -07:00
|
|
|
|
|
|
|
/* enable thermal throttle processing */
|
|
|
|
atomic_set(&therm_throt_en, 1);
|
2005-04-16 15:20:36 -07:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
[PATCH] x86_64: Change init sections for CPU hotplug support
This patch adds __cpuinit and __cpuinitdata sections that need to exist past
boot to support cpu hotplug.
Caveat: This is done *only* for EM64T CPU Hotplug support, on request from
Andi Kleen. Much of the generic hotplug code in kernel, and none of the other
archs that support CPU hotplug today, i386, ia64, ppc64, s390 and parisc dont
mark sections with __cpuinit, but only mark them as __devinit, and
__devinitdata.
If someone is motivated to change generic code, we need to make sure all
existing hotplug code does not break, on other arch's that dont use __cpuinit,
and __cpudevinit.
Signed-off-by: Ashok Raj <ashok.raj@intel.com>
Acked-by: Andi Kleen <ak@muc.de>
Acked-by: Zwane Mwaikambo <zwane@arm.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-25 14:54:58 -07:00
|
|
|
void __cpuinit mce_intel_feature_init(struct cpuinfo_x86 *c)
|
2005-04-16 15:20:36 -07:00
|
|
|
{
|
|
|
|
intel_init_thermal(c);
|
|
|
|
}
|