aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2011-05-11 16:58:18 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2011-05-19 03:32:25 -0400
commit03bf469add176afd8a1a4c493d9f4e0e520db12b (patch)
tree2e36fc188ad74d41066e486771a0ed2a5cd8bc03
parentb73a635f348610304eee543d733a6277f67ba178 (diff)
powerpc: Make early memory scan more resilient to out of order nodes
We keep track of the size of the lowest block of memory and call setup_initial_memory_limit() only after we've parsed them all Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Acked-by: Milton Miller <miltonm@bga.com>
-rw-r--r--arch/powerpc/kernel/prom.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 5f5e6aed2b70..5311a26dcf46 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -68,6 +68,7 @@ int __initdata iommu_force_on;
68unsigned long tce_alloc_start, tce_alloc_end; 68unsigned long tce_alloc_start, tce_alloc_end;
69u64 ppc64_rma_size; 69u64 ppc64_rma_size;
70#endif 70#endif
71static phys_addr_t first_memblock_size;
71 72
72static int __init early_parse_mem(char *p) 73static int __init early_parse_mem(char *p)
73{ 74{
@@ -505,11 +506,14 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size)
505 size = 0x80000000ul - base; 506 size = 0x80000000ul - base;
506 } 507 }
507#endif 508#endif
508 509 /* Keep track of the beginning of memory -and- the size of
509 /* First MEMBLOCK added, do some special initializations */ 510 * the very first block in the device-tree as it represents
510 if (memstart_addr == ~(phys_addr_t)0) 511 * the RMA on ppc64 server
511 setup_initial_memory_limit(base, size); 512 */
512 memstart_addr = min((u64)memstart_addr, base); 513 if (base < memstart_addr) {
514 memstart_addr = base;
515 first_memblock_size = size;
516 }
513 517
514 /* Add the chunk to the MEMBLOCK list */ 518 /* Add the chunk to the MEMBLOCK list */
515 memblock_add(base, size); 519 memblock_add(base, size);
@@ -694,6 +698,7 @@ void __init early_init_devtree(void *params)
694 698
695 of_scan_flat_dt(early_init_dt_scan_root, NULL); 699 of_scan_flat_dt(early_init_dt_scan_root, NULL);
696 of_scan_flat_dt(early_init_dt_scan_memory_ppc, NULL); 700 of_scan_flat_dt(early_init_dt_scan_memory_ppc, NULL);
701 setup_initial_memory_limit(memstart_addr, first_memblock_size);
697 702
698 /* Save command line for /proc/cmdline and then parse parameters */ 703 /* Save command line for /proc/cmdline and then parse parameters */
699 strlcpy(boot_command_line, cmd_line, COMMAND_LINE_SIZE); 704 strlcpy(boot_command_line, cmd_line, COMMAND_LINE_SIZE);