Linux MIPS Architecture development
 help / color / mirror / Atom feed
* IP22 64bit kernel
@ 2007-09-11 21:30 Thomas Bogendoerfer
  2007-09-12 23:15 ` Ralf Baechle
  2007-09-13  7:05 ` Kumba
  0 siblings, 2 replies; 6+ messages in thread
From: Thomas Bogendoerfer @ 2007-09-11 21:30 UTC (permalink / raw)
  To: linux-mips

I finally figured out, why 64bit SGI IP22 kernels are broken (at
least when booted with SGI sash). Looks like sash jumps to an uncached
XPHYS address instead of the KSEG0 address indicated by the ELF start.
This messes up bogomips calculation.

I found an interesting piece of code in head.S:

        .macro  ARC64_TWIDDLE_PC
#if defined(CONFIG_ARC64) || defined(CONFIG_MAPPED_KERNEL)
        /* We get launched at a XKPHYS address but the kernel is linked
 * to
           run at a KSEG0 address, so jump there.  */
        PTR_LA  t0, \@f
        jr      t0
\@:
#endif
        .endm


Enabling this for (CONFIG_SGI_IP22 && CONFIG_64BIT) fixes the boot problem.
It's not big deal to add this, but I'm wondering why we not just always
use this macro ? What platforms do it break with it ?

Thomas.
 
-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessary a
good idea.                                                [ RFC1925, 2.3 ]

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

* Re: IP22 64bit kernel
  2007-09-11 21:30 IP22 64bit kernel Thomas Bogendoerfer
@ 2007-09-12 23:15 ` Ralf Baechle
  2007-09-13  7:05 ` Kumba
  1 sibling, 0 replies; 6+ messages in thread
From: Ralf Baechle @ 2007-09-12 23:15 UTC (permalink / raw)
  To: Thomas Bogendoerfer; +Cc: linux-mips

On Tue, Sep 11, 2007 at 11:30:48PM +0200, Thomas Bogendoerfer wrote:

> I finally figured out, why 64bit SGI IP22 kernels are broken (at
> least when booted with SGI sash). Looks like sash jumps to an uncached
> XPHYS address instead of the KSEG0 address indicated by the ELF start.
> This messes up bogomips calculation.
> 
> I found an interesting piece of code in head.S:
> 
>         .macro  ARC64_TWIDDLE_PC
> #if defined(CONFIG_ARC64) || defined(CONFIG_MAPPED_KERNEL)
>         /* We get launched at a XKPHYS address but the kernel is linked
>  * to
>            run at a KSEG0 address, so jump there.  */
>         PTR_LA  t0, \@f
>         jr      t0
> \@:
> #endif
>         .endm
> 
> 
> Enabling this for (CONFIG_SGI_IP22 && CONFIG_64BIT) fixes the boot problem.
> It's not big deal to add this, but I'm wondering why we not just always
> use this macro ? What platforms do it break with it ?

I don't think any will break - it's just one of those "optimizations".

  Ralf

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

* Re: IP22 64bit kernel
  2007-09-11 21:30 IP22 64bit kernel Thomas Bogendoerfer
  2007-09-12 23:15 ` Ralf Baechle
@ 2007-09-13  7:05 ` Kumba
  2007-09-13 15:50   ` Ralf Baechle
  1 sibling, 1 reply; 6+ messages in thread
From: Kumba @ 2007-09-13  7:05 UTC (permalink / raw)
  To: Thomas Bogendoerfer; +Cc: linux-mips

Thomas Bogendoerfer wrote:
> 
> Enabling this for (CONFIG_SGI_IP22 && CONFIG_64BIT) fixes the boot problem.
> It's not big deal to add this, but I'm wondering why we not just always
> use this macro ? What platforms do it break with it ?

Hmm, curious, the CONFIG_ARC64 macro?  Indys and O2s use 32bit versions of the 
ARCS Prom, whereas Octane, Origin, and IP28 systems (and others) use 64bit.  I 
suspect CONFIG_ARC64 is geared for these, but if it works on Indy's too, that's 
curious.


--Kumba

-- 
Gentoo/MIPS Team Lead

"Such is oft the course of deeds that move the wheels of the world: small hands 
do them because they must, while the eyes of the great are elsewhere."  --Elrond

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

* Re: IP22 64bit kernel
  2007-09-13  7:05 ` Kumba
@ 2007-09-13 15:50   ` Ralf Baechle
  2007-09-13 18:23     ` Thomas Bogendoerfer
  0 siblings, 1 reply; 6+ messages in thread
From: Ralf Baechle @ 2007-09-13 15:50 UTC (permalink / raw)
  To: Kumba; +Cc: Thomas Bogendoerfer, linux-mips

