Wednesday, December 6, 2017

Linux: Why use MSI over the GIC mechanism (Brief)

MSIs are implemented as a write from the device rasising the interrupt to a special memory location which causes raising of the MSI.

Two main reasons to consider MSI over PICs:

1. Speed: Pin based PCI interrupts are usually shared across devices and hence we would typically need to invoke each associated interrupt handler. MSIs are not shared so this does not arise.
Another case is that PCI can only support single interrupt per function. In this case drivers have to explicitly check what event happened (e.g. tx done, rx etc for a single MAC interrupt in case of Wifi radios). Using MSI, there could be a dedicated interrupt for each type of event (from the MAC).


2. Consistency: In case of pin based interrupts, the interrupt may be raised before the complete data has arrived in memory. There are ways to work around this. However, in case of MSIs this is not a concern since MSI writes cannot pass data writes on the bus.

Reference:
Linux Kernel Documentation - https://www.kernel.org/doc/Documentation/PCI/MSI-HOWTO.txt