提交 69e26be9 编写于 作者: A Andreas Herrmann 提交者: Ingo Molnar

x86: pat.c more trivial changes

 - add BUG statement to catch invalid start and end parameters
 - No need to track the actual type in both req_type and actual_type --
   keep req_type unchanged.
 - removed (IMHO) superfluous comments
Signed-off-by: NAndreas Herrmann <andreas.herrmann3@amd.com>
Cc: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Cc: Suresh B Siddha <suresh.b.siddha@intel.com>
Signed-off-by: NIngo Molnar <mingo@elte.hu>
上级 ac97991e
...@@ -200,7 +200,8 @@ int reserve_memtype(u64 start, u64 end, unsigned long req_type, ...@@ -200,7 +200,8 @@ int reserve_memtype(u64 start, u64 end, unsigned long req_type,
unsigned long actual_type; unsigned long actual_type;
int err = 0; int err = 0;
/* Only track when pat_enabled */ BUG_ON(start >= end); /* end is exclusive */
if (!pat_enabled) { if (!pat_enabled) {
/* This is identical to page table setting without PAT */ /* This is identical to page table setting without PAT */
if (new_type) { if (new_type) {
...@@ -228,17 +229,13 @@ int reserve_memtype(u64 start, u64 end, unsigned long req_type, ...@@ -228,17 +229,13 @@ int reserve_memtype(u64 start, u64 end, unsigned long req_type,
*/ */
u8 mtrr_type = mtrr_type_lookup(start, end); u8 mtrr_type = mtrr_type_lookup(start, end);
if (mtrr_type == MTRR_TYPE_WRBACK) { if (mtrr_type == MTRR_TYPE_WRBACK)
req_type = _PAGE_CACHE_WB;
actual_type = _PAGE_CACHE_WB; actual_type = _PAGE_CACHE_WB;
} else { else
req_type = _PAGE_CACHE_UC_MINUS;
actual_type = _PAGE_CACHE_UC_MINUS; actual_type = _PAGE_CACHE_UC_MINUS;
} } else
} else { actual_type = pat_x_mtrr_type(start, end,
req_type &= _PAGE_CACHE_MASK; req_type & _PAGE_CACHE_MASK);
actual_type = pat_x_mtrr_type(start, end, req_type);
}
new = kmalloc(sizeof(struct memtype), GFP_KERNEL); new = kmalloc(sizeof(struct memtype), GFP_KERNEL);
if (!new) if (!new)
...@@ -406,10 +403,8 @@ int free_memtype(u64 start, u64 end) ...@@ -406,10 +403,8 @@ int free_memtype(u64 start, u64 end)
struct memtype *entry; struct memtype *entry;
int err = -EINVAL; int err = -EINVAL;
/* Only track when pat_enabled */ if (!pat_enabled)
if (!pat_enabled) {
return 0; return 0;
}
/* Low ISA region is always mapped WB. No need to track */ /* Low ISA region is always mapped WB. No need to track */
if (is_ISA_range(start, end - 1)) if (is_ISA_range(start, end - 1))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册