Skip to contentSkip to conversation

powerpc/85xx:Fix MSR[DE] bit in MSR to support debugger

PATCH Superseded Prabhakar Kushwaha 2 participants 6 messages Feb 15, 2012 – Mar 13, 2012 PowerPC

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 2/4 powerpc/85xx:Fix MSR[DE] bit in MSR to support debugger

Debugger's ability to debug an application is constrained by the architecture's debug IP / run-control solution that may impose certain requirements for the application itself.
Similarly, when referring to the e500 and e500v2 architecture, there are two basic rules any application has to respect in order to allow full debugging support:
1. Keep MSR[DE] bit set
2. Have a valid opcode that can be fetched from the debug exception vector [IVPR|IVOR15].
Here MSR = Machine State register

This patch makes sure of point "1" and make MSR[DE] bit is set uniformaly across the different execution in address space.

---
Applies on http://git.denx.de/u-boot.git branch master

 arch/powerpc/cpu/mpc85xx/start.S |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
arch/powerpc/cpu/mpc85xx/start.S +7 -2
index 7bfa2d5..09111e6 100644
@@ -82,6 +82,11 @@
 	.globl _start_e500
 
 _start_e500:
+#if defined(CONFIG_E500_V1_V2)
+/* Enable debug exception */
+	li	r1,MSR_DE
+	mtmsr 	r1
+#endif
 
 #if defined(CONFIG_SECURE_BOOT) && defined(CONFIG_E500MC)
 	/* ISBC uses L2 as stack.
@@ -729,8 +734,8 @@ create_init_ram_area:
 	msync
 	tlbwe
 
-	lis	r6,MSR_IS|MSR_DS at h
-	ori	r6,r6,MSR_IS|MSR_DS at l
+	lis	r6,MSR_IS|MSR_DS|MSR_DE at h
+	ori	r6,r6,MSR_IS|MSR_DS|MSR_DE at l
 	lis	r7,switch_as at h
 	ori	r7,r7,switch_as at l
 
Signature · 1 line
1.7.5.4
#1 lore raw

PATCH 2/4 powerpc/85xx:Fix MSR[DE] bit in MSR to support debugger

Dear Prabhakar Kushwaha,

Quoted 11 lines · In message <[email protected]> you…

Debugger's ability to debug an application is constrained by the architecture's debug IP / run-control solution that may impose certain requirements for the application itself.
Similarly, when referring to the e500 and e500v2 architecture, there are two basic rules any application has to respect in order to allow full debugging support:
1. Keep MSR[DE] bit set
2. Have a valid opcode that can be fetched from the debug exception vector [IVPR|IVOR15].
Here MSR = Machine State register

Quoted 2 lines

This patch makes sure of point "1" and make MSR[DE] bit is set uniformaly across the different execution in address space.

Does it make sense to repeast the whole README here?

arch/powerpc/cpu/mpc85xx/start.S line 89

Quoted 13 lines
arch/powerpc/cpu/mpc85xx/start.S +5 -0
index 7bfa2d5..09111e6 100644
@@ -82,6 +82,11 @@
 	.globl _start_e500
 
 _start_e500:
+#if defined(CONFIG_E500_V1_V2)
+/* Enable debug exception */
+	li	r1,MSR_DE
+	mtmsr 	r1
+#endif

Why is this #ifdef needed here?

arch/powerpc/cpu/mpc85xx/start.S create_init_ram_area: · line 738

Quoted 10 lines
arch/powerpc/cpu/mpc85xx/start.S +2 -2
 #if defined(CONFIG_SECURE_BOOT) && defined(CONFIG_E500MC)
 	/* ISBC uses L2 as stack.
@@ -729,8 +734,8 @@ create_init_ram_area:
 	msync
 	tlbwe
 
-	lis	r6,MSR_IS|MSR_DS at h
-	ori	r6,r6,MSR_IS|MSR_DS at l
+	lis	r6,MSR_IS|MSR_DS|MSR_DE at h
+	ori	r6,r6,MSR_IS|MSR_DS|MSR_DE at l

And why don;t we need such an #ifdef here?

Also, CONFIG_E500_V1_V2 is undocumented.

Best regards,

Wolfgang Denk

Signature · 9 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"(The  Chief  Programmer)  personally  defines  the  functional   and
performance  specifications, designs the program, codes it, tests it,
and writes its documentation... He  needs  great  talent,  ten  years
experience  and  considerable  systems  and  applications  knowledge,
whether in applied mathematics, business data handling, or whatever."
- Fred P. Brooks, _The Mythical Man Month_
#2 lore raw

PATCH 2/4 powerpc/85xx:Fix MSR[DE] bit in MSR to support debugger

Hi Wolfgang,

Quoted 14 lines · Wolfgang Denk

Dear Prabhakar Kushwaha,

Quoted 11 lines · In message<[email protected]> you…

Debugger's ability to debug an application is constrained by the architecture's debug IP / run-control solution that may impose certain requirements for the application itself.
Similarly, when referring to the e500 and e500v2 architecture, there are two basic rules any application has to respect in order to allow full debugging support:
1. Keep MSR[DE] bit set
2. Have a valid opcode that can be fetched from the debug exception
vector [IVPR|IVOR15].
Here MSR = Machine State register

Quoted 3 lines
Quoted 2 lines

This patch makes sure of point "1" and make MSR[DE] bit is set uniformaly across the different execution in address space.

Does it make sense to repeast the whole README here?

I agree. it should not be.
But as i sent a series of patch, this change require some explanation.

I will change the description.

Quoted 7 lines
Quoted 7 lines
arch/powerpc/cpu/mpc85xx/start.S +0 -0
index 7bfa2d5..09111e6 100644
@@ -82,6 +82,11 @@
  	.globl _start_e500
 
Quoted 7 lines

arch/powerpc/cpu/mpc85xx/start.S line 89

Quoted 6 lines
arch/powerpc/cpu/mpc85xx/start.S +5 -0
  _start_e500:
+#if defined(CONFIG_E500_V1_V2)
+/* Enable debug exception */
+	li	r1,MSR_DE
+	mtmsr 	r1
+#endif

