arm-trusted-firmware/bl31
Achin Gupta 5717aae1c3 Fix handling of spurious interrupts in BL3_1
There are couple of issues with how the interrupt routing framework in BL3_1
handles spurious interrupts.

1. In the macro 'handle_interrupt_exception', if a spurious interrupt is
   detected by plat_ic_get_pending_interrupt_type(), then execution jumps to
   'interrupt_exit_\label'. This macro uses the el3_exit() function to return to
   the original exception level. el3_exit() attempts to restore the SPSR_EL3 and
   ELR_EL3 registers with values from the current CPU context. Since these
   registers were not saved in this code path, it programs stale values into
   these registers. This leads to unpredictable behaviour after the execution of
   the ERET instruction.

2. When an interrupt is routed to EL3, it could be de-asserted before the
   GICC_HPPIR is read in plat_ic_get_pending_interrupt_type(). There could be
   another interrupt pending at the same time e.g. a non-secure interrupt. Its
   type will be returned instead of the original interrupt. This would result in
   a call to get_interrupt_type_handler(). The firmware will panic if the
   handler for this type of interrupt has not been registered.

This patch fixes the first problem by saving SPSR_EL3 and ELR_EL3 early in the
'handle_interrupt_exception' macro, instead of only doing so once the validity
of the interrupt has been determined.

The second problem is fixed by returning execution back to the lower exception
level through the 'interrupt_exit_\label' label instead of treating it as an
error condition. The 'interrupt_error_\label' label has been removed since it is
no longer used.

Fixes ARM-software/tf-issues#305

Change-Id: I81c729a206d461084db501bb81b44dff435021e8
2015-05-13 18:58:58 +01:00
..
aarch64 Fix handling of spurious interrupts in BL3_1 2015-05-13 18:58:58 +01:00
bl31.ld.S Remove coherent memory from the BL memory maps 2015-01-22 10:57:44 +00:00
bl31.mk Move bakery algorithm implementation out of coherent memory 2015-01-22 10:57:44 +00:00
bl31_main.c Rationalize console log output 2014-08-12 16:51:18 +01:00
context_mgmt.c Merge pull request #206 from soby-mathew/sm/reset_cntvoff 2014-10-10 12:13:48 +01:00
cpu_data_array.c Rework the crash reporting in BL3-1 to use less stack 2014-07-28 11:03:20 +01:00
interrupt_mgmt.c Demonstrate model for routing IRQs to EL3 2015-01-26 15:29:32 +00:00
runtime_svc.c Enable type-checking of arguments passed to printf() et al. 2015-03-06 13:07:43 +00:00