linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* can't boot mpc5200, powerpc: Enable AT_BASE_PLATFORM aux vector
@ 2008-07-25 21:51 Jon Smirl
  2008-07-25 22:00 ` Nathan Lynch
  0 siblings, 1 reply; 8+ messages in thread
From: Jon Smirl @ 2008-07-25 21:51 UTC (permalink / raw)
  To: ppc-dev

I've lost my ability to boot on the mpc5200. Reverting this patch fixes it.

powerpc: Enable AT_BASE_PLATFORM aux vector
9115d13453dee22473a1e8cacc90a8d64a9c4bc9

commit 9115d13453dee22473a1e8cacc90a8d64a9c4bc9
Author: Nathan Lynch <ntl@pobox.com>
Date:   Wed Jul 16 09:58:51 2008 +1000

    powerpc: Enable AT_BASE_PLATFORM aux vector

    Stash the first platform string matched by identify_cpu() in
    powerpc_base_platform, and supply that to the ELF loader for the value
    of AT_BASE_PLATFORM.

    Signed-off-by: Nathan Lynch <ntl@pobox.com>
    Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
index b936a1d..25a052c 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -23,6 +23,9 @@
 struct cpu_spec* cur_cpu_spec = NULL;
 EXPORT_SYMBOL(cur_cpu_spec);

+/* The platform string corresponding to the real PVR */
+const char *powerpc_base_platform;
+
 /* NOTE:
  * Unlike ppc32, ppc64 will only call this once for the boot CPU, it's
  * the responsibility of the appropriate CPU save/restore functions to
@@ -1652,6 +1655,14 @@ struct cpu_spec * __init identify_cpu(unsigned
long offset, unsigned int pvr)
 			} else
 				*t = *s;
 			*PTRRELOC(&cur_cpu_spec) = &the_cpu_spec;
+
+			/*
+			 * Set the base platform string once; assumes
+			 * we're called with real pvr first.
+			 */
+			if (powerpc_base_platform == NULL)
+				powerpc_base_platform = t->platform;
+
 #if defined(CONFIG_PPC64) || defined(CONFIG_BOOKE)
 			/* ppc64 and booke expect identify_cpu to also call
 			 * setup_cpu for that processor. I will consolidate
diff --git a/include/asm-powerpc/cputable.h b/include/asm-powerpc/cputable.h
index 2a3e907..ef8a248 100644
--- a/include/asm-powerpc/cputable.h
+++ b/include/asm-powerpc/cputable.h
@@ -127,6 +127,8 @@ extern struct cpu_spec *identify_cpu(unsigned long
offset, unsigned int pvr);
 extern void do_feature_fixups(unsigned long value, void *fixup_start,
 			      void *fixup_end);

+extern const char *powerpc_base_platform;
+
 #endif /* __ASSEMBLY__ */

 /* CPU kernel features */
diff --git a/include/asm-powerpc/elf.h b/include/asm-powerpc/elf.h
index 8966467..80d1f39 100644
--- a/include/asm-powerpc/elf.h
+++ b/include/asm-powerpc/elf.h
@@ -217,6 +217,14 @@ typedef elf_vrregset_t elf_fpxregset_t;

 #define ELF_PLATFORM	(cur_cpu_spec->platform)

+/* While ELF_PLATFORM indicates the ISA supported by the platform, it
+ * may not accurately reflect the underlying behavior of the hardware
+ * (as in the case of running in Power5+ compatibility mode on a
+ * Power6 machine).  ELF_BASE_PLATFORM allows ld.so to load libraries
+ * that are tuned for the real hardware.
+ */
+#define ELF_BASE_PLATFORM (powerpc_base_platform)
+
 #ifdef __powerpc64__
 # define ELF_PLAT_INIT(_r, load_addr)	do {	\
 	_r->gpr[2] = load_addr; 		\

-- 
Jon Smirl
jonsmirl@gmail.com

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

* Re: can't boot mpc5200, powerpc: Enable AT_BASE_PLATFORM aux vector
  2008-07-25 21:51 can't boot mpc5200, powerpc: Enable AT_BASE_PLATFORM aux vector Jon Smirl
@ 2008-07-25 22:00 ` Nathan Lynch
  2008-07-25 22:15   ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 8+ messages in thread
From: Nathan Lynch @ 2008-07-25 22:00 UTC (permalink / raw)
  To: Jon Smirl; +Cc: ppc-dev