Why is this #ifdef needed here?

This #ifdef is to make sure MSR_DE bit is set before u-boot's actual code start executing.
it is for overcoming one of the requirement of debugging i.e. Keep MSR_DE bit set.

Quoted 11 lines

arch/powerpc/cpu/mpc85xx/start.S create_init_ram_area: · line 738

Quoted 10 lines
arch/powerpc/cpu/mpc85xx/start.S +2 -2
  #if defined(CONFIG_SECURE_BOOT)&&  defined(CONFIG_E500MC)
  	/* ISBC uses L2 as stack.
@@ -729,8 +734,8 @@ create_init_ram_area:
  	msync
  	tlbwe
 
-	lis	r6,MSR_IS|MSR_DS at h
-	ori	r6,r6,MSR_IS|MSR_DS at l
+	lis	r6,MSR_IS|MSR_DS|MSR_DE at h
+	ori	r6,r6,MSR_IS|MSR_DS|MSR_DE at l

And why don;t we need such an #ifdef here?

I found similar piece of code in start.S without any #define at label _start_cont. That's why i made it like this.
if required i will put it under #define.

Quoted 1 line

Also, CONFIG_E500_V1_V2 is undocumented.

Definition of this #define is part of documentation. I will add comment before using it.

--Prabhakar

#5 lore raw

PATCH 2/4 powerpc/85xx:Fix MSR[DE] bit in MSR to support debugger

In reply to Wolfgang Denk

Hi Wolfgang,

Quoted 14 lines · Wolfgang Denk

Dear Prabhakar Kushwaha,

Quoted 11 lines · In message<[email protected]> you…

Debugger's ability to debug an application is constrained by the architecture's debug IP / run-control solution that may impose certain requirements for the application itself.
Similarly, when referring to the e500 and e500v2 architecture, there are two basic rules any application has to respect in order to allow full debugging support:
1. Keep MSR[DE] bit set
2. Have a valid opcode that can be fetched from the debug exception
vector [IVPR|IVOR15].
Here MSR = Machine State register

Quoted 3 lines
Quoted 2 lines

This patch makes sure of point "1" and make MSR[DE] bit is set uniformaly across the different execution in address space.

Does it make sense to repeast the whole README here?

I agree. it should not be.
But as i sent a series of patch, this change require some explanation.

I will change the description.

Quoted 7 lines
Quoted 7 lines
arch/powerpc/cpu/mpc85xx/start.S +0 -0
index 7bfa2d5..09111e6 100644
@@ -82,6 +82,11 @@
  	.globl _start_e500
 
Quoted 7 lines

arch/powerpc/cpu/mpc85xx/start.S line 89

Quoted 6 lines
arch/powerpc/cpu/mpc85xx/start.S +5 -0
  _start_e500:
+#if defined(CONFIG_E500_V1_V2)
+/* Enable debug exception */
+	li	r1,MSR_DE
+	mtmsr 	r1
+#endif

Why is this #ifdef needed here?

This #ifdef is to make sure MSR_DE bit is set before u-boot's actual code start executing.
it is for overcoming one of the requirement of debugging i.e. Keep MSR_DE bit set.

Quoted 11 lines

arch/powerpc/cpu/mpc85xx/start.S create_init_ram_area: · line 738

