Skip to contentSkip to conversation

85xx: Don't move interrupt vector to low memory

PATCH New Kumar Gala 4 participants 12 messages Aug 6, 2008

lore
Share & tools
lore

Kumar Gala

author
#0 lore raw

PATCH 1/1 85xx: Don't move interrupt vector to low memory

Moving the interrupt vectors to low memory can cause issues if the code gets overwritten via some image loading command (tftp, boot*, etc.) and interrupts (like the decrementer are enabled).

On 85xx there is no reason to copy the interrupt vectors to low memory since we can run them in high memory since we are a Book-E core.

---

This is a fix for 1.3.4.

- k

 cpu/mpc85xx/start.S |   19 +++++--------------
 1 files changed, 5 insertions(+), 14 deletions(-)
cpu/mpc85xx/start.S +5 -14
index 10fe936..9c8b2a1 100644
@@ -936,13 +936,6 @@ trap_init:
 	bgelr				/* return if r7>=r8 - just in case */
 
 	mflr	r4			/* save link register		*/
-1:
-	lwz	r0,0(r7)
-	stw	r0,0(r9)
-	addi	r7,r7,4
-	addi	r9,r9,4
-	cmplw	0,r7,r8
-	bne	1b
 
 	/*
 	 * relocate `hdlr' and `int_return' entries
@@ -973,9 +966,6 @@ trap_init:
 	cmplw	0,r7,r8
 	blt	2b
 
-	lis	r7,0x0
-	mtspr	IVPR,r7
-
 	mtlr	r4			/* restore link register	*/
 	blr
 
@@ -983,13 +973,14 @@ trap_init:
 	 * Function: relocate entries for one exception vector
 	 */
 trap_reloc:
-	lwz	r0,0(r7)		/* hdlr ...			*/
+	lwzx	r0,r3,r7		/* hdlr ...			*/
 	add	r0,r0,r3		/*  ... += dest_addr		*/
-	stw	r0,0(r7)
+	stwx	r0,r3,r7
 
-	lwz	r0,4(r7)		/* int_return ...		*/
+	addi	r7,r7,4
+	lwzx	r0,r3,r7		/* int_return ...		*/
 	add	r0,r0,r3		/*  ... += dest_addr		*/
-	stw	r0,4(r7)
+	stwx	r0,r3,r7
 
 	blr
 
Signature · 1 line
1.5.5.1
#1 lore raw

PATCH 1/1 85xx: Don't move interrupt vector to low memory

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

Moving the interrupt vectors to low memory can cause issues if the code gets overwritten via some image loading command (tftp, boot*, etc.) and interrupts (like the decrementer are enabled).

Oops? This is expected and normal behaviour. Did anybody complain about this?

Quoted 2 lines

On 85xx there is no reason to copy the interrupt vectors to low memory since we can run them in high memory since we are a Book-E core.

High memory means leave them in flash?

Then you will probably see nice crashes as soon as you erase U-Boot for example to install a new version.

All references to flash memory must be relocated to RAM, including the exception vectors, of course.

Quoted 4 lines

---

This is a fix for 1.3.4.

I don't think so. Seems to introduce a bug.

Best regards,

Wolfgang Denk

Signature · 8 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
"It follows that any commander in chief who undertakes to carry out a
plan which he considers defective is at fault; he must put forth  his
reasons,  insist  of  the  plan being changed, and finally tender his
resignation rather than be the instrument of his army's downfall."
- Napoleon, "Military Maxims and Thought"
author
#2 lore raw

PATCH 1/1 85xx: Don't move interrupt vector to low memory

Quoted 10 lines · Wolfgang Denk

In message <Pine.LNX.

Quoted 5 lines · 4.64.0808060127560.20220 at blarg.am.freescale.net> you wrote:

Moving the interrupt vectors to low memory can cause issues if the code
gets overwritten via some image loading command (tftp, boot*, etc.) and
interrupts (like the decrementer are enabled).

Oops? This is expected and normal behaviour. Did anybody complain about this?

Real, any reason why? I understand on classic PPC this might be the case but I see no reason for it to be so on book-e parts.

Quoted 5 lines
Quoted 3 lines

On 85xx there is no reason to copy the interrupt vectors to low memory
since we can run them in high memory since we are a Book-E core.

High memory means leave them in flash?

No I leave them at the relocated location in DDR.

Quoted 5 lines

Then you will probably see nice crashes as soon as you erase U-Boot for example to install a new version.

All references to flash memory must be relocated to RAM, including the exception vectors, of course.

Any they are. I'm just removing a second relocation that is a hold over from how 6xx PPC exception vectors work.

Quoted 6 lines
Quoted 4 lines

---

This is a fix for 1.3.4.

I don't think so. Seems to introduce a bug.

I disagree with that. It resolved a bug when I did. 'setenv autostart no; bootm'

- k

#3 lore raw

PATCH 1/1 85xx: Don't move interrupt vector to low memory

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