Jon Smirl wrote:
> I've lost my ability to boot on the mpc5200. Reverting this patch fixes it.

How does it fail?


> @@ -1652,6 +1655,14 @@ struct cpu_spec * __init identify_cpu(unsigned
> long offset, unsigned int pvr)
>  			} else
>  				*t = *s;
>  			*PTRRELOC(&cur_cpu_spec) = &the_cpu_spec;
> +
> +			/*
> +			 * Set the base platform string once; assumes
> +			 * we're called with real pvr first.
> +			 */
> +			if (powerpc_base_platform == NULL)
> +				powerpc_base_platform = t->platform;
> +

Hmm, maybe this needs RELOC/PTRRELOC tricks?

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

* Re: can't boot mpc5200, powerpc: Enable AT_BASE_PLATFORM aux vector
  2008-07-25 22:00 ` Nathan Lynch
@ 2008-07-25 22:15   ` Benjamin Herrenschmidt
  2008-07-25 22:46     ` Jon Smirl
  2008-07-25 22:50     ` Nathan Lynch
  0 siblings, 2 replies; 8+ messages in thread
From: Benjamin Herrenschmidt @ 2008-07-25 22:15 UTC (permalink / raw)
  To: Nathan Lynch; +Cc: ppc-dev

On Fri, 2008-07-25 at 17:00 -0500, Nathan Lynch wrote:
> Jon Smirl wrote:
> > I've lost my ability to boot on the mpc5200. Reverting this patch fixes it.
> 
> How does it fail?
> 
> 
> > @@ -1652,6 +1655,14 @@ struct cpu_spec * __init identify_cpu(unsigned
> > long offset, unsigned int pvr)
> >  			} else
> >  				*t = *s;
> >  			*PTRRELOC(&cur_cpu_spec) = &the_cpu_spec;
> > +
> > +			/*
> > +			 * Set the base platform string once; assumes
> > +			 * we're called with real pvr first.
> > +			 */
> > +			if (powerpc_base_platform == NULL)
> > +				powerpc_base_platform = t->platform;
> > +
> 
> Hmm, maybe this needs RELOC/PTRRELOC tricks?

Hrm... indeed.

if (RELOC(powerpc_base_platform))
	RELOC(powerpc_base_platform) = t->platform;

try that.

Ben.

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

* Re: can't boot mpc5200, powerpc: Enable AT_BASE_PLATFORM aux vector
  2008-07-25 22:15   ` Benjamin Herrenschmidt
@ 2008-07-25 22:46     ` Jon Smirl
  2008-07-25 22:51       ` Jon Smirl
  2008-07-25 22:50     ` Nathan Lynch
  1 sibling, 1 reply; 8+ messages in thread
From: Jon Smirl @ 2008-07-25 22:46 UTC (permalink / raw)
  To: benh; +Cc: ppc-dev, Nathan Lynch

On 7/25/08, Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
> On Fri, 2008-07-25 at 17:00 -0500, Nathan Lynch wrote:
>  > Jon Smirl wrote:
>  > > I've lost my ability to boot on the mpc5200. Reverting this patch fixes it.
>  >
>  > How does it fail?
>  >
>  >
>  > > @@ -1652,6 +1655,14 @@ struct cpu_spec * __init identify_cpu(unsigned
>  > > long offset, unsigned int pvr)
>  > >                     } else
>  > >                             *t = *s;
>  > >                     *PTRRELOC(&cur_cpu_spec) = &the_cpu_spec;
>  > > +
>  > > +                   /*
>  > > +                    * Set the base platform string once; assumes
>  > > +                    * we're called with real pvr first.
>  > > +                    */
>  > > +                   if (powerpc_base_platform == NULL)
>  > > +                           powerpc_base_platform = t->platform;
>  > > +
>  >
>  > Hmm, maybe this needs RELOC/PTRRELOC tricks?
>
>
> Hrm... indeed.
>
>  if (RELOC(powerpc_base_platform))
>         RELOC(powerpc_base_platform) = t->platform;

It completely fails booting, no console or anything.

Where is RELOC defined, prom_init.c?

#ifdef CONFIG_PPC64
#define RELOC(x)        (*PTRRELOC(&(x)))
#define ADDR(x)         (u32) add_reloc_offset((unsigned long)(x))
#define OF_WORKAROUNDS  0
#else
#define RELOC(x)        (x)
#define ADDR(x)         (u32) (x)
#define OF_WORKAROUNDS  of_workarounds
int of_workarounds;
#endif



