Skip to contentSkip to conversation

APIC on laptop hangs the system @ powerstate change

DISCUSSION Mikael Pettersson 1 participant 1 message Jan 1, 2002

lore
Share & tools
lore
#0 lore raw
Quoted 9 lines · Todor Todorov

I have a Dell Inspiron 8000 Laptop with PIII Mobile processor. ... But I seem
to have a problem with APIC and changes of the power state. APIC gets discovered and enabled when the kernel boots with no indication of any problem. ACPI works too. Now, if I detach the power cable when it's plugged in or vice versa, the system hangs without any chance for recovery than hard boot.
...
obeserved hang behavior allways reproducable with kernels 2.4.16,

Quoted 8 lines

2.4.17-pre8, 2.4.17, 2.4.18-pre1, 2.5.1, 2.5.2-pre3 with APIC + either ACPI or APM, tried compiles with gcc-2.95.4, gcc-3.0.1, gcc-3.0.2, gcc-3.0.3 This hangs occures allways when APIC support on uniprocessors is compiled in, no matter what power managemnet sheme is used. It never occures when APIC is not present, no matter of which kernel version you'd take. Besides this, with APIC compiled in, shutdown -h or even halt -f fails to pwer off the sistem (it goes down and halted but the power remains on).

Known problem. Dell's putting local APIC-capable Mobile P6s in their recent laptops but haven't updated their BIOSen to handle enabled local APICs. (Older Mobile P6s didn't have local APICs.) This results in the problems you've described: hangs whenever the BIOS is activated, i.e. at PM events and when accessing the BIOS setup screens.

The only known solution is to keep the local APIC disabled in Linux when using a Dell laptop. The patch included below (for 2.4.17) will do that automatically for you; alternatively you can reconfigure your kernel with CONFIG_X86_UP_APIC=n (and CONFIG_SMP=n).

/Mikael

arch/i386/kernel/apic.c renamed from arch/i386/kernel/apic.c.~1~ +11 -0
@@ -571,12 +571,17 @@
  * Detect and enable local APICs on non-SMP boards.
  * Original code written by Keir Fraser.
  */
+int dont_enable_local_apic __initdata = 0;
 
 static int __init detect_init_APIC (void)
 {
 	u32 h, l, features;
 	extern void get_cpu_vendor(struct cpuinfo_x86*);
 
+	/* Disabled by DMI scan or kernel option? */
+	if (dont_enable_local_apic)
+		return -1;
+
 	/* Workaround for us being called before identify_cpu(). */
 	get_cpu_vendor(&boot_cpu_data);
 
@@ -894,8 +899,14 @@
 
 static unsigned int calibration_result;
 
+int dont_use_local_apic_timer __initdata = 0;
+
 void __init setup_APIC_clocks (void)
 {
+	/* Disabled by DMI scan or kernel option? */
+	if (dont_use_local_apic_timer)
+		return;
+
 	printk("Using local APIC timer interrupts.\n");
 	using_apic_timer = 1;
 
arch/i386/kernel/dmi_scan.c renamed from arch/i386/kernel/dmi_scan.c.~1~ +61 -6

112 lines not on this page · raw message

arch/i386/kernel/setup.c renamed from arch/i386/kernel/setup.c.~1~ +1 -1
@@ -992,7 +992,6 @@
 	 */
 	if (smp_found_config)
 		get_smp_config();
-	init_apic_mappings();
 #endif
 
 
@@ -1044,6 +1043,7 @@
 	conswitchp = &dummy_con;
 #endif
 #endif
+	dmi_scan_machine();
 }
 
 static int cachesize_override __initdata = -1;
arch/i386/kernel/traps.c renamed from arch/i386/kernel/traps.c.~1~ +4 -0
@@ -920,6 +920,10 @@
 		EISA_bus = 1;
 #endif
 
+#ifdef CONFIG_X86_LOCAL_APIC
+	init_apic_mappings();
+#endif
+
 	set_trap_gate(0,&divide_error);
 	set_trap_gate(1,&debug);
 	set_intr_gate(2,&nmi);
arch/i386/mm/init.c renamed from arch/i386/mm/init.c.~1~ +2 -5
@@ -128,7 +128,6 @@
 static inline void set_pte_phys (unsigned long vaddr,
 			unsigned long phys, pgprot_t flags)
 {
-	pgprot_t prot;
 	pgd_t *pgd;
 	pmd_t *pmd;
 	pte_t *pte;
@@ -144,10 +143,8 @@
 		return;
 	}
 	pte = pte_offset(pmd, vaddr);
-	if (pte_val(*pte))
-		pte_ERROR(*pte);
-	pgprot_val(prot) = pgprot_val(PAGE_KERNEL) | pgprot_val(flags);
-	set_pte(pte, mk_pte_phys(phys, prot));
+	/* <phys,flags> stored as-is, to permit clearing entries */
+	set_pte(pte, mk_pte_phys(phys, flags));
 
 	/*
 	 * It's enough to flush this one mapping.
arch/i386/mm/ioremap.c renamed from arch/i386/mm/ioremap.c.~1~ +66 -0

69 lines not on this page · raw message

include/asm-i386/fixmap.h renamed from include/asm-i386/fixmap.h.~1~ +7 -2
@@ -65,6 +65,11 @@
 	FIX_KMAP_BEGIN,	/* reserved pte's for temporary kernel mappings */
 	FIX_KMAP_END = FIX_KMAP_BEGIN+(KM_TYPE_NR*NR_CPUS)-1,
 #endif
+	__end_of_permanent_fixed_addresses,
+	/* temporary boot-time mappings, used before ioremap() is functional */
+#define NR_FIX_BTMAPS	16
+	FIX_BTMAP_END = __end_of_permanent_fixed_addresses,
+	FIX_BTMAP_BEGIN = FIX_BTMAP_END + NR_FIX_BTMAPS - 1,
 	__end_of_fixed_addresses
 };
 
@@ -86,8 +91,8 @@
  * at the top of mem..
  */
 #define FIXADDR_TOP	(0xffffe000UL)
-#define FIXADDR_SIZE	(__end_of_fixed_addresses << PAGE_SHIFT)
-#define FIXADDR_START	(FIXADDR_TOP - FIXADDR_SIZE)
+#define __FIXADDR_SIZE	(__end_of_permanent_fixed_addresses << PAGE_SHIFT)
+#define FIXADDR_START	(FIXADDR_TOP - __FIXADDR_SIZE)
 
 #define __fix_to_virt(x)	(FIXADDR_TOP - ((x) << PAGE_SHIFT))
 
include/asm-i386/io.h renamed from include/asm-i386/io.h.~1~ +8 -0
@@ -98,6 +98,14 @@
 extern void iounmap(void *addr);
 
 /*
+ * bt_ioremap() and bt_iounmap() are for temporary early boot-time
+ * mappings, before the real ioremap() is functional.
+ * A boot-time mapping is currently limited to at most 16 pages.
+ */
+extern void *bt_ioremap(unsigned long offset, unsigned long size);
+extern void bt_iounmap(void *addr, unsigned long size);
+
+/*
  * IO bus memory addresses are also 1:1 with the physical address
  */
 #define virt_to_bus virt_to_phys