linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [RFC] powerpc/boot: compare _start against ei.loadsize instead ei.memsize
@ 2008-09-23 20:38 Sebastian Siewior
  2008-09-24  1:46 ` Milton Miller
  2008-09-25 18:15 ` [RFC] powerpc/boot: compare _start against ei.loadsize instead ei.memsize Scott Wood
  0 siblings, 2 replies; 12+ messages in thread
From: Sebastian Siewior @ 2008-09-23 20:38 UTC (permalink / raw)
  To: linuxppc-dev

My mylinux binary incl. bss is ~5 MiB without bss less than 4 MiB.
Therefore I though that I could replace ei.memsize with ei.loadsize. It
didn't work. I'm not sure why it did not work but I guess that the
memset() of bss in the initial kernel code overwrote the cuimage code
which is required for some reason. Maybe some device-tree callbacks.

My current (working) solution is to move cuImage from 4 MiB to 8 MiB.
Something similar has been done for pSeries in 9b09c6d "powerpc: Change
the default link address for pSeries zImage kernels". Would it be
appropriate to move initial address to 64 MiB as the default loading
address or do we have here some boards which have only 64 MiB of memory?
Does someone have another idea?

--- a/arch/powerpc/boot/main.c
+++ b/arch/powerpc/boot/main.c
@@ -56,7 +56,7 @@ static struct addr_range prep_kernel(void)
 	if (platform_ops.vmlinux_alloc) {
 		addr = platform_ops.vmlinux_alloc(ei.memsize);
 	} else {
-		if ((unsigned long)_start < ei.memsize)
+		if ((unsigned long)_start < ei.loadsize)
 			fatal("Insufficient memory for kernel at address 0!"
 			       " (_start=%p)\n\r", _start);
 	}
-- 

--- a/arch/powerpc/boot/wrapper
+++ b/arch/powerpc/boot/wrapper
@@ -138,7 +138,7 @@ objflags=-S
 tmp=$tmpdir/zImage.$$.o
 ksection=.kernel:vmlinux.strip
 isection=.kernel:initrd
-link_address='0x400000'
+link_address='0x800000'
 
 case "$platform" in
 pseries)
-- 
1.5.6.5

^ permalink raw reply	[flat|nested] 12+ messages in thread
* Re: [RFC] powerpc/boot: compare _start against ei.loadsize instead ei.memsize
@ 2008-09-25 19:54 Milton Miller
  0 siblings, 0 replies; 12+ messages in thread
From: Milton Miller @ 2008-09-25 19:54 UTC (permalink / raw)
  To: Sebastian Siewior, Milton Miller; +Cc: linuxppc-dev, David Gibson

----- Original Message Follows -----
From: Sebastian Siewior <bigeasy@linutronix.de>
To: Milton Miller <miltonm@bga.com>
Cc: linuxppc-dev@ozlabs.org, David Gibson
<david@gibson.dropbear.id.au>, Grant Likely
<grant.likely@secretlab.ca>
Subject: Re: [RFC] powerpc/boot: compare _start against
ei.loadsize instead ei.memsize
Date: Thu, 25 Sep 2008 12:21:41 +0200
 
> Milton Miller wrote:
>>> My current (working) solution is to move cuImage from 4
>>> MiB to 8 MiB. Something similar has been done for
>>> pSeries in 9b09c6d "powerpc: Change the default link
>>> address for pSeries zImage kernels". Would it be 
>>> appropriate to move initial address to 64 MiB as the
>>> default loading address or do we have here some boards
>> which have only 64 MiB of memory? 
>> I think there are some boards that have even less
>> (8xx?).  Is the link address a wrapper option yet?
> 
> Nope. The wrapper script distinguishes between platforms.
> Default is 4MiB,  pSeries has 64MiB, coff does 5MiB and
> the PS3 has other magic.
 
ok.  I think some of the embedded boards have less than
64M.  On the other hand, my (64 bit with drivers) kernel
static load is over 8M (close to 9).  The needed size
is obviously configuration dependent.
 
There has been talk of reading the size to determine a
suitable address, but its all talk so far.
 
There are two approaches: one is to make it self-
configuring to the minimum for the image you build, 
the other other is to make it a command line option
to the wrapper and then put platform selections in
Kconfig, hidden with embedded for most people.
 
Or we can change the default to say 16M and hope its
enough but not too much for most and not can decode
the platforms for the rest.
 
We could also add a link time check, but we need to
know which platforms, like the OF ones, have a non-
default vmlinux_alloc and don't put the kernel in
place directly (and hence need to skip the check).
 
> >> --- a/arch/powerpc/boot/main.c
> >> +++ b/arch/powerpc/boot/main.c
> >> @@ -56,7 +56,7 @@ static struct addr_range
> prep_kernel(void) >>      if (platform_ops.vmlinux_alloc)
> { >>          addr =
> platform_ops.vmlinux_alloc(ei.memsize); >>      } else {
> >> -        if ((unsigned long)_start < ei.memsize)
> >> +        if ((unsigned long)_start < ei.loadsize)
> > 
> > 
> > I think this needs to be a two part test (add
appropriate
> >     casts):   _start < ei.loadsize || _end < ei.memsize
> > 
> > .. and a comment explaining why.
> 
> okay.
> 
> > We could do better if we kept allocating more memory
> > until we got above it, but the current code has no such
> > provision.  (prpmc2800, or one of those, actually
> > decompresses the header to peek at memsize before
> starting the simple_alloc code).
> 
> I don't thing I can follow. Do you want to move the
> bootwrapper code above  the limit and recall it?
 
I'm saying the code could be changed to do better, but
am not currently requesting any change.
 
milton

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

end of thread, other threads:[~2008-11-06  0:16 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-23 20:38 [RFC] powerpc/boot: compare _start against ei.loadsize instead ei.memsize Sebastian Siewior
2008-09-24  1:46 ` Milton Miller
2008-09-25 10:21   ` Sebastian Siewior
2008-09-25 21:43   ` Sebastian Siewior
2008-10-10  3:58     ` Benjamin Herrenschmidt
2008-10-13  9:15       ` [PATCH] " Sebastian Andrzej Siewior
2008-10-14  1:57         ` David Gibson
2008-10-14  2:00           ` David Gibson
2008-11-01 20:00             ` [PATCH] powerpc/boot: allocate more memory for dtb Sebastian Andrzej Siewior
2008-11-06  0:16               ` David Gibson
2008-09-25 18:15 ` [RFC] powerpc/boot: compare _start against ei.loadsize instead ei.memsize Scott Wood
  -- strict thread matches above, loose matches on Subject: below --
2008-09-25 19:54 Milton Miller

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