Subject: Re: Interrupts problem
To: Jean-Francois Boudreault <jfboudre@gel.ulaval.ca>
From: Jachym Holecek <freza@dspfpga.com>
List: port-powerpc
Date: 09/01/2006 03:14:03
Hello Jean-Francois,

# Jean-Francois Boudreault 2006-08-31:
> I have a problem with custom hardware interruptions.
> 
> I'm currently designing custom network device. I'm using Jachym's port 
> on virtex fpga with the console on the serial port. I have a driver 
> which allocate dma memory on initialization. I use a callout function 
> called every 30ms that simply write 32bits dma memory address to a 
> register of the custom device to initiate a network transfert (which 
> take <1ms). As soon transfert is completed, the custom device sends an 
> interruption which call my driver's interruption routine that reset the 
> callout to another 30ms.

This is not the best way to archieve high throughput... you might want
to enqueue new packet from the "transfer done" interrupt handler. Well,
ideally you'd want to come up with a smart DMA engine that does most
of the work for you :-)

> On booting, I see packets going out of the custom device every 30ms as 
> expected. But as soon the system is booted and my console started ('sh' 
> called in single-user mode), it takes about 400ms to receive 
> interruption from the custom device. Then if I give input to the console 
> (simply press and hold ENTER key) I get back 30ms response from device.

Hmm, I'd suspect interrupt priority masks are incorrectly calculated.
What IPL are you running at? Also, as Tim noted, the problem could
be deeper down in interrupt handling code (though I've never seen the
behaviour you describe on the Virtex). It would be useful to add some
diagnostic printfs to ext_intr (print interrupt status register at the
begging and end of the function, also print active interrupt mask at
both points) and intr_calculatemasks (print all masks after they're
recalculated).

This will produce a huge log -- you'll probably want to analyze just
the parts where you stop receiving interrupts and then the point when
they start working again...

FYI, I expect a hugely reworked evbppc/virtex to be commited, ummm,
real soon now :-)

	-- Jachym