提交 1f2c958a 编写于 作者: A Andi Kleen 提交者: Linus Torvalds

[PATCH] x86_64: Always use CPUID 80000008 to figure out MTRR address space size

It doesn't make sense to only do this only for AMD K8.

This would support future CPUs with extended address spaces properly.

For i386 and x86-64

Cc: <davej@redhat.com>
Signed-off-by: NAndi Kleen <ak@suse.de>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 f0de53bb
...@@ -614,40 +614,21 @@ static int __init mtrr_init(void) ...@@ -614,40 +614,21 @@ static int __init mtrr_init(void)
mtrr_if = &generic_mtrr_ops; mtrr_if = &generic_mtrr_ops;
size_or_mask = 0xff000000; /* 36 bits */ size_or_mask = 0xff000000; /* 36 bits */
size_and_mask = 0x00f00000; size_and_mask = 0x00f00000;
switch (boot_cpu_data.x86_vendor) { /* This is an AMD specific MSR, but we assume(hope?) that
case X86_VENDOR_AMD: Intel will implement it to when they extend the address
/* The original Athlon docs said that bus of the Xeon. */
total addressable memory is 44 bits wide. if (cpuid_eax(0x80000000) >= 0x80000008) {
It was not really clear whether its MTRRs u32 phys_addr;
follow this or not. (Read: 44 or 36 bits). phys_addr = cpuid_eax(0x80000008) & 0xff;
However, "x86-64_overview.pdf" explicitly size_or_mask = ~((1 << (phys_addr - PAGE_SHIFT)) - 1);
states that "previous implementations support size_and_mask = ~size_or_mask & 0xfff00000;
36 bit MTRRs" and also provides a way to } else if (boot_cpu_data.x86_vendor == X86_VENDOR_CENTAUR &&
query the width (in bits) of the physical boot_cpu_data.x86 == 6) {
addressable memory on the Hammer family. /* VIA C* family have Intel style MTRRs, but
*/ don't support PAE */
if (boot_cpu_data.x86 == 15 size_or_mask = 0xfff00000; /* 32 bits */
&& (cpuid_eax(0x80000000) >= 0x80000008)) { size_and_mask = 0;
u32 phys_addr;
phys_addr = cpuid_eax(0x80000008) & 0xff;
size_or_mask =
~((1 << (phys_addr - PAGE_SHIFT)) - 1);
size_and_mask = ~size_or_mask & 0xfff00000;
}
/* Athlon MTRRs use an Intel-compatible interface for
* getting and setting */
break;
case X86_VENDOR_CENTAUR:
if (boot_cpu_data.x86 == 6) {
/* VIA Cyrix family have Intel style MTRRs, but don't support PAE */
size_or_mask = 0xfff00000; /* 32 bits */
size_and_mask = 0;
}
break;
default:
break;
} }
} else { } else {
switch (boot_cpu_data.x86_vendor) { switch (boot_cpu_data.x86_vendor) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册