Re-entrant IRQ handler for A53

Hello all,

I have a A53 based platform. There are multiple IRQ sources, some of which fire at the same time. To avoid recursive IRQ handler calls, I have disabled IRQs' on entry in IRQ handler and enabled them befor exit. However, at one point, there is a IRQ pending while I am in IRQ handler and as soon as I re-enable IRQ's, the IRQ handler is called again. This time core thinks that ELR should hold (PC+4) which is beyond the return statement of IRQ handler. Everything goes haywire from there. My code:


__irq void irqHandler(void)
{
  unsigned int ID;

  __disable_irq();
  __isb(0xF);
  __dsb(0xF);

  ID = readAliasedIntAck();
  // Run specific handler
  writeAliasedEOI(ID);
  __enable_irq();     // <--- Second interrupt processed here, resulting in a call to irqHandler.

  return;
}
<-------- ELR points here


1) Is there any way I can ensure that IRQs' are not serviced untill I exit the handler?
2) Do I *have* to write a re-entrant IRQ handler?
3) If yes, is the code available online since this is a pretty standard use-case?

Thanks a lot for helping.

More questions in this forum