linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [POWERPC] Clean up some linker and symbol usage
@ 2008-03-27 19:53 Kumar Gala
  2008-03-27 23:14 ` Paul Mackerras
  0 siblings, 1 reply; 4+ messages in thread
From: Kumar Gala @ 2008-03-27 19:53 UTC (permalink / raw)
  To: linuxppc-dev

* use _stext and _end sybmols when reserving kernel text in the lmb.  Use
  of these symbols is a bit more robust way to determine the physical start
  and size of the kernel text.
* PAGE_OFFSET is not always the start of code, use _stext instead.
* grab PAGE_SIZE and KERNELBASE from asm/page.h like ppc64 does.  Makes the
  code a bit more common and provide a single place to manipulate the defines
  for things like kdump.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
---
 arch/powerpc/kernel/prom.c        |    2 +-
 arch/powerpc/kernel/setup_32.c    |    2 +-
 arch/powerpc/kernel/setup_64.c    |    2 +-
 arch/powerpc/kernel/vmlinux.lds.S |    4 +---
 4 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 9330920..60ef7d1 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -1124,7 +1124,7 @@ void __init early_init_devtree(void *params)
 	parse_early_param();

 	/* Reserve LMB regions used by kernel, initrd, dt, etc... */
-	lmb_reserve(PHYSICAL_START, __pa(klimit) - PHYSICAL_START);
+	lmb_reserve(__pa(_stext), _end - _stext);
 	reserve_kdump_trampoline();
 	reserve_crashkernel();
 	early_reserve_mem();
diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
index cd870a8..b0989ca 100644
--- a/arch/powerpc/kernel/setup_32.c
+++ b/arch/powerpc/kernel/setup_32.c
@@ -277,7 +277,7 @@ void __init setup_arch(char **cmdline_p)
 	if (ppc_md.panic)
 		setup_panic();

-	init_mm.start_code = PAGE_OFFSET;
+	init_mm.start_code = (unsigned long)_stext;
 	init_mm.end_code = (unsigned long) _etext;
 	init_mm.end_data = (unsigned long) _edata;
 	init_mm.brk = klimit;
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index 2c2d831..0205d40 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -510,7 +510,7 @@ void __init setup_arch(char **cmdline_p)
 	if (ppc_md.panic)
 		setup_panic();

-	init_mm.start_code = PAGE_OFFSET;
+	init_mm.start_code = (unsigned long)_stext;
 	init_mm.end_code = (unsigned long) _etext;
 	init_mm.end_data = (unsigned long) _edata;
 	init_mm.brk = klimit;
diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S
index 0afb9e3..b5a76bc 100644
--- a/arch/powerpc/kernel/vmlinux.lds.S
+++ b/arch/powerpc/kernel/vmlinux.lds.S
@@ -1,11 +1,9 @@
 #ifdef CONFIG_PPC64
-#include <asm/page.h>
 #define PROVIDE32(x)	PROVIDE(__unused__##x)
 #else
-#define PAGE_SIZE	4096
-#define KERNELBASE	CONFIG_KERNEL_START
 #define PROVIDE32(x)	PROVIDE(x)
 #endif
+#include <asm/page.h>
 #include <asm-generic/vmlinux.lds.h>
 #include <asm/cache.h>

-- 
1.5.4.1

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

* Re: [PATCH] [POWERPC] Clean up some linker and symbol usage
  2008-03-27 19:53 [PATCH] [POWERPC] Clean up some linker and symbol usage Kumar Gala
@ 2008-03-27 23:14 ` Paul Mackerras
  2008-03-28  0:45   ` Michael Ellerman
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Mackerras @ 2008-03-27 23:14 UTC (permalink / raw)
  To: Kumar Gala; +Cc: linuxppc-dev

Kumar Gala writes:

> @@ -1124,7 +1124,7 @@ void __init early_init_devtree(void *params)
>  	parse_early_param();
> 
>  	/* Reserve LMB regions used by kernel, initrd, dt, etc... */
> -	lmb_reserve(PHYSICAL_START, __pa(klimit) - PHYSICAL_START);
> +	lmb_reserve(__pa(_stext), _end - _stext);

In the kdump case where the kernel starts at the 32MB point
(physical), wouldn't we want to reserve the first 32MB of RAM so that
it can't get allocated and used for random things?  Doesn't that first
32MB contain the old kernel that we want to write out?

Or do we only have the 32MB starting at the 32MB point in the lmb
system in that case?

Paul.

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

* Re: [PATCH] [POWERPC] Clean up some linker and symbol usage
  2008-03-27 23:14 ` Paul Mackerras
@ 2008-03-28  0:45   ` Michael Ellerman
  2008-03-28  1:52     ` Kumar Gala
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Ellerman @ 2008-03-28  0:45 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev

[-- Attachment #1: Type: text/plain, Size: 1081 bytes --]


On Fri, 2008-03-28 at 10:14 +1100, Paul Mackerras wrote:
> Kumar Gala writes:
> 
> > @@ -1124,7 +1124,7 @@ void __init early_init_devtree(void *params)
> >  	parse_early_param();
> > 
> >  	/* Reserve LMB regions used by kernel, initrd, dt, etc... */
> > -	lmb_reserve(PHYSICAL_START, __pa(klimit) - PHYSICAL_START);
> > +	lmb_reserve(__pa(_stext), _end - _stext);
> 
> In the kdump case where the kernel starts at the 32MB point
> (physical), wouldn't we want to reserve the first 32MB of RAM so that
> it can't get allocated and used for random things?  Doesn't that first
> 32MB contain the old kernel that we want to write out?

For kdump there is nMB of memory reserved at 32MB for the 2nd kernel,
and that's all it gets, all of the other memory is the old kernel text
or the old kernel's data.

cheers

-- 
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: [PATCH] [POWERPC] Clean up some linker and symbol usage
  2008-03-28  0:45   ` Michael Ellerman
@ 2008-03-28  1:52     ` Kumar Gala
  0 siblings, 0 replies; 4+ messages in thread
From: Kumar Gala @ 2008-03-28  1:52 UTC (permalink / raw)
  To: michael; +Cc: linuxppc-dev, Paul Mackerras


On Mar 27, 2008, at 7:45 PM, Michael Ellerman wrote:
>
> On Fri, 2008-03-28 at 10:14 +1100, Paul Mackerras wrote:
>> Kumar Gala writes:
>>
>>> @@ -1124,7 +1124,7 @@ void __init early_init_devtree(void *params)
>>> 	parse_early_param();
>>>
>>> 	/* Reserve LMB regions used by kernel, initrd, dt, etc... */
>>> -	lmb_reserve(PHYSICAL_START, __pa(klimit) - PHYSICAL_START);
>>> +	lmb_reserve(__pa(_stext), _end - _stext);
>>
>> In the kdump case where the kernel starts at the 32MB point
>> (physical), wouldn't we want to reserve the first 32MB of RAM so that
>> it can't get allocated and used for random things?  Doesn't that  
>> first
>> 32MB contain the old kernel that we want to write out?
>
> For kdump there is nMB of memory reserved at 32MB for the 2nd kernel,
> and that's all it gets, all of the other memory is the old kernel text
> or the old kernel's data.

My understanding is those reservations are handled by the device tree  
that is passed to the 2nd kernel.

- k

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

end of thread, other threads:[~2008-03-28  1:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-27 19:53 [PATCH] [POWERPC] Clean up some linker and symbol usage Kumar Gala
2008-03-27 23:14 ` Paul Mackerras
2008-03-28  0:45   ` Michael Ellerman
2008-03-28  1:52     ` Kumar Gala

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