Subject: Re: bumping ASID
To: None <port-mips@netbsd.org>
From: Jason R Thorpe <thorpej@zembu.com>
List: port-mips
Date: 03/28/2000 07:55:22
On Tue, Mar 28, 2000 at 04:27:24PM +0900, Toru Nishimura wrote:

 > Got it.  I'll seek a solution to modify cpu_switch_resume() or
 > cpu_switch() rather than add "if (pmap == kernel_map())" conditional
 > in pmap_alloc_asid() because MIPS processor's "current ASID" is
 > updated as a side effect of setting TLB entry Hi/Lo pairs, and (ahem)
 > I'm not sure whether 'G' bit for pmap0 is (correctly) ensured for MIPS
 > pmap.c this moment. 

I would use the following approach:

	- cpu_switch() calls pmap_deactivate()/pmap_activate() like the
	  Alpha port does; you'll need to do this in order to support
	  multiprocessors (need to account for which CPUs a pmap is
	  active on).

	- pmap_activate() does MachSetPID(pmap->pm_asid).  Note in the
	  Alpha port, pmap_activate() actually copies the ASN to the
	  PCB, and then "switches" to itself; this is because the PALcode
	  is what does the equivalent of MachSetPID().

..and if the kernel mappings don't all have Global set, I'd call that
a definite bug that should be fixed immediately; otherwise, you have to
ensure that you MachSetPID(whatever the kernel is using) every time you
enter the kernel!

-- 
        -- Jason R. Thorpe <thorpej@zembu.com>