Commit 0371d3f7 authored by Russell King's avatar Russell King

ARM: move memory layout sanity checking before meminfo initialization

Ensure that the meminfo array is sanity checked before we pass the
memory to memblock.  This helps to ensure that memblock and meminfo
agree on the dimensions of memory, especially when more memory is
passed than the kernel can deal with.
Acked-by: default avatarNicolas Pitre <nicolas.pitre@linaro.org>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 6f96521f
...@@ -73,6 +73,7 @@ __setup("fpe=", fpe_setup); ...@@ -73,6 +73,7 @@ __setup("fpe=", fpe_setup);
#endif #endif
extern void paging_init(struct machine_desc *desc); extern void paging_init(struct machine_desc *desc);
extern void sanity_check_meminfo(void);
extern void reboot_setup(char *str); extern void reboot_setup(char *str);
unsigned int processor_id; unsigned int processor_id;
...@@ -900,6 +901,7 @@ void __init setup_arch(char **cmdline_p) ...@@ -900,6 +901,7 @@ void __init setup_arch(char **cmdline_p)
parse_early_param(); parse_early_param();
sanity_check_meminfo();
arm_memblock_init(&meminfo, mdesc); arm_memblock_init(&meminfo, mdesc);
paging_init(mdesc); paging_init(mdesc);
......
...@@ -759,7 +759,7 @@ early_param("vmalloc", early_vmalloc); ...@@ -759,7 +759,7 @@ early_param("vmalloc", early_vmalloc);
static phys_addr_t lowmem_limit __initdata = 0; static phys_addr_t lowmem_limit __initdata = 0;
static void __init sanity_check_meminfo(void) void __init sanity_check_meminfo(void)
{ {
int i, j, highmem = 0; int i, j, highmem = 0;
...@@ -1032,8 +1032,9 @@ void __init paging_init(struct machine_desc *mdesc) ...@@ -1032,8 +1032,9 @@ void __init paging_init(struct machine_desc *mdesc)
{ {
void *zero_page; void *zero_page;
memblock_set_current_limit(lowmem_limit);
build_mem_type_table(); build_mem_type_table();
sanity_check_meminfo();
prepare_page_table(); prepare_page_table();
map_lowmem(); map_lowmem();
devicemaps_init(mdesc); devicemaps_init(mdesc);
......
...@@ -27,6 +27,10 @@ void __init arm_mm_memblock_reserve(void) ...@@ -27,6 +27,10 @@ void __init arm_mm_memblock_reserve(void)
memblock_reserve(CONFIG_VECTORS_BASE, PAGE_SIZE); memblock_reserve(CONFIG_VECTORS_BASE, PAGE_SIZE);
} }
void __init sanity_check_meminfo(void)
{
}
/* /*
* paging_init() sets up the page tables, initialises the zone memory * paging_init() sets up the page tables, initialises the zone memory
* maps, and sets up the zero page, bad page and bad page tables. * maps, and sets up the zero page, bad page and bad page tables.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment