Skip to contentSkip to conversation

some fixes for PPC e300

PATCH Superseded Thomas Monjalon 6 participants 13 messages Apr 21, 2010 – May 2, 2010

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover some fixes for PPC e300

From: Thomas Monjalon <[email protected]>

I'm working on e300.
It's still not working but these patches are some little steps in the right direction.

My references:

ancestry:         http://www.freescale.com/files/32bit/doc/data_sheet/MPC603.pdf
core:             http://www.freescale.com/files/32bit/doc/ref_manual/e300coreRM.pdf
microcontroller:  http://www.freescale.com/files/32bit/doc/ref_manual/MPC8349EAEC.pdf
Signature · 10 lines
Thomas

---

Thomas Monjalon (2):
  target-ppc: fix processor versions (PVR) for e300
  target-ppc: fix interrupt vectors for MPC603 and e300

 target-ppc/translate_init.c |   26 ++++++++++++++++++--------
 1 files changed, 18 insertions(+), 8 deletions(-)
#1 lore raw

PATCH 1/2 target-ppc: fix processor versions (PVR) for e300

From: Thomas Monjalon <[email protected]>

Reflect values from the table "Assigned PVR values" in [e300CORERM].

Values for MPC603 and G2 processors could need check/changes also.

The reference document (e300CORERM) which is used is:
"e300 Power Architecture Core Family Reference Manual", Revision 4, 12/2007.

---
 target-ppc/translate_init.c |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)
target-ppc/translate_init.c +7 -6
index e8eadf4..9e42831 100644
@@ -6720,17 +6720,18 @@ enum {
     /* e300 family */
     /* e300 cores */
 #define CPU_POWERPC_e300             CPU_POWERPC_e300c3
-    CPU_POWERPC_e300c1             = 0x00830010,
-    CPU_POWERPC_e300c2             = 0x00840010,
-    CPU_POWERPC_e300c3             = 0x00850010,
-    CPU_POWERPC_e300c4             = 0x00860010,
+    CPU_POWERPC_e300c1             = 0x80830010,
+    CPU_POWERPC_e300c2             = 0x80840010,
+    CPU_POWERPC_e300c3             = 0x80850010,
+    CPU_POWERPC_e300c4_MPC5121e    = 0x80860010,
+    CPU_POWERPC_e300c4_MPC83xx     = 0x80861010,
     /* MPC83xx microcontrollers */
 #define CPU_POWERPC_MPC831x          CPU_POWERPC_e300c3
 #define CPU_POWERPC_MPC832x          CPU_POWERPC_e300c2
 #define CPU_POWERPC_MPC834x          CPU_POWERPC_e300c1
 #define CPU_POWERPC_MPC835x          CPU_POWERPC_e300c1
 #define CPU_POWERPC_MPC836x          CPU_POWERPC_e300c1
-#define CPU_POWERPC_MPC837x          CPU_POWERPC_e300c4
+#define CPU_POWERPC_MPC837x          CPU_POWERPC_e300c4_MPC83xx
     /* e500 family */
     /* e500 cores  */
 #define CPU_POWERPC_e500             CPU_POWERPC_e500v2_v22
@@ -7977,7 +7978,7 @@ static const ppc_def_t ppc_defs[] = {
     /* PowerPC e300c3 core                                                   */
     POWERPC_DEF("e300c3",        CPU_POWERPC_e300c3,                 e300),
     /* PowerPC e300c4 core                                                   */
-    POWERPC_DEF("e300c4",        CPU_POWERPC_e300c4,                 e300),
+    POWERPC_DEF("e300c4",        CPU_POWERPC_e300c4_MPC83xx,         e300),
     /* PowerPC e300 microcontrollers                                         */
 #if defined (TODO)
     /* MPC8313                                                               */
Signature · 1 line
1.7.0.5
#2 lore raw

PATCH 2/2 target-ppc: fix interrupt vectors for MPC603 and e300

In reply to Thomas Monjalon

From: Thomas Monjalon <[email protected]>

The vectors are listed
- in the chapter 1.3.3.2 (Implementation-Specific Interrupt Model) of the e300 datasheet [e300CORERM] and
- in the chapter 3.5.2 (PowerPC 603 Microprocessor Exception Model) of the MPC603 datasheet.

As e300 inherits from MPC603, init_excp_e300() calls init_excp_603().

---
 target-ppc/translate_init.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)
target-ppc/translate_init.c +11 -2
index 9e42831..f3e266d 100644
@@ -2853,7 +2853,16 @@ static void init_excp_603 (CPUPPCState *env)
     env->excp_vectors[POWERPC_EXCP_SMI]      = 0x00001400;
     env->hreset_excp_prefix = 0x00000000UL;
     /* Hardware reset vector */
-    env->hreset_vector = 0xFFFFFFFCUL;
+    env->hreset_vector = 0x00000100UL;
+#endif
+}
+
+static void init_excp_e300 (CPUPPCState *env)
+{
+    init_excp_603(env);
+#if !defined(CONFIG_USER_ONLY)
+    env->excp_vectors[POWERPC_EXCP_CRITICAL] = 0x00000A00;
+    env->excp_vectors[POWERPC_EXCP_PERFM]    = 0x00000F00;
 #endif
 }
 
@@ -4175,7 +4184,7 @@ static void init_proc_e300 (CPUPPCState *env)
     gen_low_BATs(env);
     gen_high_BATs(env);
     gen_6xx_7xx_soft_tlb(env, 64, 2);
-    init_excp_603(env);
+    init_excp_e300(env);
     env->dcache_line_size = 32;
     env->icache_line_size = 32;
     /* Allocate hardware IRQ controller */
Signature · 1 line
1.7.0.5
#3 lore raw

Re: [Qemu-devel] [PATCH 2/2] target-ppc: fix interrupt vectors for MPC603 and e300

Quoted 20 lines · Thomas Monjalon

From: Thomas Monjalon <[email protected]>

The vectors are listed
- in the chapter 1.3.3.2 (Implementation-Specific Interrupt Model) of the e300 datasheet [e300CORERM] and
- in the chapter 3.5.2 (PowerPC 603 Microprocessor Exception Model) of the MPC603 datasheet.

As e300 inherits from MPC603, init_excp_e300() calls init_excp_603().

---
target-ppc/translate_init.c | 13 +++++++++++--

1 files changed, 11 insertions(+), 2 deletions(-)
target-ppc/translate_init.c +0 -0
index 9e42831..f3e266d 100644

target-ppc/translate_init.c static void init_excp_603 (CPUPPCState *env) · line 2856

Quoted 5 lines
target-ppc/translate_init.c +1 -1
@@ -2853,7 +2853,16 @@ static void init_excp_603 (CPUPPCState *env)
    env->excp_vectors[POWERPC_EXCP_SMI]      = 0x00001400;
    env->hreset_excp_prefix = 0x00000000UL;
    /* Hardware reset vector */
-    env->hreset_vector = 0xFFFFFFFCUL;
+    env->hreset_vector = 0x00000100UL;

Are you 100% sure this is correct? IIRC the reset vector is dictated by the CPU initialization sequence, so there's no hardwired value here really.

Btw - what do you use to test your patches?

Alex

#4 lore raw

Re: [Qemu-devel] [PATCH 2/2] target-ppc: fix interrupt vectors for MPC603 and e300

Quoted 11 lines · Alexander Graf

target-ppc/translate_init.c static void init_excp_603 (CPUPPCState *env) · line 2856

Quoted 8 lines
target-ppc/translate_init.c +1 -1
@@ -2853,7 +2853,16 @@ static void init_excp_603 (CPUPPCState *env)
    env->excp_vectors[POWERPC_EXCP_SMI]      = 0x00001400;
    env->hreset_excp_prefix = 0x00000000UL;
    /* Hardware reset vector */
-    env->hreset_vector = 0xFFFFFFFCUL;
+    env->hreset_vector = 0x00000100UL;

Are you 100% sure this is correct? IIRC the reset vector is dictated by the CPU initialization sequence, so there's no hardwired value here really.

It is explained in [e300CORERM] at chapters 5.2.3, 5.5.1.1 and 8.3.3. Clearly, the vector offset is 0x100 and the exception prefix can be 0 or 0xFFF00000, depending of the MSR[IP] bit.

So, yes, I'm sure the value of hreset_vector must be 0x100. But hreset_excp_prefix can change. It could be another patch.

About the prefix initialization, the datasheet says it is "determined by MSR[IP]". and is "determined by the state of the msrip signal". But I don't understand what is the msrip signal and how MSR[IP] is changed (is it related to msrip ?). Do you have an explanation for this part ?

Quoted 1 line

Btw - what do you use to test your patches?

I'm slowly writing support for the WindRiver board SBC8349E. For the moment, I send patches for things I'm sure.

Thanks for the review

Signature · 1 line
Thomas
#5 lore raw

Re: [Qemu-devel] [PATCH 2/2] target-ppc: fix interrupt vectors for MPC603 and e300

Quoted 15 lines · Thomas Monjalon
Quoted 12 lines · Alexander Graf

target-ppc/translate_init.c static void init_excp_603 (CPUPPCState *env) · line 2857

Quoted 9 lines
target-ppc/translate_init.c +1 -1
@@ -2853,7 +2853,16 @@ static void init_excp_603 (CPUPPCState *env)
    env->excp_vectors[POWERPC_EXCP_SMI]      = 0x00001400;
    env->hreset_excp_prefix = 0x00000000UL;
    /* Hardware reset vector */
-    env->hreset_vector = 0xFFFFFFFCUL;
+    env->hreset_vector = 0x00000100UL;
 

Are you 100% sure this is correct? IIRC the reset vector is dictated by the CPU initialization sequence, so there's no hardwired value here really.

Quoted 7 lines

It is explained in [e300CORERM] at chapters 5.2.3, 5.5.1.1 and 8.3.3. Clearly, the vector offset is 0x100 and the exception prefix can be 0 or 0xFFF00000, depending of the MSR[IP] bit.

So, yes, I'm sure the value of hreset_vector must be 0x100. But hreset_excp_prefix can change. It could be another patch.

Interesting. That's different from 970.

Quoted 5 lines

About the prefix initialization, the datasheet says it is "determined by MSR[IP]". and is "determined by the state of the msrip signal". But I don't understand what is the msrip signal and how MSR[IP] is changed (is it related to msrip ?). Do you have an explanation for this part ?

I guess we should ask somebody more knowledgeable here. Segher?

Quoted 7 lines
Quoted 3 lines

Btw - what do you use to test your patches?

I'm slowly writing support for the WindRiver board SBC8349E. For the moment, I send patches for things I'm sure.

Nice. What kind of firmware does that use?

Alex

#6 lore raw

Re: [Qemu-devel] [PATCH 2/2] target-ppc: fix interrupt vectors for MPC603 and e300

Quoted 5 lines · Alexander Graf
Quoted 2 lines · Thomas Monjalon

I'm slowly writing support for the WindRiver board SBC8349E. For the moment, I send patches for things I'm sure.

Nice. What kind of firmware does that use?

Hmm... I don't know. I don't have such a board.
I'm testing by running a wrapped Linux in Qemu.

But I'm interested by the answer...

Signature · 1 line
Thomas
#7 lore raw

Re: [Qemu-devel] [PATCH 2/2] target-ppc: fix interrupt vectors for MPC603 and e300

In reply to Alexander Graf
Quoted 20 lines · Alexander Graf
Quoted 19 lines · Thomas Monjalon
Quoted 12 lines · Alexander Graf

target-ppc/translate_init.c static void init_excp_603 (CPUPPCState *env) · line 2857

Quoted 9 lines
target-ppc/translate_init.c +1 -1
@@ -2853,7 +2853,16 @@ static void init_excp_603 (CPUPPCState *env)
     env->excp_vectors[POWERPC_EXCP_SMI]      = 0x00001400;
     env->hreset_excp_prefix = 0x00000000UL;
     /* Hardware reset vector */
-    env->hreset_vector = 0xFFFFFFFCUL;
+    env->hreset_vector = 0x00000100UL;
 

Are you 100% sure this is correct? IIRC the reset vector is dictated by the CPU initialization sequence, so there's no hardwired value here really.

It is explained in [e300CORERM] at chapters 5.2.3, 5.5.1.1 and 8.3.3. Clearly, the vector offset is 0x100 and the exception prefix can be 0 or 0xFFF00000, depending of the MSR[IP] bit.

Quoted 5 lines
Quoted 3 lines

So, yes, I'm sure the value of hreset_vector must be 0x100. But hreset_excp_prefix can change. It could be another patch.

Interesting. That's different from 970.

Only Book E processors come out of reset with a PC of 0xfffffffc. "Classic" PowerPC comes out with PC 0xfff00100 (the FFF part specified by MSR[IP]).

970 may be a bad example in that it can't actually bring itself up -- it requires an external controller to configure it at power-up. So whatever the external controller programs into the PC is where it starts. I don't see any mention of an initial PC value in the 970 user manuals.

Qemu ignores these details and pretends that all PowerPC start at 0xffffffc. As long as you have qemu-specific firmware that expects this behavior, you're ok...

-Hollis

#8 lore raw

Re: [Qemu-devel] [PATCH 2/2] target-ppc: fix interrupt vectors for MPC603 and e300

Quoted 4 lines

970 may be a bad example in that it can't actually bring itself up -- it requires an external controller to configure it at power-up. So whatever the external controller programs into the PC is where it starts.

970 always starts at HIOR|0x00100.

Quoted 2 lines

I don't see any mention of an initial PC value in the 970 user manuals.

For way more detail than you ever wanted to know of the 970 POR process, see for example the "970MP Power On Reset" application note. The relevant thing here is that the POR state machine instruction that starts the CPU core is SRESET -- and that is described in the UM just fine.

Segher

#9 lore raw

Re: [Qemu-devel] [PATCH 2/2] target-ppc: fix interrupt vectors for MPC603 and e300

In reply to Alexander Graf
Quoted 8 lines
Quoted 6 lines

It is explained in [e300CORERM] at chapters 5.2.3, 5.5.1.1 and 8.3.3. Clearly, the vector offset is 0x100 and the exception prefix can be 0 or 0xFFF00000, depending of the MSR[IP] bit.

So, yes, I'm sure the value of hreset_vector must be 0x100. But hreset_excp_prefix can change. It could be another patch.

Interesting. That's different from 970.

On 970, you can have the same effect (well, more general) by changing HIOR.

Quoted 4 lines
Quoted 4 lines

About the prefix initialization, the datasheet says it is "determined by MSR[IP]". and is "determined by the state of the msrip signal". But I don't understand what is the msrip signal and how MSR[IP] is changed (is it related to msrip ?). Do you have an explanation for this part ?

Your code can change MSR[IP]; there is also a strapping pin that is sampled on HRESET (and copied to MSR[IP]).

Segher

#10 lore raw

Re: [Qemu-devel] [PATCH 2/2] target-ppc: fix interrupt vectors for MPC603 and e300

Quoted 20 lines · Segher Boessenkool
Quoted 11 lines
Quoted 8 lines

It is explained in [e300CORERM] at chapters 5.2.3, 5.5.1.1 and 8.3.3. Clearly, the vector offset is 0x100 and the exception prefix can be 0 or 0xFFF00000, depending of the MSR[IP] bit.

So, yes, I'm sure the value of hreset_vector must be 0x100. But hreset_excp_prefix can change. It could be another patch.

Interesting. That's different from 970.

On 970, you can have the same effect (well, more general) by changing HIOR.

Quoted 3 lines
Quoted 3 lines

About the prefix initialization, the datasheet says it is "determined by MSR[IP]". and is "determined by the state of the msrip signal". But I

don't

Quoted 8 lines
Quoted 1 line
Quoted 1 line

understand what is the msrip signal and how MSR[IP] is changed (is it

related

Quoted 3 lines
Quoted 2 lines

to msrip ?). Do you have an explanation for this part ?

Your code can change MSR[IP]; there is also a strapping pin that is sampled on HRESET (and copied to MSR[IP]).

Wouldn't this mean that when the reset is issued by hardware, MSR[IP] is always 1 (to boot from ROM) but with software reset it can take software defined values?

I think now QEMU ignores MSR[IP].

#11 lore raw

Re: [Qemu-devel] [PATCH 2/2] target-ppc: fix interrupt vectors for MPC603 and e300

Quoted 6 lines
Quoted 2 lines

Your code can change MSR[IP]; there is also a strapping pin that is sampled on HRESET (and copied to MSR[IP]).

Wouldn't this mean that when the reset is issued by hardware, MSR[IP] is always 1 (to boot from ROM) but with software reset it can take software defined values?

Yes, that is what it means.

Quoted 1 line

I think now QEMU ignores MSR[IP].

Fix it :-)

Segher

#12 lore raw

[Qemu-devel] VGA blank mode

Hi

I'm trying to run kvm/qemu on a linux host built from scratch ie., no x windows, no window manager etc. bare minimum libraries etc. when i try to spawn a VM with "-curses", I see "VGA Blank Mode" and nothing else. i'm attached to serial console for this host. what could be the issue?

thanks

________________________________
From: Segher Boessenkool <[email protected]>
To: Blue Swirl <[email protected]>
Cc: Alexander Graf <[email protected]>; [email protected]
Sent: Sun, May 2, 2010 7:19:13 AM
Subject: Re: [Qemu-devel] [PATCH 2/2] target-ppc: fix interrupt vectors for MPC603 and e300

Quoted 6 lines
Quoted 2 lines

Your code can change MSR[IP]; there is also a strapping pin that is sampled on HRESET (and copied to MSR[IP]).

Wouldn't this mean that when the reset is issued by hardware, MSR[IP] is always 1 (to boot from ROM) but with software reset it can take software defined values?

Yes, that is what it means.

Quoted 1 line

I think now QEMU ignores MSR[IP].

Fix it :-)

Segher