kernel-ark/arch/i386/kernel
Bernhard Kaindl 2b1f6278d7 [PATCH] x86: Save the MTRRs of the BSP before booting an AP
Applied fix by Andew Morton:
http://lkml.org/lkml/2007/4/8/88 - Fix `make headers_check'.

AMD and Intel x86 CPU manuals state that it is the responsibility of
system software to initialize and maintain MTRR consistency across
all processors in Multi-Processing Environments.

Quote from page 188 of the AMD64 System Programming manual (Volume 2):

7.6.5 MTRRs in Multi-Processing Environments

"In multi-processing environments, the MTRRs located in all processors must
characterize memory in the same way. Generally, this means that identical
values are written to the MTRRs used by the processors." (short omission here)
"Failure to do so may result in coherency violations or loss of atomicity.
Processor implementations do not check the MTRR settings in other processors
to ensure consistency. It is the responsibility of system software to
initialize and maintain MTRR consistency across all processors."

Current Linux MTRR code already implements the above in the case that the
BIOS does not properly initialize MTRRs on the secondary processors,
but the case where the fixed-range MTRRs of the boot processor are changed
after Linux started to boot, before the initialsation of a secondary
processor, is not handled yet.

In this case, secondary processors are currently initialized by Linux
with MTRRs which the boot processor had very early, when mtrr_bp_init()
did run, but not with the MTRRs which the boot processor uses at the
time when that secondary processors is actually booted,
causing differing MTRR contents on the secondary processors.

Such situation happens on Acer Ferrari 1000 and 5000 notebooks where the
BIOS enables and sets AMD-specific IORR bits in the fixed-range MTRRs
of the boot processor when it transitions the system into ACPI mode.
The SMI handler of the BIOS does this in SMM, entered while Linux ACPI
code runs acpi_enable().

Other occasions where the SMI handler of the BIOS may change bits in
the MTRRs could occur as well. To initialize newly booted secodary
processors with the fixed-range MTRRs which the boot processor uses
at that time, this patch saves the fixed-range MTRRs of the boot
processor before new secondary processors are started. When the
secondary processors run their Linux initialisation code, their
fixed-range MTRRs will be updated with the saved fixed-range MTRRs.

If CONFIG_MTRR is not set, we define mtrr_save_state
as an empty statement because there is nothing to do.

Possible TODOs:

*) CPU-hotplugging outside of SMP suspend/resume is not yet tested
   with this patch.

*) If, even in this case, an AP never runs i386/do_boot_cpu or x86_64/cpu_up,
   then the calls to mtrr_save_state() could be replaced by calls to
   mtrr_save_fixed_ranges(NULL) and  mtrr_save_state() would not be
   needed.

   That would need either verification of the CPU-hotplug code or
   at least a test on a >2 CPU machine.

*) The MTRRs of other running processors are not yet checked at this
   time but it might be interesting to syncronize the MTTRs of all
   processors before booting. That would be an incremental patch,
   but of rather low priority since there is no machine known so
   far which would require this.

AK: moved prototypes on x86-64 around to fix warnings

