diff options
author | Yinghai Lu <yhlu.kernel.send@gmail.com> | 2008-03-24 19:02:01 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-04-17 11:41:20 -0400 |
commit | 35605a1027ac630f85a1b95684f7e86b82498cd6 (patch) | |
tree | c6cd011599b1c86bbbfb81a19f785520036ea844 /arch | |
parent | 52783fa8d6b847857fdd86df418e09c026d816f5 (diff) |
x86: enable PAT for amd k8 and fam10h
make known_pat_cpu to think amd k8 and fam10h is ok too.
also make tom2 below to be WRBACK
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/kernel/cpu/mtrr/generic.c | 17 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/mtrr/main.c | 2 | ||||
-rw-r--r-- | arch/x86/mm/pat.c | 6 |
3 files changed, 24 insertions, 1 deletions
diff --git a/arch/x86/kernel/cpu/mtrr/generic.c b/arch/x86/kernel/cpu/mtrr/generic.c index 011e07e99cd1..74ec2ea4ed3e 100644 --- a/arch/x86/kernel/cpu/mtrr/generic.c +++ b/arch/x86/kernel/cpu/mtrr/generic.c | |||
@@ -37,6 +37,7 @@ static struct fixed_range_block fixed_range_blocks[] = { | |||
37 | static unsigned long smp_changes_mask; | 37 | static unsigned long smp_changes_mask; |
38 | static struct mtrr_state mtrr_state = {}; | 38 | static struct mtrr_state mtrr_state = {}; |
39 | static int mtrr_state_set; | 39 | static int mtrr_state_set; |
40 | static u64 tom2; | ||
40 | 41 | ||
41 | #undef MODULE_PARAM_PREFIX | 42 | #undef MODULE_PARAM_PREFIX |
42 | #define MODULE_PARAM_PREFIX "mtrr." | 43 | #define MODULE_PARAM_PREFIX "mtrr." |
@@ -138,6 +139,11 @@ u8 mtrr_type_lookup(u64 start, u64 end) | |||
138 | } | 139 | } |
139 | } | 140 | } |
140 | 141 | ||
142 | if (tom2) { | ||
143 | if (start >= (1ULL<<32) && (end < tom2)) | ||
144 | return MTRR_TYPE_WRBACK; | ||
145 | } | ||
146 | |||
141 | if (prev_match != 0xFF) | 147 | if (prev_match != 0xFF) |
142 | return prev_match; | 148 | return prev_match; |
143 | 149 | ||
@@ -206,6 +212,15 @@ void __init get_mtrr_state(void) | |||
206 | mtrr_state.def_type = (lo & 0xff); | 212 | mtrr_state.def_type = (lo & 0xff); |
207 | mtrr_state.enabled = (lo & 0xc00) >> 10; | 213 | mtrr_state.enabled = (lo & 0xc00) >> 10; |
208 | 214 | ||
215 | if (amd_special_default_mtrr()) { | ||
216 | unsigned lo, hi; | ||
217 | /* TOP_MEM2 */ | ||
218 | rdmsr(MSR_K8_TOP_MEM2, lo, hi); | ||
219 | tom2 = hi; | ||
220 | tom2 <<= 32; | ||
221 | tom2 |= lo; | ||
222 | tom2 &= 0xffffff8000000ULL; | ||
223 | } | ||
209 | if (mtrr_show) { | 224 | if (mtrr_show) { |
210 | int high_width; | 225 | int high_width; |
211 | 226 | ||
@@ -236,6 +251,8 @@ void __init get_mtrr_state(void) | |||
236 | else | 251 | else |
237 | printk(KERN_INFO "MTRR %u disabled\n", i); | 252 | printk(KERN_INFO "MTRR %u disabled\n", i); |
238 | } | 253 | } |
254 | if (tom2) | ||
255 | printk(KERN_INFO "TOM2: %016lx aka %ldM\n", tom2, tom2>>20); | ||
239 | } | 256 | } |
240 | mtrr_state_set = 1; | 257 | mtrr_state_set = 1; |
241 | 258 | ||
diff --git a/arch/x86/kernel/cpu/mtrr/main.c b/arch/x86/kernel/cpu/mtrr/main.c index a6450b3ae759..6a1e278d9323 100644 --- a/arch/x86/kernel/cpu/mtrr/main.c +++ b/arch/x86/kernel/cpu/mtrr/main.c | |||
@@ -627,7 +627,7 @@ early_param("disable_mtrr_trim", disable_mtrr_trim_setup); | |||
627 | #define Tom2Enabled (1U << 21) | 627 | #define Tom2Enabled (1U << 21) |
628 | #define Tom2ForceMemTypeWB (1U << 22) | 628 | #define Tom2ForceMemTypeWB (1U << 22) |
629 | 629 | ||
630 | static __init int amd_special_default_mtrr(void) | 630 | int __init amd_special_default_mtrr(void) |
631 | { | 631 | { |
632 | u32 l, h; | 632 | u32 l, h; |
633 | 633 | ||
diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c index 57a2af36d6ee..0648a2225b09 100644 --- a/arch/x86/mm/pat.c +++ b/arch/x86/mm/pat.c | |||
@@ -47,6 +47,12 @@ static int pat_known_cpu(void) | |||
47 | return 1; | 47 | return 1; |
48 | } | 48 | } |
49 | } | 49 | } |
50 | if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD && | ||
51 | boot_cpu_data.x86 >= 0xf && boot_cpu_data.x86 <= 0x11) { | ||
52 | if (cpu_has_pat) { | ||
53 | return 1; | ||
54 | } | ||
55 | } | ||
50 | 56 | ||
51 | pat_wc_enabled = 0; | 57 | pat_wc_enabled = 0; |
52 | printk(KERN_INFO "CPU and/or kernel does not support PAT.\n"); | 58 | printk(KERN_INFO "CPU and/or kernel does not support PAT.\n"); |