public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] x86: Exclude E820_RESERVED regions and memory holes above 4 GB from direct mapping.
@ 2011-10-20 21:15 Jacob Shin
  2011-10-20 21:28 ` Andi Kleen
                   ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Jacob Shin @ 2011-10-20 21:15 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, H. Peter Anvin
  Cc: Yinghai Lu, Andreas Herrmann, x86, linux-kernel, Jacob Shin

On systems with very large memory (1 TB in our case), BIOS may report a
reserved region or a hole in the E820 map, even above the 4 GB range. Exclude
these from the direct mapping.

Cc: stable@kernel.org   # > 2.6.32
Signed-off-by: Jacob Shin <jacob.shin@amd.com>
---
 arch/x86/kernel/setup.c |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index afaf384..af19a61 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -937,8 +937,21 @@ void __init setup_arch(char **cmdline_p)
 
 #ifdef CONFIG_X86_64
 	if (max_pfn > max_low_pfn) {
-		max_pfn_mapped = init_memory_mapping(1UL<<32,
-						     max_pfn<<PAGE_SHIFT);
+		int i;
+		for (i = 0; i < e820.nr_map; i++) {
+			struct e820entry *ei = &e820.map[i];
+
+			if (ei->addr + ei->size <= 1UL << 32)
+				continue;
+
+			if (ei->type == E820_RESERVED)
+				continue;
+
+			max_pfn_mapped = init_memory_mapping(
+				ei->addr < 1UL << 32 ? 1UL << 32 : ei->addr,
+				ei->addr + ei->size);
+		}
+
 		/* can we preseve max_low_pfn ?*/
 		max_low_pfn = max_pfn;
 	}
-- 
1.7.1



^ permalink raw reply related	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2012-10-17 19:17 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-20 21:15 [PATCH 1/1] x86: Exclude E820_RESERVED regions and memory holes above 4 GB from direct mapping Jacob Shin
2011-10-20 21:28 ` Andi Kleen
2011-10-20 21:30   ` H. Peter Anvin
2011-10-20 21:32     ` H. Peter Anvin
2011-10-20 22:10     ` Jacob Shin
2011-10-20 22:43       ` H. Peter Anvin
2011-10-20 22:20 ` H. Peter Anvin
2011-10-20 22:26   ` Jacob Shin
2011-12-14 22:42     ` H. Peter Anvin
2011-12-14 23:14       ` Jacob Shin
2011-12-16 16:20         ` Jacob Shin
2011-12-16 17:42           ` Yinghai Lu
2011-12-16 17:54             ` H. Peter Anvin
2011-12-16 18:29               ` Yinghai Lu
2011-12-16 18:32                 ` H. Peter Anvin
2011-12-16 20:59                   ` Yinghai Lu
2011-12-17  0:57                     ` H. Peter Anvin
2012-10-17 19:17 ` [tip:x86/urgent] " tip-bot for Jacob Shin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox