Subject: Re: Panic on suspend
To: M. Warner Losh <imp@bsdimp.com>
From: Markus Hennecke <markus.hennecke@fh-swf.de>
List: port-hpcmips
Date: 03/05/2004 12:10:31
On Fri, 20 Feb 2004, M. Warner Losh wrote:

> Yes.  However, the panic of TLB not in universe is one that takes a
> great deal of time and effort to understand since it is in, effect, a
> 'can't happen' bug.  I've only ever been able to understand one of
> these panics I've received.  It was caused by a bad memory access of a
> free'd pointer which lead to bogus stuff being written to the TLB.  By
> the time I understood it, the bug no longer existed in the -current
> sources.

I have found the bug. Executing the suspend instruction seems to change
the TLB entries, if I save the TLB entries right before this instruction
and restore them afterwards the device will suspend and wake up like it
should.

For now I have written functions saveTLB and restoreTLB in
locore_machdep.S and use them like this in hpcapm.c:
	saveTLB();
	__asm(".set noreorder");
	__asm(".word	" ___STRING(VR_OPCODE_SUSPEND));
	__asm("nop");
	__asm("nop");
	__asm("nop");
	__asm("nop");
	__asm("nop");
	__asm(".set reorder");
	restoreTLB();

Is there a better place than locore_machdep.S to put these functions? Or
are there functions doing the same already in the kernel sources? I
could not find them...

It would be nice if anyone having more expirience with mips programming
could take a look at what I have done and test it with other devices.
Please contact me offlist and I will send the diffs.

Greetings
  Markus