Reputation: 35
Apic is used for giving interrupts to processor.so how io devices use it to produce interrupt and who generates vector number for selecting suitable interrupt handler and how apic differentiates between io devices?
Upvotes: 0
Views: 312
Reputation: 12455
I/O devices in current systems generate interrupts in one of two ways: an interrupt message or a PCI interrupt. A PCI interrupt sends a signal to the I/O APIC, which converts it to an interrupt message. So either way, the interrupt comes into the APIC as an interrupt message. The vector number is part of the message. The OS programs the interrupt message into the I/O APIC or into the I/O device interrupt message table.
The APIC doesn't differentiate between I/O devices. The interrupt message tells it the vector number and which processor the message should be delivered to, but not what device the message came from.
You can see the interrupt message format in the APIC chapter of the software developers manual.
There is a lot more complexity involving the IOMMU, interrupt remapping, and posted interrupts, which I'm not going to get into here.
Upvotes: 3