[Xenomai-core] Error propagating ISR to Linux domain

2008-07-16 Thread Benjamin ZORES
Hi,

I've encountered a little problem when trying to propagate an ISR from 
Xenomai to Linux context.

To sum up clearly, I'm writing an RT kernel module that drives a PCI card.
I've registered a nucleus ISR handler on the IRQ attributed to this card.

On some systems, this IRQ is dedicated to this PCI card only.
Though, on others, it is shared with other peripherals.
Hence, I need to forward/propagate this IRQ to Linux domain for other 
drivers to handle it
when the IRQ has not been initiated by my PCI card.

My RT ISR code looks like the following:

int my_isr_handler (xnintr_t *irq)
{
... /* handling */
   return XN_ISR_HANDLED | XN_ISR_PROPAGATE;
}

While this code works perfectly when the IRQ number is really shared 
among peripherals,
when I use it on system where this IRQ is dedicated to RT only (i.e. not 
used by Linux),
then, the IRQ is never acknowledged.

In other words, I see a bug when returning XN_ISR_PROPAGATE on a system 
where
no Linux driver has registered a handler for this IRQ.
Is this something known and is there some workaround (I'm using 2.6.23 + 
lastest Adeos + Xenomai 2.4.4 on x86_32) ???

A quick and dirty workaround is to create a dummy Linux IRQ handler 
(doing so acknowledge my propagated IRQ) but:
 - if it returns IRQ_NONE, then Linux discard the IRQ line after having 
missed 10 of them (on system where the IRQ is dedicated)
 - if it returns IRQ_HANDLED, then I have no guarantee that this dumym 
handler won't get called before the legacy drivers that need it.

Or maybe there is a way in Xenomai to know that any subdomain (like 
Linux) has registered a handler for this given IRQ ??

Any help would be appreciated,

Ben

___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] Error propagating ISR to Linux domain

2008-07-16 Thread Jan Kiszka
Benjamin ZORES wrote:
 Hi,
 
 I've encountered a little problem when trying to propagate an ISR from 
 Xenomai to Linux context.
 
 To sum up clearly, I'm writing an RT kernel module that drives a PCI card.
 I've registered a nucleus ISR handler on the IRQ attributed to this card.
 
 On some systems, this IRQ is dedicated to this PCI card only.
 Though, on others, it is shared with other peripherals.
 Hence, I need to forward/propagate this IRQ to Linux domain for other 
 drivers to handle it
 when the IRQ has not been initiated by my PCI card.

If you also need deterministic IRQ handling in the shared case, that
approach won't fly. It may work to some degree if there are significant
gaps between the individual IRQs, so significant that one can assume
Linux will always be reactive enough to handle the last forwarded IRQ
(and thus release the line before the RT event arrives).

The only truly deterministic solution is to write minimal IRQ handlers
for the involved Linux devices in RT space, ie. for Xenomai. RT-IRQ
sharing works nicely.

Jan

-- 
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux

___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core