[patch] tip/x86_64: fix e820 merge issue which broke max_pfn_mapped

From: Suresh Siddha
Date: Tue Jul 08 2008 - 19:08:49 EST


With out this 64bit tip/master doesn't boot using ACPI on my system.
---

max_pfn_mapped should include all e820 entries.
The direct mapping extends to max_pfn_mapped, so that we can directly access
apertures, ACPI and other tables without having to play with fixmaps.

With this, my system with 1GB memory boots fine with ACPI enabled.

Signed-off-by: Suresh Siddha <suresh.b.siddha@xxxxxxxxx>
---

Index: tree-x86/arch/x86/kernel/e820.c
===================================================================
--- tree-x86.orig/arch/x86/kernel/e820.c 2008-07-08 15:31:24.000000000 -0700
+++ tree-x86/arch/x86/kernel/e820.c 2008-07-08 15:55:09.000000000 -0700
@@ -1040,6 +1040,10 @@

if (last_pfn > max_arch_pfn)
last_pfn = max_arch_pfn;
+#ifdef CONFIG_X86_64
+ if (last_pfn > max_pfn_mapped)
+ max_pfn_mapped = last_pfn;
+#endif
if (last_pfn > end_user_pfn)
last_pfn = end_user_pfn;

@@ -1067,6 +1071,12 @@
if (*ei_startpfn >= *ei_endpfn)
return 0;

+#ifdef CONFIG_X86_64
+ /* Check if max_pfn_mapped should be updated */
+ if (ei->type != E820_RAM && *ei_endpfn > max_pfn_mapped)
+ max_pfn_mapped = *ei_endpfn;
+#endif
+
/* Skip if map is outside the node */
if (ei->type != E820_RAM || *ei_endpfn <= start_pfn ||
*ei_startpfn >= last_pfn)
Index: tree-x86/arch/x86/kernel/setup.c
===================================================================
--- tree-x86.orig/arch/x86/kernel/setup.c 2008-07-08 15:33:42.000000000 -0700
+++ tree-x86/arch/x86/kernel/setup.c 2008-07-08 15:33:49.000000000 -0700
@@ -722,8 +722,12 @@
high_memory = (void *)__va(max_pfn * PAGE_SIZE - 1) + 1;
#endif

+#ifdef CONFIG_X86_32
/* max_pfn_mapped is updated here */
max_pfn_mapped = init_memory_mapping(0, (max_low_pfn << PAGE_SHIFT));
+#else
+ max_pfn_mapped = init_memory_mapping(0, (max_pfn_mapped << PAGE_SHIFT));
+#endif

/*
* NOTE: On x86-32, only from this point on, fixmaps are ready for use.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/