APICBASE fix backport from 2.6
PATCH 1/1 APICBASE fix backport from 2.6
If the BIOS boots us with the local APIC enabled but at a non-standard address, and we're not parsing any MP/ACPI tables, then we will (a) map the wrong address, and (b) write the wrong address to APICBASE at resume from suspend.
Apparently some HP machines are affected by this bug.
This is a backport of the fix Linus put in 2.6.0-test7-bk8.
/Mikael
arch/i386/kernel/apic.c +15 -1
@@ -502,10 +502,18 @@__save_flags (flags);__cli (); + +/* +* Make sure the APICBASE points to the right address +* +* FIXME! This will be wrong if we ever support suspend on +* SMP! We'll need to do this as part of the CPU restore! +*/ rdmsr (MSR_IA32_APICBASE , l, h); l &= ~MSR_IA32_APICBASE_BASE ; - l |=MSR_IA32_APICBASE_ENABLE |APIC_DEFAULT_PHYS_BASE ; + l |=MSR_IA32_APICBASE_ENABLE | mp_lapic_addr;wrmsr (MSR_IA32_APICBASE , l, h); +apic_write (APIC_LVTERR ,ERROR_APIC_VECTOR |APIC_LVT_MASKED );apic_write (APIC_ID , apic_pm_state.apic_id);apic_write (APIC_DFR , apic_pm_state.apic_dfr);
@@ -674,6 +682,12 @@ }set_bit (X86_FEATURE_APIC , &boot_cpu_data.x86_capability); mp_lapic_addr =APIC_DEFAULT_PHYS_BASE ; + +/* The BIOS may have set up the APIC at some other address */ +rdmsr (MSR_IA32_APICBASE , l, h); +if (l &MSR_IA32_APICBASE_ENABLE ) + mp_lapic_addr = l &MSR_IA32_APICBASE_BASE ; +if (nmi_watchdog !=NMI_NONE ) nmi_watchdog =NMI_LOCAL_APIC ;