Yo:
max wrote:... Is it possible that the device only remembers data until it fires the next interrupt?
Yes, depending on the device, this may be the case. Depending on the device, it also may not. Most devices will not have an on-chip memory area where they preserve old event-data, so most devices will "overwrite" old event data when a new IRQ comes in.
Specifically:
gravaera wrote:However, the handler does not read any event data from the device, and it does not do a device-specific ACK either since if it ACKs the IRQ, it will lose any event-data that it needs to read. The handler simply returns a value to the kernel telling it that "This IRQ belongs to my device". The kernel will then also not ACK the IRQ at the interrupt controller, and it will form and dispatch a message to the driver process notifying it that an IRQ has occured. The kernel now exits IRQ context.
Keep in mind that Kevin also just outlined a very important point, which is that alternatively, you can mask the pin/MSI-slot off, then EOI the interrupt controller.
With the approach I proposed, only IRQ pins that have a higher priority than the one currently being handled would be delivered to the kernel while the current pin has not been ACKed/EOId, because you have not yet ACKed the interrupt controller, so it still has the active pin's bit set in the In-Service Register. Therefore, it will not deliver any other IRQs unless the pin is of a higher priority than the highest active pin in the In-Service register.
With Kevin's approach, you mask the pin that is currently being handled, then EOI the interrupt controller, effectively allowing all IRQ pins other than the one being handled to be delivered, since by EOI-ing the interrupt controller, you clear the pin's bit in the In-Service Register (i.e, the interrupt controller now doesn't know that it shouldn't deliver lower priority IRQs, because it doesn't know what priority it's currently sitting at).
Depending on your design goals and whether or not you actually need to respect IRQ-pin prioritization, you may find yourself desiring either approach. On the IBM-PC, it probably doesn't matter since you probably don't actually have any devices that can reasonably be said to be of higher real-time priority than others. That said, if you have a Gigabit ethernet card firing IRQs in a storm, and you also have a periodic timer IRQ firing IRQs at say 1KHz, you might not want to allow the ethernet card's IRQ to nest and pre-empt the timer IRQs, since timer IRQs being delayed will have a worse effect on the system than the ethernet card dropping a few frames.
--Peace out,
gravaera
17:56 < sortie> Paging is called paging because you need to draw it on pages in your notebook to succeed at it.