SPRZ452I july 2018 – may 2023 AM6526 , AM6528 , AM6546 , AM6548
R5FSS: The Same Interrupt Cannot be Nested Back-2-Back Within
Another Interrupt
The nesting (preemption) of the same high priority interrupt inside a low priority interrupt is not possible for the second and subsequent times. The second occurrence of the high priority interrupt has to wait until the program exits the lower priority interrupt service routine (ISR). The issue only occurs if the high priority interrupt following a current preemption is the same as the one which caused the original preemption. If a different interrupt preempts the low priority ISR before the second occurrence of the original higher priority interrupt then there is no issue. This issue impacts both Vector Interface Method and MMR Interface Method of interrupt handling in VIM. The issue impacts both FIQ and IRQ interrupts.
A software workaround exists. The objective of the SW workaround is to prevent back-2-back activation of the same interrupt, thereby removing the necessary condition of the bug. This can be achieved by reserving the highest priority level (Priority-0), and using that priority for a dummy interrupt (any one out of 512 interrupts available in R5FSS), and calling this dummy interrupt inside every ISR. Further, the R5FSS core itself need not enter this dummy ISR (it can be masked), only the handshake with VIM around this dummy ISR needs to happen.
A sample pseudo-code is shown below. If required, TI can provide the necessary drivers which implement this workaround.
any_isr_routine {
...
1: set I/F bit in CPSR ; //so R5FSS cannot be interrupted again. I for irq, F for fiq
2: Trigger dummy_intr; //writing 1'b1 to Interrupt RAW Status/Set Register bit in VIM corresponding to the chosen dummy_intr
3: rd_irqvec; //Read IRQVEC register in VIM to acknowledge dummy_isr
4: clear dummy_isr; //writing 1'b0 to Interrupt RAW Status/Set Register bit in VIM corresponding to the chosen dummy_intr
5: wr_irqvec;//Write to IRQVEC register in VIM to denote end of interrupt
6: clear I/F bit in CPSR;
…
}
Note: Depending on where the workaround code is inserted in the ISR, step 1 & 6 may not be needed.
The draw-backs with this workaround are, Priority-0 cannot be used (only Priority 1-15 are available), and the added latency in ISR execution.