Skip to content

Commit 99e1aa1

Browse files
yhluH. Peter Anvin
authored andcommitted
x86: mtrr_cleanup: first 1M may be covered in var mtrrs
The first 1M is don't care when it comes to the variables MTRRs. Cover it as WB as a heuristic approximation; this is generally what we want to minimize the number of registers. Signed-off-by: Yinghai Lu <[email protected]> Signed-off-by: H. Peter Anvin <[email protected]>
1 parent 42fde7a commit 99e1aa1

File tree

1 file changed

+9
-0
lines changed
  • arch/x86/kernel/cpu/mtrr

1 file changed

+9
-0
lines changed

arch/x86/kernel/cpu/mtrr/main.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1293,6 +1293,15 @@ static int __init mtrr_cleanup(unsigned address_bits)
12931293
}
12941294
nr_range = x86_get_mtrr_mem_range(range, 0, extra_remove_base,
12951295
extra_remove_size);
1296+
/*
1297+
* [0, 1M) should always be coverred by var mtrr with WB
1298+
* and fixed mtrrs should take effective before var mtrr for it
1299+
*/
1300+
nr_range = add_range_with_merge(range, nr_range, 0,
1301+
(1ULL<<(20 - PAGE_SHIFT)) - 1);
1302+
/* sort the ranges */
1303+
sort(range, nr_range, sizeof(struct res_range), cmp_range, NULL);
1304+
12961305
range_sums = sum_ranges(range, nr_range);
12971306
printk(KERN_INFO "total RAM coverred: %ldM\n",
12981307
range_sums >> (20 - PAGE_SHIFT));

0 commit comments

Comments
 (0)