Subject: Improving softints
To: None <port-sparc@netbsd.org>
From: Eduardo E. Horvath <eeh@one-o.com>
List: port-sparc
Date: 03/12/2000 17:53:29
The current situation with regards to soft interrupts is a mess.  All
the drivers have something like this in them:

	if( needsoftint ) {	/* trigger the soft interrupt */
#if defined(SUN4M)
		if( CPU_ISSUN4M )
			raise(0, PIL_TTY);
		else
#endif
			ienab_bis(IE_MSOFT);
	}

In addition to being interestingly named, the interfaces are not
very consistent.

I'm planning on switching the sparc64 port over to a new interface:

void send_softint __P((int cpu, int level, struct intrhand *handler));

cpu is the CPU number, -1 is this CPU, and -2 is any CPU.
level is the numerical interrupt level, 1..15.
handler is a ponter to the intrhand structure to be queued.  If
	it's NULL then an interrupt is generated but no particular
	vector is set and the dispatcher must poll all interrupt
	handlers at that level until one claims the interrupt.

This should reduce the overhead in interrupt dispatch since the
dispatcher will not have to traverse a linked list and poll each of
the different interrupt handlers to see which one the interrupt
belongs to.

On the related subject of cross-calls, since the routines will
probably need to be coded in assembly (we don't really want to go
through the overhead of calling C code) it's probably best to leave
them till later.  A simple cross-call implementation would be to use
this interface to send softints that do the appropriate thing to all
other CPUs.  Hm... maybe I should enhance the interface so -3 sends
the interrupt to all otehr CPUs.  (The multiple CPU stuff is not yet
implemented so it doesn't really matter yet.

Would it be possible to change the code so the drivers could call a
single routine and we could hide the machine dependencies inside it?

=========================================================================
Eduardo Horvath				eeh@netbsd.org
	"I need to find a pithy new quote." -- me