I am currently trying to understand the relationship between the different ways to mask/disable interrupts on the ARM architecture using either the GIC or the cps instructions.
So far I gathered the following:
cpscan be used to enable/disable the interrupts for a processor. Usingcpsid idisables all interrupts for the processor which issued the instruction (by setting thecpsrregister), and usingcpsie ienables interrupts. This does not change any state of the Interrupt Distributor or the CPU Interfaces.- Specific interrupts can be masked by writing
1to the corresponding bit in one of theGICD_ICENABLERnregisters in the Interrupt Distributor. - Specific interrupts can also be disabled by setting no targets in the Interrupt distributor.
Is this understanding correct so far?
Now I am currently unclear how these methods relate to one another. I assume the following:
If interrupts are disabled using the cpsr register, and then any kind of interrupt signaled (no matter if level or edge triggered), then the cpu interface will be notified of the interrupt (assuming it is set as a target), which changes the state of the interrupt to pending. Then as soon as a cpsie i instruction is issued, the processor will switch to interrupt handling.
However, if an interrupt is globally disabled by setting no targets, and an edge triggered interrupt is signaled, the CPU Interface will not change its state. Therefore, if the targets are later changed, the interrupt will not be signaled to any CPU Interface (as the trigger is not active anymore). This would mean, that edge triggered interrupts are lost in this case. For level triggered interrupts, these would only be signaled to the CPU Interfaces, if the interrupt line is still asserted. Is this correct? Or does the Distributor "remember" the state and if the interrupt has been signaled, so that in both cases the interrupt will later be distributed?
Now if the interrupt is masked, again it will not be distributed to any CPU Interface. In that case, however, I would expect the interrupt to be distributed later upon unmasking.
ARM Generic Interrupt Controller Architecture SpecificationorARM Accredited Engineer Study Guidea shot? - auselen