Skip to contentSkip to conversation

PPC: Use correct values for 970 interrupts and hreset

PATCH In review Alexander Graf 3 participants 5 messages Feb 28, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PPC: Use correct values for 970 interrupts and hreset

The 970 doesn't set exception prefix values by default. According to the ISA it just jumps to real mode with nip=vector.

Because of that the current hreset_vector is rendered invalid. Before, it would go to excp_prefix (ROM base) + 0x100 (reset vector) and get into the firmware.

But with the corrected excp_prefix, we now have to jump to the real entry point, which is at 0xFFFFFFFC.

I can't imagine how any OS that does memory management itself could have possibly worked with the code as it was.

---
 target-ppc/translate_init.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
target-ppc/translate_init.c +2 -2
index 889708f..e20b1c9 100644
@@ -3052,9 +3052,9 @@ static void init_excp_970 (CPUPPCState *env)
     env->excp_vectors[POWERPC_EXCP_MAINT]    = 0x00001600;
     env->excp_vectors[POWERPC_EXCP_VPUA]     = 0x00001700;
     env->excp_vectors[POWERPC_EXCP_THERM]    = 0x00001800;
-    env->excp_prefix   = 0x00000000FFF00000ULL;
+    env->excp_prefix   = 0x0000000000000000ULL;
     /* Hardware reset vector */
-    env->hreset_vector = 0x0000000000000100ULL;
+    env->hreset_vector = 0x00000000FFFFFFFCULL;
 #endif
 }
 #endif
Signature · 1 line
1.5.3.1
#1 lore raw
Quoted 9 lines · Alexander Graf

The 970 doesn't set exception prefix values by default. According to
the ISA it just jumps to real mode with nip=vector.

Because of that the current hreset_vector is rendered invalid. Before, it would go to excp_prefix (ROM base) + 0x100 (reset vector) and get into the firmware.

But with the corrected excp_prefix, we now have to jump to the real entry point, which is at 0xFFFFFFFC.

I don't think this is correct. 970FX uses HIOR to specify the exception vector base, please see "IBM PowerPC 970FX RISC Microprocessor", page 273.

Quoted 4 lines

From OpenBIOS viewpoint both vectors are OK.

I can't imagine how any OS that does memory management itself could have possibly worked with the code as it was.

Maybe Qemu uses the 604 exception prefix somewhere.

#2 lore raw
Quoted 8 lines · Blue Swirl
Quoted 7 lines · Alexander Graf

The 970 doesn't set exception prefix values by default. According to the ISA it just jumps to real mode with nip=vector.

Because of that the current hreset_vector is rendered invalid. Before, it would go to excp_prefix (ROM base) + 0x100 (reset vector) and get into the firmware.

Quoted 6 lines
Quoted 2 lines

But with the corrected excp_prefix, we now have to jump to the real entry point, which is at 0xFFFFFFFC.

I don't think this is correct. 970FX uses HIOR to specify the exception vector base, please see "IBM PowerPC 970FX RISC Microprocessor", page 273.

That's only valid for LPAR, right? So it's basically a hypervisor register which we don't even touch, which means it's basically always 0.

Alex

Quoted 6 lines

From OpenBIOS viewpoint both vectors are OK.

Quoted 2 lines

I can't imagine how any OS that does memory management itself could have possibly worked with the code as it was.

Maybe Qemu uses the 604 exception prefix somewhere.

#3 lore raw
In reply to Blue Swirl
Quoted 8 lines · Blue Swirl
Quoted 7 lines · Alexander Graf

The 970 doesn't set exception prefix values by default. According to the ISA it just jumps to real mode with nip=vector.

Because of that the current hreset_vector is rendered invalid. Before, it would go to excp_prefix (ROM base) + 0x100 (reset vector) and get into the firmware.

Quoted 6 lines
Quoted 2 lines

But with the corrected excp_prefix, we now have to jump to the real entry point, which is at 0xFFFFFFFC.

I don't think this is correct. 970FX uses HIOR to specify the exception vector base, please see "IBM PowerPC 970FX RISC Microprocessor", page 273.

Oh I think I know what you're saying:

The Hardware Interrupt Offset register, HIOR should be scanned (the HIOR is on the mode ring) to the system’s starting address during initialization. Subsequently HIOR should be set to zero.

That basically means, HIOR is 0xfff00000 on bootup, but magically becomes 0 at - eh - a random point in time? Or should the firmware set it? How is this implemented on a G5 that doesn't know LPAR features, like Apple's G5?

Alex

#4 lore raw
Quoted 24 lines · Alexander Graf
Quoted 9 lines · Blue Swirl
Quoted 7 lines · Alexander Graf

The 970 doesn't set exception prefix values by default. According to the ISA it just jumps to real mode with nip=vector.

Because of that the current hreset_vector is rendered invalid. Before, it would go to excp_prefix (ROM base) + 0x100 (reset vector) and get into the firmware.

Quoted 8 lines
Quoted 3 lines

But with the corrected excp_prefix, we now have to jump to the real entry point, which is at 0xFFFFFFFC.

I don't think this is correct. 970FX uses HIOR to specify the exception vector base, please see "IBM PowerPC 970FX RISC Microprocessor", page 273.

Oh I think I know what you're saying:

Quoted 8 lines

The Hardware Interrupt Offset register, HIOR should be scanned (the HIOR is
on the mode ring) to the
system’s starting address during initialization. Subsequently HIOR should
be set to zero.

That basically means, HIOR is 0xfff00000 on bootup, but magically becomes 0
at - eh - a random point in time? Or should the firmware set it? How is this implemented on a G5 that doesn't know LPAR features, like Apple's G5?

Firmware should clear it. Maybe their BIOS sets all unknown SPRs to 0?