Quoted 10 lines
arch/powerpc/cpu/mpc85xx/start.S +2 -2
  #if defined(CONFIG_SECURE_BOOT)&&  defined(CONFIG_E500MC)
  	/* ISBC uses L2 as stack.
@@ -729,8 +734,8 @@ create_init_ram_area:
  	msync
  	tlbwe
 
-	lis	r6,MSR_IS|MSR_DS at h
-	ori	r6,r6,MSR_IS|MSR_DS at l
+	lis	r6,MSR_IS|MSR_DS|MSR_DE at h
+	ori	r6,r6,MSR_IS|MSR_DS|MSR_DE at l

And why don;t we need such an #ifdef here?

I found similar piece of code in start.S without any #define at label _start_cont. That's why i made it like this.

if required i will put it under #define.

Quoted 1 line

Also, CONFIG_E500_V1_V2 is undocumented.

Definition of this #define is part of documentation. I will add comment before using it.

--Prabhakar

#3 lore raw

PATCH 2/4 powerpc/85xx:Fix MSR[DE] bit in MSR to support debugger

In reply to Prabhakar Kushwaha

Dear Prabhakar Kushwaha,

Quoted 14 lines · In message <[email protected]> you wrote:
Quoted 6 lines
Quoted 6 lines
arch/powerpc/cpu/mpc85xx/start.S +0 -0
@@ -82,6 +82,11 @@
  	.globl _start_e500
 
Quoted 7 lines

arch/powerpc/cpu/mpc85xx/start.S line 89

Quoted 6 lines
arch/powerpc/cpu/mpc85xx/start.S +5 -0
  _start_e500:
+#if defined(CONFIG_E500_V1_V2)
+/* Enable debug exception */
+	li	r1,MSR_DE
+	mtmsr 	r1
+#endif

Why is this #ifdef needed here?

Quoted 4 lines

This #ifdef is to make sure MSR_DE bit is set before u-boot's actual code start executing.
it is for overcoming one of the requirement of debugging i.e. Keep MSR_DE bit set.

Sorry, this makes no sense to me. The #ifdef does not change the order of execution, it just enables or disables the code. Are there any situations where omitting this code is required, or where it makes sense?

Quoted 10 lines
Quoted 9 lines

arch/powerpc/cpu/mpc85xx/start.S create_init_ram_area: · line 738

Quoted 8 lines
arch/powerpc/cpu/mpc85xx/start.S +2 -2
@@ -729,8 +734,8 @@ create_init_ram_area:
  	msync
  	tlbwe
 
-	lis	r6,MSR_IS|MSR_DS at h
-	ori	r6,r6,MSR_IS|MSR_DS at l
+	lis	r6,MSR_IS|MSR_DS|MSR_DE at h
+	ori	r6,r6,MSR_IS|MSR_DS|MSR_DE at l

And why don;t we need such an #ifdef here?

Quoted 3 lines

I found similar piece of code in start.S without any #define at label _start_cont. That's why i made it like this.
if required i will put it under #define.

Please handle in a consistent way. See above.

Quoted 4 lines
Quoted 1 line

Also, CONFIG_E500_V1_V2 is undocumented.

Definition of this #define is part of documentation. I will add comment before using it.

CONFIG_ options must be explained in the README.

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"I like your game but we have to change the rules."
#4 lore raw

PATCH 2/4 powerpc/85xx:Fix MSR[DE] bit in MSR to support debugger

Hi Wolfgang,

Sorry for delayed response.

Quoted 15 lines · Wolfgang Denk

Dear Prabhakar Kushwaha,

Quoted 12 lines · In message<[email protected]> you wrote:
Quoted 12 lines

arch/powerpc/cpu/mpc85xx/start.S line 89

Quoted 11 lines
arch/powerpc/cpu/mpc85xx/start.S +5 -0
@@ -82,6 +82,11 @@
   	.globl _start_e500
 
   _start_e500:
+#if defined(CONFIG_E500_V1_V2)
+/* Enable debug exception */
+	li	r1,MSR_DE
+	mtmsr 	r1
+#endif

Why is this #ifdef needed here?

Quoted 8 lines
Quoted 4 lines

This #ifdef is to make sure MSR_DE bit is set before u-boot's actual code start executing.
it is for overcoming one of the requirement of debugging i.e. Keep MSR_DE bit set.

Sorry, this makes no sense to me. The #ifdef does not change the order of execution, it just enables or disables the code. Are there any situations where omitting this code is required, or where it makes sense?

OK.
after having internal discussion about different processor support. we can make this code permanently enabled.

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

arch/powerpc/cpu/mpc85xx/start.S create_init_ram_area: · line 738

Quoted 8 lines
arch/powerpc/cpu/mpc85xx/start.S +2 -2
@@ -729,8 +734,8 @@ create_init_ram_area:
   	msync
   	tlbwe
 
-	lis	r6,MSR_IS|MSR_DS at h
-	ori	r6,r6,MSR_IS|MSR_DS at l
+	lis	r6,MSR_IS|MSR_DS|MSR_DE at h
+	ori	r6,r6,MSR_IS|MSR_DS|MSR_DE at l

And why don;t we need such an #ifdef here?

Quoted 4 lines
Quoted 3 lines

I found similar piece of code in start.S without any #define at label _start_cont. That's why i made it like this.
if required i will put it under #define.

Please handle in a consistent way. See above.

Sure,
I believe we should not have any #define for this piece of code to make it consistent across the file.

Quoted 4 lines
Quoted 3 lines
Quoted 1 line

Also, CONFIG_E500_V1_V2 is undocumented.

Definition of this #define is part of documentation. I will add comment before using it.

CONFIG_ options must be explained in the README.

I will take care of this

--Prabhakar