Edge triggered line sharing

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
devsau
Member
Member
Posts: 35
Joined: Thu Jun 13, 2013 12:07 pm

Edge triggered line sharing

Post by devsau »

Edge semantics mean a billion different things but this question is mostly based on pc/at x86 architecture using an ioapic. Not the isa 8259 or eisa pic.

This isn't something I plan to implement or do, it is a question based purely on curiosity.

Since the ioapic recognizes edges at a well defined point in time (bottom or top of it's clock), the datasheet says that subsequent edges will not be recognized or generate interrupt cycles until the target cpu(s) has accepted it onto it's IRR.

Theoretically speaking then, since we are still at the beginning of our interrupt service routine dispatch, we could still run the entire IRQ chain for that line. (like when 2 pci devices share a line, we run both routines to see who needs attention.)

This leads me to believe that some edge triggered devices, could possibly malfunction if their device registers are read when it really didn't assert it's line. Is that one of the reasons?
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Edge triggered line sharing

Post by Combuster »

If you configure the I/O APIC according to the specifications (provided by ACPI and co), none of this is really an issue.

Edge triggered (legacy devices) can't do proper interrupt sharing, nor were they designed for it. The result is that if you do get an interrupt, you'll be free to interrogate the device in question because you know it's responsible.

Secondly, for several devices, reading the IRQ register will tell you if there was a pending bit, and clear that bit the moment you read it. Therefore if you do read it, you can always respond properly, even if it wasn't from an interrupt context, so mixed reading might not even be an issue.

The only remaining problem is one of missed interrupts when you get two events before you make the time to handle them - but this is typically a programming error because it means you weren't fast enough to handle the IRQ in the first place. Also, there's nothing here that edge/level triggering fixes for you.

At the other end of the story, PCI hardware is level triggered and shared by design. Therefore hardware manufacturers should have built the I/O interface in such a fashion that querying an idle device doesn't do any harm.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Post Reply