aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/kernel/cpu/mtrr/generic.c17
-rw-r--r--arch/x86/kernel/cpu/mtrr/main.c2
-rw-r--r--arch/x86/mm/pat.c6
-rw-r--r--include/asm-x86/mtrr.h1
4 files changed, 25 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[] = {
37static unsigned long smp_changes_mask; 37static unsigned long smp_changes_mask;
38static struct mtrr_state mtrr_state = {}; 38static struct mtrr_state mtrr_state = {};
39static int mtrr_state_set; 39static int mtrr_state_set;
40static 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
630static __init int amd_special_default_mtrr(void) 630int __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");
diff --git a/include/asm-x86/mtrr.h b/include/asm-x86/mtrr.h
index ee172296e056..d3d26625aeaf 100644
--- a/include/asm-x86/mtrr.h
+++ b/include/asm-x86/mtrr.h
@@ -99,6 +99,7 @@ extern void mtrr_centaur_report_mcr(int mcr, u32 lo, u32 hi);
99extern void mtrr_ap_init(void); 99extern void mtrr_ap_init(void);
100extern void mtrr_bp_init(void); 100extern void mtrr_bp_init(void);
101extern int mtrr_trim_uncached_memory(unsigned long end_pfn); 101extern int mtrr_trim_uncached_memory(unsigned long end_pfn);
102extern int amd_special_default_mtrr(void);
102# else 103# else
103static inline u8 mtrr_type_lookup(u64 addr, u64 end) 104static inline u8 mtrr_type_lookup(u64 addr, u64 end)
104{ 105{