On Thu, Sep 13, 2007 at 03:05:24AM -0400, Kumba wrote:

> >Enabling this for (CONFIG_SGI_IP22 && CONFIG_64BIT) fixes the boot problem.
> >It's not big deal to add this, but I'm wondering why we not just always
> >use this macro ? What platforms do it break with it ?
> 
> Hmm, curious, the CONFIG_ARC64 macro?  Indys and O2s use 32bit versions of 
> the ARCS Prom, whereas Octane, Origin, and IP28 systems (and others) use 
> 64bit.  I suspect CONFIG_ARC64 is geared for these, but if it works on 
> Indy's too, that's curious.

The problem isn't limited to ARC firmware; basically any non-R8000 64-bit
system can be affected.  A kernel may be using either addresses in XKPHYS
or in CKSEG0 and the segment for which the kernel is linked is not
necessarily the same that the firmware will load it to.

  Ralf

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

* Re: IP22 64bit kernel
  2007-09-13 15:50   ` Ralf Baechle
@ 2007-09-13 18:23     ` Thomas Bogendoerfer
  2007-10-17 18:36       ` Ralf Baechle
  0 siblings, 1 reply; 6+ messages in thread
From: Thomas Bogendoerfer @ 2007-09-13 18:23 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: Kumba, linux-mips

On Thu, Sep 13, 2007 at 04:50:59PM +0100, Ralf Baechle wrote:
> The problem isn't limited to ARC firmware; basically any non-R8000 64-bit
> system can be affected.  A kernel may be using either addresses in XKPHYS
> or in CKSEG0 and the segment for which the kernel is linked is not
> necessarily the same that the firmware will load it to.

here is a patch:

Always jump to the place where the kernel is linked to. This helps
where the bootloaders/proms ignores the start address inside the ELF
header.

Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
---

diff --git a/arch/mips/kernel/head.S b/arch/mips/kernel/head.S
index e46782b..80d0ab9 100644
--- a/arch/mips/kernel/head.S
+++ b/arch/mips/kernel/head.S
@@ -27,16 +27,6 @@
 
 #include <kernel-entry-init.h>
 
-	.macro	ARC64_TWIDDLE_PC
-#if defined(CONFIG_ARC64) || defined(CONFIG_MAPPED_KERNEL)
-	/* We get launched at a XKPHYS address but the kernel is linked to
-	   run at a KSEG0 address, so jump there.  */
-	PTR_LA	t0, \@f
-	jr	t0
-\@:
-#endif
-	.endm
-
 	/*
 	 * inputs are the text nasid in t1, data nasid in t2.
 	 */
@@ -155,7 +145,11 @@ NESTED(kernel_entry, 16, sp)			# kernel entry point
 
 	setup_c0_status_pri
 
-	ARC64_TWIDDLE_PC
+	/* We might not get launched at the address the kernel is linked to,
+	   so we jump there.  */
+	PTR_LA	t0, 0f
+	jr	t0
+0:
 
 #ifdef CONFIG_MIPS_MT_SMTC
 	/*

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessary a
good idea.                                                [ RFC1925, 2.3 ]

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

* Re: IP22 64bit kernel
  2007-09-13 18:23     ` Thomas Bogendoerfer
@ 2007-10-17 18:36       ` Ralf Baechle
  0 siblings, 0 replies; 6+ messages in thread
From: Ralf Baechle @ 2007-10-17 18:36 UTC (permalink / raw)
  To: Thomas Bogendoerfer; +Cc: Kumba, linux-mips

On Thu, Sep 13, 2007 at 08:23:48PM +0200, Thomas Bogendoerfer wrote:

> On Thu, Sep 13, 2007 at 04:50:59PM +0100, Ralf Baechle wrote:
> > The problem isn't limited to ARC firmware; basically any non-R8000 64-bit
> > system can be affected.  A kernel may be using either addresses in XKPHYS
> > or in CKSEG0 and the segment for which the kernel is linked is not
> > necessarily the same that the firmware will load it to.
> 
> here is a patch:
> 
> Always jump to the place where the kernel is linked to. This helps
> where the bootloaders/proms ignores the start address inside the ELF
> header.

Applied.

  Ralf

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

end of thread, other threads:[~2007-10-17 18:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-11 21:30 IP22 64bit kernel Thomas Bogendoerfer
2007-09-12 23:15 ` Ralf Baechle
2007-09-13  7:05 ` Kumba
2007-09-13 15:50   ` Ralf Baechle
2007-09-13 18:23     ` Thomas Bogendoerfer
2007-10-17 18:36       ` Ralf Baechle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox