diff mbox

PPC: mac newworld: fix cpu NIP reset value

Message ID 1365094053-1635-1-git-send-email-agraf@suse.de
State New
Headers show

Commit Message

Alexander Graf April 4, 2013, 4:47 p.m. UTC
On -M mac99, we can run 970 CPUs. However, these CPUs define the initial
instruction pointer they start execution at as part of their bootup protocol,
so effectively it's up to the board to decide where they start.

This went unnoticed, because they used to boot at the same location our flash
was mapped to, but due to the recent reset changes our 970 CPUs want to reset
to 0x100 now, which is always a 0 instruction.

Set the initial IP to something reasonable for -M mac99.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 hw/ppc/mac_newworld.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

Comments

Andreas Färber April 4, 2013, 7:06 p.m. UTC | #1
Am 04.04.2013 18:47, schrieb Alexander Graf:
> On -M mac99, we can run 970 CPUs. However, these CPUs define the initial
> instruction pointer they start execution at as part of their bootup protocol,
> so effectively it's up to the board to decide where they start.
> 
> This went unnoticed, because they used to boot at the same location our flash
> was mapped to, but due to the recent reset changes our 970 CPUs want to reset
> to 0x100 now, which is always a 0 instruction.
> 
> Set the initial IP to something reasonable for -M mac99.
> 
> Signed-off-by: Alexander Graf <agraf@suse.de>
> ---
>  hw/ppc/mac_newworld.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c
> index a08a6b2..ca7d98f 100644
> --- a/hw/ppc/mac_newworld.c
> +++ b/hw/ppc/mac_newworld.c
> @@ -126,6 +126,8 @@ static void ppc_core99_reset(void *opaque)
>      PowerPCCPU *cpu = opaque;
>  
>      cpu_reset(CPU(cpu));
> +    /* 970 CPUs want to get their initial IP as part of their boot protocol */
> +    cpu->env.nip = PROM_ADDR + 0x100;
>  }
>  
>  /* PowerPC Mac99 hardware initialisation */

That is lacking a restriction to 970... :) There's probably some -cpu to
make it start from -4 instead, no?

Andreas
Alexander Graf April 4, 2013, 10:25 p.m. UTC | #2
Am 04.04.2013 um 21:06 schrieb Andreas Färber <afaerber@suse.de>:

> Am 04.04.2013 18:47, schrieb Alexander Graf:
>> On -M mac99, we can run 970 CPUs. However, these CPUs define the initial
>> instruction pointer they start execution at as part of their bootup protocol,
>> so effectively it's up to the board to decide where they start.
>> 
>> This went unnoticed, because they used to boot at the same location our flash
>> was mapped to, but due to the recent reset changes our 970 CPUs want to reset
>> to 0x100 now, which is always a 0 instruction.
>> 
>> Set the initial IP to something reasonable for -M mac99.
>> 
>> Signed-off-by: Alexander Graf <agraf@suse.de>
>> ---
>> hw/ppc/mac_newworld.c |    2 ++
>> 1 files changed, 2 insertions(+), 0 deletions(-)
>> 
>> diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c
>> index a08a6b2..ca7d98f 100644
>> --- a/hw/ppc/mac_newworld.c
>> +++ b/hw/ppc/mac_newworld.c
>> @@ -126,6 +126,8 @@ static void ppc_core99_reset(void *opaque)
>>     PowerPCCPU *cpu = opaque;
>> 
>>     cpu_reset(CPU(cpu));
>> +    /* 970 CPUs want to get their initial IP as part of their boot protocol */
>> +    cpu->env.nip = PROM_ADDR + 0x100;
>> }
>> 
>> /* PowerPC Mac99 hardware initialisation */
> 
> That is lacking a restriction to 970... :) There's probably some -cpu to
> make it start from -4 instead, no?

There shouldn't. All CPUs compatible with -M mac99 boot from 0xfff0100.

Alex

> 
> Andreas
> 
> -- 
> SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
> GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Fabien Chouteau April 5, 2013, 9:09 a.m. UTC | #3
On 04/04/2013 06:47 PM, Alexander Graf wrote:
> On -M mac99, we can run 970 CPUs. However, these CPUs define the initial
> instruction pointer they start execution at as part of their bootup protocol,
> so effectively it's up to the board to decide where they start.
>
> This went unnoticed, because they used to boot at the same location our flash
> was mapped to, but due to the recent reset changes our 970 CPUs want to reset
> to 0x100 now, which is always a 0 instruction.
>

This is one of the regressions introduced by my patch, thanks for fixing
it.

Reviewed-by: Fabien Chouteau <chouteau@adacore.com>

> Set the initial IP to something reasonable for -M mac99.
> 
> Signed-off-by: Alexander Graf <agraf@suse.de>
> ---
>  hw/ppc/mac_newworld.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c
> index a08a6b2..ca7d98f 100644
> --- a/hw/ppc/mac_newworld.c
> +++ b/hw/ppc/mac_newworld.c
> @@ -126,6 +126,8 @@ static void ppc_core99_reset(void *opaque)
>      PowerPCCPU *cpu = opaque;
>  
>      cpu_reset(CPU(cpu));
> +    /* 970 CPUs want to get their initial IP as part of their boot protocol */
> +    cpu->env.nip = PROM_ADDR + 0x100;
>  }
>  
>  /* PowerPC Mac99 hardware initialisation */
>
diff mbox

Patch

diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c
index a08a6b2..ca7d98f 100644
--- a/hw/ppc/mac_newworld.c
+++ b/hw/ppc/mac_newworld.c
@@ -126,6 +126,8 @@  static void ppc_core99_reset(void *opaque)
     PowerPCCPU *cpu = opaque;
 
     cpu_reset(CPU(cpu));
+    /* 970 CPUs want to get their initial IP as part of their boot protocol */
+    cpu->env.nip = PROM_ADDR + 0x100;
 }
 
 /* PowerPC Mac99 hardware initialisation */