>
>  try that.
>
>  Ben.
>
>
>


-- 
Jon Smirl
jonsmirl@gmail.com

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

* Re: can't boot mpc5200, powerpc: Enable AT_BASE_PLATFORM aux vector
  2008-07-25 22:15   ` Benjamin Herrenschmidt
  2008-07-25 22:46     ` Jon Smirl
@ 2008-07-25 22:50     ` Nathan Lynch
  2008-07-25 22:52       ` Jon Smirl
  1 sibling, 1 reply; 8+ messages in thread
From: Nathan Lynch @ 2008-07-25 22:50 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: ppc-dev

Commit 9115d13453dee22473a1e8cacc90a8d64a9c4bc9 ("powerpc: Enable
AT_BASE_PLATFORM aux vector") broke boot on 32-bit powerpc systems; we
have to use PTRRELOC to initialize powerpc_base_platform this early in
boot.

Bug reported by Jon Smirl.

Signed-off-by: Nathan Lynch <ntl@pobox.com>
---
Benjamin Herrenschmidt wrote:
> if (RELOC(powerpc_base_platform))
> 	RELOC(powerpc_base_platform) = t->platform;
> 
> try that.

Maybe this?  (RELOC isn't defined in any header AFAICT).

 arch/powerpc/kernel/cputable.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
index 25a052c..25c273c 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -1660,8 +1660,8 @@ struct cpu_spec * __init identify_cpu(unsigned long offset, unsigned int pvr)
 			 * Set the base platform string once; assumes
 			 * we're called with real pvr first.
 			 */
-			if (powerpc_base_platform == NULL)
-				powerpc_base_platform = t->platform;
+			if (*PTRRELOC(&powerpc_base_platform) == NULL)
+				*PTRRELOC(&powerpc_base_platform) = t->platform;
 
 #if defined(CONFIG_PPC64) || defined(CONFIG_BOOKE)
 			/* ppc64 and booke expect identify_cpu to also call
-- 
1.5.6.2

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

* Re: can't boot mpc5200, powerpc: Enable AT_BASE_PLATFORM aux vector
  2008-07-25 22:46     ` Jon Smirl
@ 2008-07-25 22:51       ` Jon Smirl
  0 siblings, 0 replies; 8+ messages in thread
From: Jon Smirl @ 2008-07-25 22:51 UTC (permalink / raw)
  To: benh; +Cc: ppc-dev, Nathan Lynch

On 7/25/08, Jon Smirl <jonsmirl@gmail.com> wrote:
> On 7/25/08, Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
>  > On Fri, 2008-07-25 at 17:00 -0500, Nathan Lynch wrote:
>  >  > Jon Smirl wrote:
>  >  > > I've lost my ability to boot on the mpc5200. Reverting this patch fixes it.
>  >  >
>  >  > How does it fail?
>  >  >
>  >  >
>  >  > > @@ -1652,6 +1655,14 @@ struct cpu_spec * __init identify_cpu(unsigned
>  >  > > long offset, unsigned int pvr)
>  >  > >                     } else
>  >  > >                             *t = *s;
>  >  > >                     *PTRRELOC(&cur_cpu_spec) = &the_cpu_spec;
>  >  > > +
>  >  > > +                   /*
>  >  > > +                    * Set the base platform string once; assumes
>  >  > > +                    * we're called with real pvr first.
>  >  > > +                    */
>  >  > > +                   if (powerpc_base_platform == NULL)
>  >  > > +                           powerpc_base_platform = t->platform;
>  >  > > +
>  >  >
>  >  > Hmm, maybe this needs RELOC/PTRRELOC tricks?
>  >
>  >
>  > Hrm... indeed.
>  >
>  >  if (RELOC(powerpc_base_platform))
>  >         RELOC(powerpc_base_platform) = t->platform;

This boots:

#define RELOC(x)        (*PTRRELOC(&(x)))
			if (RELOC(powerpc_base_platform))
			       RELOC(powerpc_base_platform) = t->platform;


>
>
> It completely fails booting, no console or anything.
>
>  Where is RELOC defined, prom_init.c?
>
>  #ifdef CONFIG_PPC64
>  #define RELOC(x)        (*PTRRELOC(&(x)))
>  #define ADDR(x)         (u32) add_reloc_offset((unsigned long)(x))
>  #define OF_WORKAROUNDS  0
>  #else
>  #define RELOC(x)        (x)
>  #define ADDR(x)         (u32) (x)
>  #define OF_WORKAROUNDS  of_workarounds
>  int of_workarounds;
>  #endif
>
>
>
>  >
>  >  try that.
>  >
>  >  Ben.
>
> >
>  >
>  >
>
>
>  --
>  Jon Smirl
>  jonsmirl@gmail.com
>


-- 
Jon Smirl
jonsmirl@gmail.com

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

* Re: can't boot mpc5200, powerpc: Enable AT_BASE_PLATFORM aux vector
  2008-07-25 22:50     ` Nathan Lynch
@ 2008-07-25 22:52       ` Jon Smirl
  2008-07-25 22:58         ` Nathan Lynch
  0 siblings, 1 reply; 8+ messages in thread
From: Jon Smirl @ 2008-07-25 22:52 UTC (permalink / raw)
  To: Nathan Lynch; +Cc: ppc-dev

On 7/25/08, Nathan Lynch <ntl@pobox.com> wrote:
> Commit 9115d13453dee22473a1e8cacc90a8d64a9c4bc9 ("powerpc: Enable
>  AT_BASE_PLATFORM aux vector") broke boot on 32-bit powerpc systems; we
>  have to use PTRRELOC to initialize powerpc_base_platform this early in
>  boot.
>
>  Bug reported by Jon Smirl.
>
>
>  Signed-off-by: Nathan Lynch <ntl@pobox.com>
>
> ---
>
> Benjamin Herrenschmidt wrote:
>  > if (RELOC(powerpc_base_platform))
>  >       RELOC(powerpc_base_platform) = t->platform;
>  >
>  > try that.
>
>
> Maybe this?  (RELOC isn't defined in any header AFAICT).
>
>   arch/powerpc/kernel/cputable.c |    4 ++--
>   1 files changed, 2 insertions(+), 2 deletions(-)
>
>
>  diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
>
> index 25a052c..25c273c 100644
>
> --- a/arch/powerpc/kernel/cputable.c
>  +++ b/arch/powerpc/kernel/cputable.c
>
> @@ -1660,8 +1660,8 @@ struct cpu_spec * __init identify_cpu(unsigned long offset, unsigned int pvr)
>
>                          * Set the base platform string once; assumes
>                          * we're called with real pvr first.
>                          */
>  -                       if (powerpc_base_platform == NULL)
>  -                               powerpc_base_platform = t->platform;
>
> +                       if (*PTRRELOC(&powerpc_base_platform) == NULL)
>  +                               *PTRRELOC(&powerpc_base_platform) = t->platform;

This works too.

>
>
>   #if defined(CONFIG_PPC64) || defined(CONFIG_BOOKE)
>                         /* ppc64 and booke expect identify_cpu to also call
>
> --
>  1.5.6.2
>  _______________________________________________
>  Linuxppc-dev mailing list
>  Linuxppc-dev@ozlabs.org
>  https://ozlabs.org/mailman/listinfo/linuxppc-dev
>


-- 
Jon Smirl
jonsmirl@gmail.com

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

* Re: can't boot mpc5200, powerpc: Enable AT_BASE_PLATFORM aux vector
  2008-07-25 22:52       ` Jon Smirl
@ 2008-07-25 22:58         ` Nathan Lynch
  0 siblings, 0 replies; 8+ messages in thread
From: Nathan Lynch @ 2008-07-25 22:58 UTC (permalink / raw)
  To: Jon Smirl; +Cc: ppc-dev

> This works too.

Thanks Jon, sorry about that.

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

end of thread, other threads:[~2008-07-25 22:58 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-25 21:51 can't boot mpc5200, powerpc: Enable AT_BASE_PLATFORM aux vector Jon Smirl
2008-07-25 22:00 ` Nathan Lynch
2008-07-25 22:15   ` Benjamin Herrenschmidt
2008-07-25 22:46     ` Jon Smirl
2008-07-25 22:51       ` Jon Smirl
2008-07-25 22:50     ` Nathan Lynch
2008-07-25 22:52       ` Jon Smirl
2008-07-25 22:58         ` Nathan Lynch

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