linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc: Make early memory scan more resilient to out of order nodes
@ 2011-05-12  6:58 Benjamin Herrenschmidt
  2011-05-12  8:09 ` Milton Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Benjamin Herrenschmidt @ 2011-05-12  6:58 UTC (permalink / raw)
  To: linuxppc-dev

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>
---
 arch/powerpc/kernel/prom.c |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 584b398..27475c6 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -70,6 +70,7 @@ int __initdata iommu_force_on;
 unsigned long tce_alloc_start, tce_alloc_end;
 u64 ppc64_rma_size;
 #endif
+static phys_addr_t first_memblock_size;
 
 static int __init early_parse_mem(char *p)
 {
@@ -507,11 +508,14 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size)
 			size = 0x80000000ul - base;
 	}
 #endif
-
-	/* First MEMBLOCK added, do some special initializations */
-	if (memstart_addr == ~(phys_addr_t)0)
-		setup_initial_memory_limit(base, size);
-	memstart_addr = min((u64)memstart_addr, base);
+	/* Keep track of the beginning of memory -and- the size of
+	 * the very first block in the device-tree as it represents
+	 * the RMA on ppc64 server
+	 */
+	if (base < memstart_addr) {
+		memstart_addr = base;
+		first_memblock_size = size;
+	}
 
 	/* Add the chunk to the MEMBLOCK list */
 	memblock_add(base, size);
@@ -708,6 +712,7 @@ void __init early_init_devtree(void *params)
 
 	of_scan_flat_dt(early_init_dt_scan_root, NULL);
 	of_scan_flat_dt(early_init_dt_scan_memory_ppc, NULL);
+	setup_initial_memory_limit(memstart_addr, first_memblock_size);
 
 	/* Save command line for /proc/cmdline and then parse parameters */
 	strlcpy(boot_command_line, cmd_line, COMMAND_LINE_SIZE);

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

* Re: powerpc: Make early memory scan more resilient to out of order nodes
  2011-05-12  6:58 [PATCH] powerpc: Make early memory scan more resilient to out of order nodes Benjamin Herrenschmidt
@ 2011-05-12  8:09 ` Milton Miller
  2011-05-12 11:08   ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 3+ messages in thread
From: Milton Miller @ 2011-05-12  8:09 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev

On Wed, 11 May 2011 about 20:58:18 -0000, Benjamin Herrenschmidt wrote:
> 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
> 

Good, we lose our sensitivity to device node ordering.

> diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c

> index 584b398..27475c6 100644
> --- a/arch/powerpc/kernel/prom.c
> +++ b/arch/powerpc/kernel/prom.c
> @@ -70,6 +70,7 @@ int __initdata iommu_force_on;
>  unsigned long tce_alloc_start, tce_alloc_end;
>  u64 ppc64_rma_size;
>  #endif
> +static phys_addr_t first_memblock_size;

__initdata 

(its only referenced by 2 __init functions)

Acked-by: Milton Miller <miltonm@bga.com>


>  static int __init early_parse_mem(char *p)
>  {
..
> @@ -507,11 +508,14 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size)
..
> @@ -708,6 +712,7 @@ void __init early_init_devtree(void *params)

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

* Re: powerpc: Make early memory scan more resilient to out of order nodes
  2011-05-12  8:09 ` Milton Miller
@ 2011-05-12 11:08   ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 3+ messages in thread
From: Benjamin Herrenschmidt @ 2011-05-12 11:08 UTC (permalink / raw)
  To: Milton Miller; +Cc: linuxppc-dev

On Thu, 2011-05-12 at 03:09 -0500, Milton Miller wrote:
> On Wed, 11 May 2011 about 20:58:18 -0000, Benjamin Herrenschmidt wrote:
> > 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
> > 
> 
> Good, we lose our sensitivity to device node ordering.

Yup, A platform we'll release soon has all of them backward :-)

> > diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
> 
> > index 584b398..27475c6 100644
> > --- a/arch/powerpc/kernel/prom.c
> > +++ b/arch/powerpc/kernel/prom.c
> > @@ -70,6 +70,7 @@ int __initdata iommu_force_on;
> >  unsigned long tce_alloc_start, tce_alloc_end;
> >  u64 ppc64_rma_size;
> >  #endif
> > +static phys_addr_t first_memblock_size;
> 
> __initdata 
> 
> (its only referenced by 2 __init functions)
> 
> Acked-by: Milton Miller <miltonm@bga.com>

Ag good, I'll fold that in, thanks.

Cheers,
Ben.

> 
> >  static int __init early_parse_mem(char *p)
> >  {
> ..
> > @@ -507,11 +508,14 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size)
> ..
> > @@ -708,6 +712,7 @@ void __init early_init_devtree(void *params)

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

end of thread, other threads:[~2011-05-12 11:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-12  6:58 [PATCH] powerpc: Make early memory scan more resilient to out of order nodes Benjamin Herrenschmidt
2011-05-12  8:09 ` Milton Miller
2011-05-12 11:08   ` Benjamin Herrenschmidt

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).