Oops? This is expected and normal behaviour. Did anybody complain about this?

Real, any reason why? I understand on classic PPC this might be the case but I see no reason for it to be so on book-e parts.

Well, one reason might be to have identical code for all PPC systems ?

Quoted 3 lines
Quoted 1 line

High memory means leave them in flash?

No I leave them at the relocated location in DDR.

Ah, I see.

Quoted 5 lines
Quoted 2 lines

All references to flash memory must be relocated to RAM, including the exception vectors, of course.

Any they are. I'm just removing a second relocation that is a hold over from how 6xx PPC exception vectors work.

Not only 6xx. Actually all PPC.

Quoted 4 lines
Quoted 1 line

I don't think so. Seems to introduce a bug.

I disagree with that. It resolved a bug when I did. 'setenv autostart no; bootm'

That might be a problem only when using your broken autostart patches.

We will fix this by backing out that patch ;-)

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
Madness takes its toll. Please have exact change.
#4 lore raw

PATCH 1/1 85xx: Don't move interrupt vector to low memory

Quoted 4 lines · Wolfgang Denk
Quoted 3 lines · In message <[email protected]> you wrote:
Quoted 3 lines

Oops? This is expected and normal behaviour. Did anybody complain about this?

It's hit me before when I foolishly try to load something at address zero -- why do we put u-boot at the end of RAM, and put up with the relocation weirdness, if not to allow loading things at zero?

Quoted 4 lines
Quoted 2 lines

Real, any reason why? I understand on classic PPC this might be the case but I see no reason for it to be so on book-e parts.

Well, one reason might be to have identical code for all PPC systems ?

It's already 85xx-specific code.

Quoted 4 lines
Quoted 2 lines

Any they are. I'm just removing a second relocation that is a hold over from how 6xx PPC exception vectors work.

Not only 6xx. Actually all PPC.

No, not all PPC. Book-E exceptions are different.

-Scott

#5 lore raw

PATCH 1/1 85xx: Don't move interrupt vector to low memory

Quoted 15 lines · Scott Wood
Quoted 3 lines · Wolfgang Denk
Quoted 2 lines · In message <[email protected]> you wrote:
Quoted 2 lines

Oops? This is expected and normal behaviour. Did anybody complain about this?

It's hit me before when I foolishly try to load something at address zero -- why do we put u-boot at the end of RAM, and put up with the relocation weirdness, if not to allow loading things at zero?

Quoted 3 lines
Quoted 2 lines

Real, any reason why? I understand on classic PPC this might be the case but I see no reason for it to be so on book-e parts.

Well, one reason might be to have identical code for all PPC systems ?

It's already 85xx-specific code.

Quoted 7 lines
Quoted 3 lines
Quoted 2 lines

Any they are. I'm just removing a second relocation that is a hold over from how 6xx PPC exception vectors work.

Not only 6xx. Actually all PPC.

No, not all PPC. Book-E exceptions are different.

-Scott

One nice thing about not relocating the exception vectors to 0 is that it would allow us to recover from a failed bootm all the way up to the jump to linux (or whomever) rather than having to reset the board to recover from a failure late in the bootm sequence.

Unfortunately, it would be Book-E specific and probably not worth coding Yet Another Special Case in the already overcomplex bootm code.

Best regards,
gvb

#6 lore raw

PATCH 1/1 85xx: Don't move interrupt vector to low memory

In reply to Scott Wood
Quoted 4 lines · In message <[email protected]> you wrote:

It's hit me before when I foolishly try to load something at address zero -- why do we put u-boot at the end of RAM, and put up with the relocation weirdness, if not to allow loading things at zero?

We want to free as much memory as possible. But low RAM cannot be made available on all systems.

Quoted 3 lines
Quoted 1 line

Well, one reason might be to have identical code for all PPC systems ?

It's already 85xx-specific code.

Good point. Why don't we factor this out and make it common code for all PPC?

Quoted 3 lines
Quoted 1 line

Not only 6xx. Actually all PPC.

No, not all PPC. Book-E exceptions are different.

Maybe. But then, these can use exception vectors at low mem, too, right?

For me the chance to have common code (and identical behaviour) for all PowerPC processors is much more important that being able to use 16 kB additional memory on one specific family of processors.

Best regards,

Wolfgang Denk

Signature · 5 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
He'd been wrong, there _was_ a light at the end of the tunnel, and it
was a flamethrower.                         - Terry Pratchett, _Mort_
author
#7 lore raw

PATCH 1/1 85xx: Don't move interrupt vector to low memory

Quoted 10 lines · Wolfgang Denk

In message <[email protected]> you

Quoted 4 lines · wrote:

It's hit me before when I foolishly try to load something at address zero -- why do we put u-boot at the end of RAM, and put up with the relocation weirdness, if not to allow loading things at zero?

We want to free as much memory as possible. But low RAM cannot be made available on all systems.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Well, one reason might be to have identical code for all PPC systems ?

It's already 85xx-specific code.

Good point. Why don't we factor this out and make it common code for all PPC?

Because the relocation is specific to the various interrupt types. Book-E will need different code for handing IVPR/IVORs than classic.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Not only 6xx. Actually all PPC.

No, not all PPC. Book-E exceptions are different.

Maybe. But then, these can use exception vectors at low mem, too, right?

They can, but it has to be setup.

Quoted 3 lines

For me the chance to have common code (and identical behaviour) for all PowerPC processors is much more important that being able to use 16 kB additional memory on one specific family of processors.

- k

#8 lore raw

PATCH 1/1 85xx: Don't move interrupt vector to low memory

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

Good point. Why don't we factor this out and make it common code for all PPC?

Because the relocation is specific to the various interrupt types. Book-E will need different code for handing IVPR/IVORs than classic.

Umm... the exception code itself may be different, but does this imply that the code used to copy / relocate the exception handlers to low mem must be different, too?

Quoted 4 lines
Quoted 2 lines

Maybe. But then, these can use exception vectors at low mem, too, right?

They can, but it has to be setup.

What is Linux doing?

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
Life is a game. Money is how we keep score.              - Ted Turner
author
#9 lore raw

PATCH 1/1 85xx: Don't move interrupt vector to low memory

Quoted 6 lines · Wolfgang Denk

In message <9D199630-11FA-4028-8EE6-

Quoted 4 lines · CBC59F6F67A0 at kernel.crashing.org> you wrote:
Quoted 3 lines

Good point. Why don't we factor this out and make it common code for all PPC?

Quoted 6 lines
Quoted 2 lines

Because the relocation is specific to the various interrupt types. Book-E will need different code for handing IVPR/IVORs than classic.

Umm... the exception code itself may be different, but does this imply that the code used to copy / relocate the exception handlers to low mem must be different, too?

the copying bit should be do-able in generic code.

74xx_7xx/mpc512x/mpc5xx/mpc8xx/mpc8220/mpc824x/mpc83xx/mpc86xx:

copy from [_start, _end_of_vectors] to 0x100

4xx/85xx:

copy from [_start_of_vectors, _end_of_vectors] to 0x100

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

Maybe. But then, these can use exception vectors at low mem, too, right?

They can, but it has to be setup.

What is Linux doing?

don't follow the question.. what is linux doing with what?

- k

#10 lore raw

PATCH 1/1 85xx: Don't move interrupt vector to low memory

Quoted 9 lines · In message <[email protected]> you wrote:
Quoted 6 lines
Quoted 2 lines

Book-E will need different code for handing IVPR/IVORs than classic.

Umm... the exception code itself may be different, but does this imply that the code used to copy / relocate the exception handlers to low mem must be different, too?

the copying bit should be do-able in generic code.

Quoted 7 lines

74xx_7xx/mpc512x/mpc5xx/mpc8xx/mpc8220/mpc824x/mpc83xx/mpc86xx:

copy from [_start, _end_of_vectors] to 0x100

4xx/85xx:

copy from [_start_of_vectors, _end_of_vectors] to 0x100

OK, that's what I exoected. So we should plan to factor out this part of code one day.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

Maybe. But then, these can use exception vectors at low mem, too, right?

They can, but it has to be setup.

What is Linux doing?

don't follow the question.. what is linux doing with what?

Where is Linux setting up exception vectors on these systems?

Best regards,

Wolfgang Denk

Signature · 5 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
"We shall reach greater and greater platitudes of achievement."
- Richard J. Daley
author
#11 lore raw

PATCH 1/1 85xx: Don't move interrupt vector to low memory

Quoted 27 lines · Wolfgang Denk

In message <D5CA3AB9-3AE3-439C-A169-

Quoted 11 lines · F8CD26D4A320 at kernel.crashing.org> you wrote:
Quoted 8 lines
Quoted 3 lines

Book-E will need different code for handing IVPR/IVORs than classic.

Umm... the exception code itself may be different, but does this imply
that the code used to copy / relocate the exception handlers to low mem must be different, too?

the copying bit should be do-able in generic code.

Quoted 7 lines

74xx_7xx/mpc512x/mpc5xx/mpc8xx/mpc8220/mpc824x/mpc83xx/mpc86xx:

copy from [_start, _end_of_vectors] to 0x100

4xx/85xx:

copy from [_start_of_vectors, _end_of_vectors] to 0x100

OK, that's what I exoected. So we should plan to factor out this part of code one day.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 2 lines

Maybe. But then, these can use exception vectors at low mem, too, right?

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

They can, but it has to be setup.

What is Linux doing?

don't follow the question.. what is linux doing with what?

Where is Linux setting up exception vectors on these systems?

they are at 0 for 6xx/8xx/40x systems. They can be anywhere on 85xx/ 44x (and we take advantage of this).

- k