]>
Commit | Line | Data |
---|---|---|
9e8e5432 GKH |
1 | From 1bbbbe779aabe1f0768c2bf8f8c0a5583679b54a Mon Sep 17 00:00:00 2001 |
2 | From: Jacob Shin <jacob.shin@amd.com> | |
3 | Date: Thu, 20 Oct 2011 16:15:26 -0500 | |
4 | Subject: x86: Exclude E820_RESERVED regions and memory holes above 4 GB from direct mapping. | |
5 | ||
6 | From: Jacob Shin <jacob.shin@amd.com> | |
7 | ||
8 | commit 1bbbbe779aabe1f0768c2bf8f8c0a5583679b54a upstream. | |
9 | ||
10 | On systems with very large memory (1 TB in our case), BIOS may report a | |
11 | reserved region or a hole in the E820 map, even above the 4 GB range. Exclude | |
12 | these from the direct mapping. | |
13 | ||
14 | [ hpa: this should be done not just for > 4 GB but for everything above the legacy | |
15 | region (1 MB), at the very least. That, however, turns out to require significant | |
16 | restructuring. That work is well underway, but is not suitable for rc/stable. ] | |
17 | ||
18 | Signed-off-by: Jacob Shin <jacob.shin@amd.com> | |
19 | Link: http://lkml.kernel.org/r/1319145326-13902-1-git-send-email-jacob.shin@amd.com | |
20 | Signed-off-by: H. Peter Anvin <hpa@linux.intel.com> | |
21 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
22 | ||
23 | --- | |
24 | arch/x86/kernel/setup.c | 17 +++++++++++++++-- | |
25 | 1 file changed, 15 insertions(+), 2 deletions(-) | |
26 | ||
27 | --- a/arch/x86/kernel/setup.c | |
28 | +++ b/arch/x86/kernel/setup.c | |
29 | @@ -937,8 +937,21 @@ void __init setup_arch(char **cmdline_p) | |
30 | ||
31 | #ifdef CONFIG_X86_64 | |
32 | if (max_pfn > max_low_pfn) { | |
33 | - max_pfn_mapped = init_memory_mapping(1UL<<32, | |
34 | - max_pfn<<PAGE_SHIFT); | |
35 | + int i; | |
36 | + for (i = 0; i < e820.nr_map; i++) { | |
37 | + struct e820entry *ei = &e820.map[i]; | |
38 | + | |
39 | + if (ei->addr + ei->size <= 1UL << 32) | |
40 | + continue; | |
41 | + | |
42 | + if (ei->type == E820_RESERVED) | |
43 | + continue; | |
44 | + | |
45 | + max_pfn_mapped = init_memory_mapping( | |
46 | + ei->addr < 1UL << 32 ? 1UL << 32 : ei->addr, | |
47 | + ei->addr + ei->size); | |
48 | + } | |
49 | + | |
50 | /* can we preseve max_low_pfn ?*/ | |
51 | max_low_pfn = max_pfn; | |
52 | } |