freebsd-dev/sys/i386/include
John Baldwin 391664b110 The variable MTRR registers actually have variable-sized PhysBase and
PhysMask fields based on the number of physical address bits supported
by the current CPU.  The old code assumed 36 bits on i386 and 40 bits on
amd64.  In truth, all Intel CPUs up until recently used 36 bits (a newer
Intel CPU uses 38 bits) and all the Opteron CPUs used 40 bits.

In at least one case (the new Intel CPU) having the size of the mask field
wrong resulted in writing questionable values into the MTRR registers on
the application processors (BSP as well if you modify the MTRRs via
memcontrol or running X, etc.).  The result of the questionable physmask
was that all of memory was apparently treated as uncached rather than
write-back resulting in a very significant performance hit.

Fix this by constructing a run-time mask for the PhysBase and PhysMask
fields based on the number of physical address bits supported by the CPU.
All 64-bit capable CPUs provide a count of PA bits supported via the
0x80000008 extended CPUID feature, so use that if it is available.  If that
feature is not available, then assume 36 PA bits.

While I'm here, expand the (now-unused) macros for the PhysBase and
PhysMask fields to the current largest possible value (52 PA bits).

MFC after:	1 week
PR:		i386/120516
Reported by:	Nokia
2008-03-12 22:09:19 +00:00
..
pc - Add constants for the different memory types in the SMAP table. 2007-10-28 21:23:49 +00:00
_bus.h
_inttypes.h
_limits.h
_stdint.h
_types.h Change float_t and double_t to long double on i386. All floating point 2008-03-05 11:21:14 +00:00
acpica_machdep.h Catch up with ACPI-CA 20070320 import. 2007-03-22 18:16:43 +00:00
apicreg.h
apicvar.h Handle CPUs with APIC IDs higher than 32 (at least one IBM server uses 2007-05-08 22:01:04 +00:00
apm_bios.h
apm_segments.h
asm.h Define an END() macro for use in i386 and amd64 assembly code, akin 2007-08-22 04:26:07 +00:00
asmacros.h Define an END() macro for use in i386 and amd64 assembly code, akin 2007-08-22 04:26:07 +00:00
atomic.h Fix oops in previous commit. 2006-12-29 15:48:18 +00:00
bootinfo.h Slightly cleanup the 'bootdev' concept on x86 by changing the various 2007-10-24 04:03:25 +00:00
bus_dma.h
bus.h
clock.h Split /dev/nvram driver out of isa/clock.c for i386 and amd64. I have not 2007-10-26 03:23:54 +00:00
cpu.h Clean out sysctl machdep.* related defines. 2006-05-11 17:29:25 +00:00
cpufunc.h Add "show sysregs" command to ddb. On i386, this gives gdt, idt, ldt, 2007-08-09 20:14:35 +00:00
cputypes.h
cserial.h Prepare for sconfig(8) update. 2006-01-30 13:34:57 +00:00
db_machdep.h
elan_mmcr.h
elf.h PR: 2006-10-04 21:37:10 +00:00
endian.h
exec.h
float.h Oops, back out previous commit since it was to the wrong file. 2008-03-05 11:17:20 +00:00
floatingpoint.h
frame.h Tweak how the MD code calls the fooclock() methods some. Instead of 2005-12-22 22:16:09 +00:00
gdb_machdep.h
ieeefp.h MFamd64 (everything possible up to 1.19; mainly the amd64 implementations 2008-01-11 18:59:35 +00:00
if_wl_wavelan.h
in_cksum.h Fold multiple asm statements into one so that the compiler at a certain 2007-10-20 22:18:42 +00:00
intr_machdep.h Minor fixes and tweaks to the x86 interrupt code: 2007-05-08 21:29:14 +00:00
ioctl_bt848.h
ioctl_meteor.h
iodev.h
kdb.h Add kdb_cpu_sync_icache(), intended to synchronize instruction 2007-06-09 21:55:17 +00:00
legacyvar.h Make the PCI code aware of PCI domains (aka PCI segments) so we can 2007-09-30 11:05:18 +00:00
limits.h
md_var.h Initialise (if necessary) the VIA C3/C7 features. 2006-07-12 19:46:08 +00:00
memdev.h
metadata.h
minidump.h Merge minidumps from amd64 where they were originally developed. 2006-04-21 04:28:43 +00:00
mp_watchdog.h
mptable.h guard function decls with _KERNEL so user code can include this file 2006-02-22 21:38:33 +00:00
mutex.h Move clock_lock prototype into <machine/clock.h>, where it is more 2006-05-19 18:53:50 +00:00
npx.h Use the method described in IA-32 Intel Architecture Software Developer's 2006-05-30 23:44:21 +00:00
param.h By popular demand, move __HAVE_ACPI and __PCI_REROUTE_INTERRUPT into 2006-01-09 06:05:57 +00:00
pcaudioio.h
pcb_ext.h
pcb.h Remove pcb_switchout, it has not been used for a long time. 2005-12-29 13:23:48 +00:00
pci_cfgreg.h
pcpu.h Rework the PCPU_* (MD) interface: 2007-06-04 21:38:48 +00:00
pecoff_machdep.h
perfmon.h
pmap.h Update the KVA_PAGES comments for the effect that PAE has on it. It 2008-01-14 22:53:01 +00:00
pmc_mdep.h Kernel and hwpmc(4) support for callchain capture. 2007-12-07 08:20:17 +00:00
ppireg.h
privatespace.h Test commit after repoman upgrade. Remove one of my many email addresses 2006-05-12 22:38:53 +00:00
proc.h Move GET_STACK_USAGE from MI header to i386/amd64 MD ones. 2008-01-31 08:24:27 +00:00
profile.h i386/include/profile.h: 2006-10-28 11:03:03 +00:00
psl.h
ptrace.h
reg.h - Add macro constants for the various fields in %dr7 and use them in place 2006-11-17 19:20:32 +00:00
reloc.h
resource.h
runq.h
segments.h
setjmp.h Remove 3rd clause, renumber, ok per email 2007-01-12 07:26:21 +00:00
sf_buf.h
sigframe.h
signal.h
smapi.h
smp.h - Remove the old smp cpu topology specification with a new, more flexible 2008-03-02 07:58:42 +00:00
speaker.h
specialreg.h The variable MTRR registers actually have variable-sized PhysBase and 2008-03-12 22:09:19 +00:00
stack.h Break out stack(9) from ddb(4): 2007-12-02 20:40:35 +00:00
stdarg.h Use __builtin_va_start instead of __builtin_stdarg_start. GCC4 obsoletes 2006-09-21 01:37:02 +00:00
sysarch.h
timerreg.h
trap.h
tss.h
ucontext.h
varargs.h
vm86.h
vmparam.h Add configuration knobs for the superpage reservation system. Initially, 2007-12-27 16:45:39 +00:00
xbox.h Committed the xbox syscons(8)-able console driver. 2006-03-03 14:52:57 +00:00