Signed-off-by: Bernhard Kaindl <bk@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Andi Kleen <ak@suse.de>
Cc: Andi Kleen <ak@suse.de>
Cc: Dave Jones <davej@codemonkey.org.uk>
2007-05-02 19:27:17 +02:00
..
acpi [PATCH] x86: default to physical mode on hotplug CPU kernels 2007-05-02 19:27:04 +02:00
cpu [PATCH] x86: Save the MTRRs of the BSP before booting an AP 2007-05-02 19:27:17 +02:00
.gitignore
alternative.c [PATCH] x86: PARAVIRT: Jeremy Fitzhardinge <jeremy@goop.org> 2007-05-02 19:27:16 +02:00
apic.c [PATCH] x86-64: Disable local APIC timer use on AMD systems with C1E 2007-04-02 12:14:12 +02:00
apm.c [PATCH] i386: Add machine_ops interface to abstract halting and rebooting 2007-05-02 19:27:11 +02:00
asm-offsets.c [PATCH] i386: map enough initial memory to create lowmem mappings 2007-05-02 19:27:16 +02:00
bootflag.c
cpuid.c [PATCH] i386: use smp_call_function_single() 2007-02-13 13:26:23 +01:00
crash_dump.c
crash.c [PATCH] Kexec / Kdump: Unify elf note code 2006-12-07 08:39:46 -08:00
doublefault.c [PATCH] i386: i386 separate hardware-defined TSS from Linux additions 2007-05-02 19:27:13 +02:00
e820.c [PATCH] x86: fix amd64-agp aperture validation 2007-05-02 19:27:11 +02:00
early_printk.c
efi_stub.S
efi.c [PATCH] i386: cleanup GDT Access 2007-05-02 19:27:11 +02:00
entry.S [PATCH] i386: Convert VMI timer to use clock events 2007-05-02 19:27:16 +02:00
head.S [PATCH] i386: map enough initial memory to create lowmem mappings 2007-05-02 19:27:16 +02:00
hpet.c [PATCH] Add suspend/resume for HPET 2007-03-29 10:25:32 -07:00
i386_ksyms.c [PATCH] i386: Convert PDA into the percpu section 2007-05-02 19:27:16 +02:00
i387.c
i8237.c
i8253.c [PATCH] i386: clockevents fix breakage on Geode/Cyrix PIT implementations 2007-03-22 19:33:30 -07:00
i8259.c [PATCH] genirq: do not mask interrupts by default 2007-02-16 08:14:00 -08:00
init_task.c [PATCH] nsproxy: move init_nsproxy into kernel/nsproxy.c 2006-10-02 07:57:20 -07:00
io_apic.c [PATCH] x86: remove UNEXPECTED_IO_APIC() 2007-05-02 19:27:11 +02:00
ioport.c [PATCH] i386: i386 separate hardware-defined TSS from Linux additions 2007-05-02 19:27:13 +02:00
irq.c [PATCH] i386: Convert PDA into the percpu section 2007-05-02 19:27:16 +02:00
kprobes.c [PATCH] i386: Kprobe rpl fix 2007-02-13 13:26:21 +01:00
ldt.c [PATCH] i386: remove default_ldt, and simplify ldt-setting. 2006-12-07 02:14:01 +01:00
machine_kexec.c
Makefile [PATCH] i386: Convert VMI timer to use clock events 2007-05-02 19:27:16 +02:00
mca.c [PATCH] i386: replace kmalloc+memset with kzalloc 2006-12-07 02:14:19 +01:00
microcode.c [PATCH] Fix microcode-related suspend problem 2007-04-02 10:06:09 -07:00
module.c [PATCH] Generic BUG for i386 2006-12-08 08:28:39 -08:00
mpparse.c [PATCH] x86: default to physical mode on hotplug CPU kernels 2007-05-02 19:27:04 +02:00
msr.c [PATCH] i386: use smp_call_function_single() 2007-02-13 13:26:23 +01:00
nmi.c [PATCH] i386: Remove unneeded externs in nmi.c 2007-05-02 19:27:11 +02:00
numaq.c
paravirt.c [PATCH] i386: PARAVIRT: Export paravirt_ops for non GPL modules too 2007-05-02 19:27:17 +02:00
pci-dma.c [PATCH] fix memory leak in dma_declare_coherent_memory() 2007-03-01 14:53:39 -08:00
pcspeaker.c [PATCH] x86: Unify pcspeaker platform device code between i386/x86-64 2007-02-13 13:26:26 +01:00
process.c [PATCH] i386: Convert PDA into the percpu section 2007-05-02 19:27:16 +02:00
ptrace.c [PATCH] i386: Convert i386 PDA code to use %fs 2007-02-13 13:26:20 +01:00
quirks.c [PATCH] x86: revert x86_64-mm-fix-the-irqbalance-quirk-for-e7320-e7520-e7525 2007-05-02 19:27:04 +02:00
reboot_fixups.c [PATCH] i386: clean up mach_reboot_fixups 2007-05-02 19:27:06 +02:00
reboot.c [PATCH] i386: Add machine_ops interface to abstract halting and rebooting 2007-05-02 19:27:11 +02:00
relocate_kernel.S
scx200.c
setup.c [PATCH] clocksource init adjustments (fix bug #7426) 2007-03-05 07:57:53 -08:00
sigframe.h
signal.c [PATCH] x86: Don't require the vDSO for handling a.out signals 2007-02-13 13:26:26 +01:00
smp.c [PATCH] i386: PARAVIRT: add flush_tlb_others paravirt_op 2007-05-02 19:27:15 +02:00
smpboot.c [PATCH] x86: Save the MTRRs of the BSP before booting an AP 2007-05-02 19:27:17 +02:00
srat.c ACPI: build fix for IBM x440 - CONFIG_X86_SUMMIT 2007-02-02 21:47:33 -05:00
summit.c
sys_i386.c [PATCH] provide kernel_execve on all architectures 2006-10-02 07:57:23 -07:00
syscall_table.S [PATCH] epoll_pwait() 2006-10-11 11:14:21 -07:00
sysenter.c [PATCH] i386: In compat mode, the return value here was uninitialized. 2007-05-02 19:27:16 +02:00
time.c [PATCH] i386: pit_latch_buggy has no effect 2007-05-02 19:27:05 +02:00
topology.c Replace remaining references to "driverfs" with "sysfs". 2007-02-17 19:13:42 +01:00
trampoline.S [PATCH] i386: Rename boot_gdt_table to boot_gdt 2007-05-02 19:27:10 +02:00
traps.c [PATCH] i386: Page-align the GDT 2007-05-02 19:27:15 +02:00
tsc_sync.c [PATCH] x86: rewrite SMP TSC sync code 2007-02-16 08:13:57 -08:00
tsc.c [PATCH] x86: Log reason why TSC was marked unstable 2007-05-02 19:27:08 +02:00
vm86.c [PATCH] i386: Convert i386 PDA code to use %fs 2007-02-13 13:26:20 +01:00
vmi.c [PATCH] x86: PARAVIRT: Jeremy Fitzhardinge <jeremy@goop.org> 2007-05-02 19:27:16 +02:00
vmiclock.c [PATCH] i386: Convert VMI timer to use clock events 2007-05-02 19:27:16 +02:00
vmlinux.lds.S [PATCH] i386: Clean up ELF note generation 2007-05-02 19:27:17 +02:00
vsyscall-int80.S
vsyscall-note.S
vsyscall-sigreturn.S
vsyscall-sysenter.S
vsyscall.lds.S [PATCH] i386: VDSO_PRELINK warning fix 2007-05-02 19:27:09 +02:00
vsyscall.S