2002-04-17 10:14:05

by Zwane Mwaikambo

[permalink] [raw]
Subject: [PATCH][2.5-dj] P4 thermal LVT (damage control)

This patch avoids frobbing the LVT if we haven't touched it. In
particular, the case where its handled by SMM. And changes one #ifdef
(Dave does that look ok?)

Against 2.5.8-dj1

<insert "please apply" chanting and bone throwing here>

--- linux-2.5-dj/arch/i386/kernel/apic.c.orig Wed Apr 17 09:52:58 2002
+++ linux-2.5-dj/arch/i386/kernel/apic.c Wed Apr 17 10:25:33 2002
@@ -78,6 +78,13 @@
apic_write_around(APIC_LVTPC, v | APIC_LVT_MASKED);
}

+/* lets not touch this if we didn't frob it */
+#ifdef CONFIG_X86_MCE_P4THERMAL
+ if (maxlvt >= 5) {
+ v = apic_read(APIC_LVTTHMR);
+ apic_write_around(APIC_LVTTHMR, v | APIC_LVT_MASKED);
+ }
+#endif
/*
* Clean APIC state for other OSs:
*/
@@ -88,6 +95,11 @@
apic_write_around(APIC_LVTERR, APIC_LVT_MASKED);
if (maxlvt >= 4)
apic_write_around(APIC_LVTPC, APIC_LVT_MASKED);
+
+#ifdef CONFIG_X86_MCE_P4THERMAL
+ if (maxlvt >= 5)
+ apic_write_around(APIC_LVTTHRM, APIC_LVT_MASKED);
+#endif
v = GET_APIC_VERSION(apic_read(APIC_LVR));
if (APIC_INTEGRATED(v)) { /* !82489DX */
if (maxlvt > 3) /* Due to Pentium errata 3AP and 11AP. */
@@ -472,6 +484,7 @@
apic_pm_state.apic_tmict = apic_read(APIC_TMICT);
apic_pm_state.apic_tdcr = apic_read(APIC_TDCR);
apic_pm_state.apic_thmr = apic_read(APIC_LVTTHMR);
+
__save_flags(flags);
__cli();
disable_local_APIC();
--- linux-2.5-dj/include/asm/hw_irq.h.orig Wed Apr 17 10:48:28 2002
+++ linux-2.5-dj/include/asm/hw_irq.h Wed Apr 17 11:13:53 2002
@@ -38,6 +38,7 @@
extern asmlinkage void apic_timer_interrupt(void);
extern asmlinkage void error_interrupt(void);
extern asmlinkage void spurious_interrupt(void);
+extern asmlinkage void smp_thermal_interrupt(struct pt_regs);
#endif

extern void mask_irq(unsigned int irq);
--- linux-2.5-dj/arch/i386/kernel/i8259.c.orig Wed Apr 17 10:37:55 2002
+++ linux-2.5-dj/arch/i386/kernel/i8259.c Wed Apr 17 11:33:38 2002
@@ -393,7 +393,7 @@
set_intr_gate(ERROR_APIC_VECTOR, error_interrupt);

/* thermal monitor LVT interrupt */
-#ifdef CONFIG_MPENTIUM4
+#ifdef CONFIG_X86_MCE_P4THERMAL
set_intr_gate(THERMAL_APIC_VECTOR, thermal_interrupt);
#endif
#endif

--
http://function.linuxpower.ca


2002-04-17 12:49:52

by Dave Jones

[permalink] [raw]
Subject: Re: [PATCH][2.5-dj] P4 thermal LVT (damage control)

On Wed, Apr 17, 2002 at 11:57:40AM +0200, Zwane Mwaikambo wrote:
> This patch avoids frobbing the LVT if we haven't touched it. In
> particular, the case where its handled by SMM. And changes one #ifdef
> (Dave does that look ok?)
>
> Against 2.5.8-dj1
>
> <insert "please apply" chanting and bone throwing here>

more icky ifdefs, but I don't think we can do this cleanly any other
way without ripping things apart to something like a bluesmoke-p4.c
and the likes.

applied.

--
| Dave Jones. http://www.codemonkey.org.uk
| SuSE Labs

2002-04-17 12:57:24

by Zwane Mwaikambo

[permalink] [raw]
Subject: Re: [PATCH][2.5-dj] P4 thermal LVT (damage control)

On Wed, 17 Apr 2002, Dave Jones wrote:

> more icky ifdefs, but I don't think we can do this cleanly any other
> way without ripping things apart to something like a bluesmoke-p4.c
> and the likes.

Its your call, i can split it up if worst comes to worst.

> applied.

Thanks
Zwane
--
http://function.linuxpower.ca



2002-04-17 15:15:40

by Dave Jones

[permalink] [raw]
Subject: Re: [PATCH][2.5-dj] P4 thermal LVT (damage control)

On Wed, Apr 17, 2002 at 02:40:59PM +0200, Zwane Mwaikambo wrote:
> On Wed, 17 Apr 2002, Dave Jones wrote:
>
> > more icky ifdefs, but I don't think we can do this cleanly any other
> > way without ripping things apart to something like a bluesmoke-p4.c
> > and the likes.
>
> Its your call, i can split it up if worst comes to worst.

I'll take a look at it when Patrick Mochel's arch/i386/kernel/ splitup
gets merged.

--
| Dave Jones. http://www.codemonkey.org.uk
| SuSE Labs