linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM: move memory layout sanity checking before meminfo initialization
@ 2011-07-05 18:57 Russell King - ARM Linux
  2011-07-05 19:20 ` Nicolas Pitre
  2011-07-14  6:52 ` Colin Cross
  0 siblings, 2 replies; 17+ messages in thread
From: Russell King - ARM Linux @ 2011-07-05 18:57 UTC (permalink / raw)
  To: linux-arm-kernel

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.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
 arch/arm/kernel/setup.c |    2 ++
 arch/arm/mm/mmu.c       |    5 +++--
 arch/arm/mm/nommu.c     |    4 ++++
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index edcab02..9c3278f 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -73,6 +73,7 @@ __setup("fpe=", fpe_setup);
 #endif
 
 extern void paging_init(struct machine_desc *desc);
+extern void sanity_check_meminfo(void);
 extern void reboot_setup(char *str);
 
 unsigned int processor_id;
@@ -902,6 +903,7 @@ void __init setup_arch(char **cmdline_p)
 
 	parse_early_param();
 
+	sanity_check_meminfo();
 	arm_memblock_init(&meminfo, mdesc);
 
 	paging_init(mdesc);
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index c3337de..027f118 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -781,7 +781,7 @@ early_param("vmalloc", early_vmalloc);
 
 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;
 
@@ -1056,8 +1056,9 @@ void __init paging_init(struct machine_desc *mdesc)
 {
 	void *zero_page;
 
+	memblock_set_current_limit(lowmem_limit);
+
 	build_mem_type_table();
-	sanity_check_meminfo();
 	prepare_page_table();
 	map_lowmem();
 	devicemaps_init(mdesc);
diff --git a/arch/arm/mm/nommu.c b/arch/arm/mm/nommu.c
index 687d023..941a98c 100644
--- a/arch/arm/mm/nommu.c
+++ b/arch/arm/mm/nommu.c
@@ -27,6 +27,10 @@ void __init arm_mm_memblock_reserve(void)
 	memblock_reserve(CONFIG_VECTORS_BASE, PAGE_SIZE);
 }
 
+void __init sanity_check_meminfo(void)
+{
+}
+
 /*
  * paging_init() sets up the page tables, initialises the zone memory
  * maps, and sets up the zero page, bad page and bad page tables.

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

end of thread, other threads:[~2011-07-16 22:41 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-05 18:57 [PATCH] ARM: move memory layout sanity checking before meminfo initialization Russell King - ARM Linux
2011-07-05 19:20 ` Nicolas Pitre
2011-07-14  6:52 ` Colin Cross
2011-07-14  7:34   ` Russell King - ARM Linux
2011-07-14  7:58     ` Colin Cross
2011-07-14 22:10       ` Colin Cross
2011-07-15  8:09         ` Russell King - ARM Linux
2011-07-15 16:06           ` Colin Cross
2011-07-15 16:16             ` Russell King - ARM Linux
2011-07-15 17:35               ` Colin Cross
2011-07-15 18:13                 ` Russell King - ARM Linux
2011-07-15 20:58                   ` Colin Cross
2011-07-15 21:07                     ` Russell King - ARM Linux
2011-07-15 21:18                       ` Colin Cross
2011-07-15 21:58                         ` Russell King - ARM Linux
2011-07-15 22:13                           ` Colin Cross
2011-07-16 22:41                             ` Nicolas Pitre

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).