瀏覽代碼

x86: mtrr_cleanup: treat WRPROT as UNCACHEABLE

For the purpose of MTRR canonicalization, treat WRPROT as UNCACHEABLE.

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Yinghai Lu 16 年之前
父節點
當前提交
dd5523552c
共有 1 個文件被更改,包括 4 次插入1 次删除
  1. 4 1
      arch/x86/kernel/cpu/mtrr/main.c

+ 4 - 1
arch/x86/kernel/cpu/mtrr/main.c

@@ -759,7 +759,8 @@ x86_get_mtrr_mem_range(struct res_range *range, int nr_range,
 	/* take out UC ranges */
 	/* take out UC ranges */
 	for (i = 0; i < num_var_ranges; i++) {
 	for (i = 0; i < num_var_ranges; i++) {
 		type = range_state[i].type;
 		type = range_state[i].type;
-		if (type != MTRR_TYPE_UNCACHABLE)
+		if (type != MTRR_TYPE_UNCACHABLE &&
+		    type != MTRR_TYPE_WRPROT)
 			continue;
 			continue;
 		size = range_state[i].size_pfn;
 		size = range_state[i].size_pfn;
 		if (!size)
 		if (!size)
@@ -1248,6 +1249,8 @@ static int __init mtrr_cleanup(unsigned address_bits)
 			continue;
 			continue;
 		if (!size)
 		if (!size)
 			type = MTRR_NUM_TYPES;
 			type = MTRR_NUM_TYPES;
+		if (type == MTRR_TYPE_WRPROT)
+			type = MTRR_TYPE_UNCACHABLE;
 		num[type]++;
 		num[type]++;
 	}
 	}