x86: introduce init_memory_mapping for 32bit #1
... so can we use mem below max_low_pfn earlier.
this allows us to move several functions more early instead of waiting
to after paging_init.
That includes moving relocate_initrd() earlier in the bootup, and kva
related early setup done in initmem_init. (in followup patches)
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
diff --git a/arch/x86/kernel/setup_32.c b/arch/x86/kernel/setup_32.c
index bba8d57..03007ca 100644
--- a/arch/x86/kernel/setup_32.c
+++ b/arch/x86/kernel/setup_32.c
@@ -226,10 +226,8 @@
}
/* We need to move the initrd down into lowmem */
- ramdisk_target = max_pfn_mapped<<PAGE_SHIFT;
- ramdisk_here = find_e820_area(min(ramdisk_target, end_of_lowmem>>1),
- end_of_lowmem, ramdisk_size,
- PAGE_SIZE);
+ ramdisk_here = find_e820_area(0, end_of_lowmem, ramdisk_size,
+ PAGE_SIZE);
if (ramdisk_here == -1ULL)
panic("Cannot find place for new RAMDISK of size %lld\n",
@@ -433,8 +431,12 @@
max_pfn = e820_end_of_ram();
}
+ /* max_low_pfn get updated here */
find_low_pfn_range();
+ /* max_pfn_mapped is updated here */
+ init_memory_mapping(0, (max_low_pfn << PAGE_SHIFT));
+
reserve_initrd();
dmi_scan_machine();