public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Disable APIC on reboot.
@ 2003-08-11 13:40 davej
  2003-08-11 15:33 ` [PATCH-2.4] " Willy Tarreau
  2003-08-11 16:29 ` [PATCH] " Mikael Pettersson
  0 siblings, 2 replies; 14+ messages in thread
From: davej @ 2003-08-11 13:40 UTC (permalink / raw)
  To: torvalds; +Cc: linux-kernel

Forward port of a patch from Felix [surname mangled by MTA] <fxkuehl@gmx.de>

Original mail:-

when I reboot my laptop the BIOS complains about a keyboard controller
failure and timer interrupts not working. On the BIOS password screen
the keyboard doesn't work. If I disable the BIOS password the system
hangs a bit later on the POST screen. I tried all reboot methods via the
kernel command line without success. I saw this problem with Debian
Woody's precompiled 2.4.18 kernel, self compiled Debian 2.4.20 sources
and Linux 2.4.21-rc1+ACPI patch. This problem only occurs if
CONFIG_X86_LOCAL_APIC is enabled. With CONFIG_X86_LOCAL_APIC disabled it
reboots just fine.

My guess is that it's a BIOS bug as I've never had this problem on other
machines before. I found a workaround: disable the local APIC before
rebooting. I don't really know how it works. Just calling
disable_local_APIC wasn't enough, so I copied a bit more code from
apic_pm_suspend (arch/i386/kernel/apic.c:465) to machine_restart
(arch/i386/kernel/process.c:369). I'm pretty sure that this is not the
proper way to do it but it works here. A patch against 2.4.21-rc1 can be
found at the end of this email.

diff -urpN --exclude-from=/home/davej/.exclude bk-linus/arch/i386/kernel/reboot.c linux-2.5/arch/i386/kernel/reboot.c
--- bk-linus/arch/i386/kernel/reboot.c	2003-05-13 11:51:12.000000000 +0100
+++ linux-2.5/arch/i386/kernel/reboot.c	2003-07-16 02:54:29.000000000 +0100
@@ -8,6 +8,7 @@
 #include <linux/interrupt.h>
 #include <linux/mc146818rtc.h>
 #include <asm/uaccess.h>
+#include <asm/apic.h>
 #include "mach_reboot.h"
 
 /*
@@ -250,6 +251,19 @@ void machine_restart(char * __unused)
 	 */
 	smp_send_stop();
 	disable_IO_APIC();
+#else
+#ifdef CONFIG_X86_LOCAL_APIC
+	{
+	unsigned int l, h;
+
+	local_irq_disable();
+	disable_local_APIC();
+	rdmsr(MSR_IA32_APICBASE, l, h);
+	l &= ~MSR_IA32_APICBASE_ENABLE;
+	wrmsr(MSR_IA32_APICBASE, l, h);
+	local_irq_enable();
+}
+#endif
 #endif
 
 	if(!reboot_thru_bios) {

^ permalink raw reply	[flat|nested] 14+ messages in thread
* Re: [PATCH][2.4.22-rc2] Disable APIC on reboot.
@ 2003-08-18 22:34 Mikael Pettersson
  0 siblings, 0 replies; 14+ messages in thread
From: Mikael Pettersson @ 2003-08-18 22:34 UTC (permalink / raw)
  To: m.c.p; +Cc: fxkuehl, linux-kernel, marcelo, willy

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1382 bytes --]

On Fri, 15 Aug 2003 21:22:10 +0200, Marc-Christian Petersen wrote:
>> disable_local_APIC() now checks if detect_init_APIC() enabled the
>> local APIC via the APIC_BASE MSR, and if so it now disables APIC_BASE.
>> Previously we would leave APIC_BASE enabled, and that made some
>> BIOSen unhappy.
>> The SMP reboot code calls disable_local_APIC(). On SMP HW there is
>> no change since detect_init_APIC() isn't called and APIC_BASE isn't
>> enabled by us. An SMP kernel on UP HW behaves just like an UP_APIC
>> kernel, so it disables APIC_BASE if we enabled it at boot.
>> The UP_APIC disable-before-suspend code is simplified since the existing
>> code to disable APIC_BASE is moved into disable_local_APIC().
>> (Felix Kühling originally reported the BIOS reboot problem. This is a
>> fixed-up version of his preliminary patch.)
>
>please correct me if I say something really stupid now but shouldn't the APIC 
>be disabled only during reboot time and enabled again at a new boot?
>
>my experience with this patch is, after a reboot he APIC isn't enabled again 
>until I power off my machine.

Seems impossible to me. We _know_ how to enable APIC_BASE,
otherwise this code wouldn't trigger at all.
Please give evidence as to what goes wrong, i.e., dmesg logs
from first (cold) and subsequent (warm) boots.
(Preferably from a standard 2.4.22-rc2 so I can verify the code.)

/Mikael

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2003-08-27  7:25 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-08-11 13:40 [PATCH] Disable APIC on reboot davej
2003-08-11 15:33 ` [PATCH-2.4] " Willy Tarreau
2003-08-11 16:29 ` [PATCH] " Mikael Pettersson
2003-08-11 16:38   ` Dave Jones
2003-08-11 16:57     ` Mikael Pettersson
2003-08-11 23:33       ` [PATCH][2.6.0-test3] " Mikael Pettersson
2003-08-12 13:48         ` Maciej W. Rozycki
2003-08-12 13:57           ` Mikael Pettersson
2003-08-12 14:31             ` Maciej W. Rozycki
2003-08-11 23:33       ` [PATCH][2.4.22-rc2] " Mikael Pettersson
2003-08-12  6:09         ` Willy Tarreau
2003-08-15 19:22         ` Marc-Christian Petersen
2003-08-27  7:19         ` Luca Montecchiani
  -- strict thread matches above, loose matches on Subject: below --
2003-08-18 22:34 Mikael Pettersson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox