aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/mm/pat.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c
index a6507bfb12a7..c996a3641200 100644
--- a/arch/x86/mm/pat.c
+++ b/arch/x86/mm/pat.c
@@ -200,7 +200,8 @@ int reserve_memtype(u64 start, u64 end, unsigned long req_type,
200 unsigned long actual_type; 200 unsigned long actual_type;
201 int err = 0; 201 int err = 0;
202 202
203 /* Only track when pat_enabled */ 203 BUG_ON(start >= end); /* end is exclusive */
204
204 if (!pat_enabled) { 205 if (!pat_enabled) {
205 /* This is identical to page table setting without PAT */ 206 /* This is identical to page table setting without PAT */
206 if (new_type) { 207 if (new_type) {
@@ -228,17 +229,13 @@ int reserve_memtype(u64 start, u64 end, unsigned long req_type,
228 */ 229 */
229 u8 mtrr_type = mtrr_type_lookup(start, end); 230 u8 mtrr_type = mtrr_type_lookup(start, end);
230 231
231 if (mtrr_type == MTRR_TYPE_WRBACK) { 232 if (mtrr_type == MTRR_TYPE_WRBACK)
232 req_type = _PAGE_CACHE_WB;
233 actual_type = _PAGE_CACHE_WB; 233 actual_type = _PAGE_CACHE_WB;
234 } else { 234 else
235 req_type = _PAGE_CACHE_UC_MINUS;
236 actual_type = _PAGE_CACHE_UC_MINUS; 235 actual_type = _PAGE_CACHE_UC_MINUS;
237 } 236 } else
238 } else { 237 actual_type = pat_x_mtrr_type(start, end,
239 req_type &= _PAGE_CACHE_MASK; 238 req_type & _PAGE_CACHE_MASK);
240 actual_type = pat_x_mtrr_type(start, end, req_type);
241 }
242 239
243 new = kmalloc(sizeof(struct memtype), GFP_KERNEL); 240 new = kmalloc(sizeof(struct memtype), GFP_KERNEL);
244 if (!new) 241 if (!new)
@@ -406,10 +403,8 @@ int free_memtype(u64 start, u64 end)
406 struct memtype *entry; 403 struct memtype *entry;
407 int err = -EINVAL; 404 int err = -EINVAL;
408 405
409 /* Only track when pat_enabled */ 406 if (!pat_enabled)
410 if (!pat_enabled) {
411 return 0; 407 return 0;
412 }
413 408
414 /* Low ISA region is always mapped WB. No need to track */ 409 /* Low ISA region is always mapped WB. No need to track */
415 if (is_ISA_range(start, end - 1)) 410 if (is_ISA_range(start, end - 1))