Skip to contentSkip to conversation

4xx critical exceptions

DISCUSSION Brian Kuschak 3 participants 3 messages Dec 4, 2002 – Dec 6, 2002

lore
Share & tools
lore
#0 lore raw

I've seen a few postings regarding critical exceptions on the 405GP, but I don't see anything new in the linuxppc_2_5 versions of the relevant files.

I'm interested in using the watchdog interrupt as a critical exception. I have somthing that sort-of works, in that I get wdt interrupts and service them appropriately, but I'm getting panics on a regular basis.

The COMMON_PROLOG in head_4xx.S uses SPRG0,1 to temporarily save r20, r21 for scratch use. Problem is this prologue is used for both critical and non-critical interrupts. As I understand it, MSR[EE] is cleared for external interrupts, but MSR[CE] is not. If a critical interrupt occurs while handling a non-critical interrupt, the SPRG0,1 can be overwritten while handling the critical interrupt.

I'm guessing we don't have any unused SPRGx registers to use here. I was thinking about temporarily disabling CE until saving SPRG0,1, but that can't be done without using at least one register, and none of them are saved at that point.

Any ideas?

Regards,
Brian

P.S. BTW, is bk://ppc.bkbits.net/linuxppc_2_5 the right place for the latest 2.5 code?

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

#1 lore raw

On Wed, Dec 04, 2002 at 03:00:47PM -0800, Brian Kuschak wrote:

<snip>

Quoted 9 lines

The COMMON_PROLOG in head_4xx.S uses SPRG0,1 to temporarily save r20, r21 for scratch use. Problem is this prologue is used for both critical and non-critical interrupts. As I understand it, MSR[EE] is cleared for external interrupts, but MSR[CE] is not. If a critical interrupt occurs while handling a non-critical interrupt, the SPRG0,1 can be overwritten while handling the critical interrupt.

Quoted 7 lines

I'm guessing we don't have any unused SPRGx registers to use here. I was thinking about temporarily disabling CE until saving SPRG0,1, but that can't be done without using at least one register, and none of them are saved at that point.

Any ideas?

The linuxppc-2.5 tree has a (partial) implementation of critical exceptions. The method used is to save the registers into a region preallocated in head_*.S.

Quoted 2 lines

P.S. BTW, is bk://ppc.bkbits.net/linuxppc_2_5 the right place for the latest 2.5 code?

That's a dead tree. You want bk://ppc.bkbits.net/linuxppc-2.5

Regards,
--
Matt Porter
[email protected]
This is Linux Country. On a quiet night, you can hear Windows reboot.

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

#2 lore raw
In reply to Brian Kuschak
Quoted 6 lines · Brian Kuschak

I'm interested in using the watchdog interrupt as a critical exception. I have somthing that sort-of works, in that I get wdt interrupts and service them appropriately, but I'm getting panics on a regular basis.

I thought this was strange as I had seen a watchdog driver in the kernel for 405 but after reading the source of said driver I no longer think that:(

I have not tried the driver but from the look of it I would say it's not doing anything useful.

Quoted 7 lines

I'm guessing we don't have any unused SPRGx registers to use here. I was thinking about temporarily disabling CE until saving SPRG0,1, but that can't be done without using at least one register, and none of them are saved at that point.

Any ideas?

Not really. Do you want to try to set up a c environment or do you plan on just doing the thing in asm directly? The code in the exception handler do not have to do much something like

if(wdt_count++ < max_wdt_loops)

	clear_wdt_ENW();

return

should do. Then if userspace or whatever it is that kicks the dog has not reset the wdt_count we let the hardware just do the reset.

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/