arm-trusted-firmware/include
Dimitris Papastamos a1781a211a Workaround for CVE-2017-5715 on Cortex A73 and A75
Invalidate the Branch Target Buffer (BTB) on entry to EL3 by
temporarily dropping into AArch32 Secure-EL1 and executing the
`BPIALL` instruction.

This is achieved by using 3 vector tables.  There is the runtime
vector table which is used to handle exceptions and 2 additional
tables which are required to implement this workaround.  The
additional tables are `vbar0` and `vbar1`.

The sequence of events for handling a single exception is
as follows:

1) Install vector table `vbar0` which saves the CPU context on entry
   to EL3 and sets up the Secure-EL1 context to execute in AArch32 mode
   with the MMU disabled and I$ enabled.  This is the default vector table.

2) Before doing an ERET into Secure-EL1, switch vbar to point to
   another vector table `vbar1`.  This is required to restore EL3 state
   when returning from the workaround, before proceeding with normal EL3
   exception handling.

3) While in Secure-EL1, the `BPIALL` instruction is executed and an
   SMC call back to EL3 is performed.

4) On entry to EL3 from Secure-EL1, the saved context from step 1) is
   restored.  The vbar is switched to point to `vbar0` in preparation to
   handle further exceptions.  Finally a branch to the runtime vector
   table entry is taken to complete the handling of the original
   exception.

This workaround is enabled by default on the affected CPUs.

NOTE
====

There are 4 different stubs in Secure-EL1.  Each stub corresponds to
an exception type such as Sync/IRQ/FIQ/SError.  Each stub will move a
different value in `R0` before doing an SMC call back into EL3.
Without this piece of information it would not be possible to know
what the original exception type was as we cannot use `ESR_EL3` to
distinguish between IRQs and FIQs.

Change-Id: I90b32d14a3735290b48685d43c70c99daaa4b434
Signed-off-by: Dimitris Papastamos <dimitris.papastamos@arm.com>
2018-01-11 10:26:15 +00:00
..
bl1 FWU: Introduce FWU_SMC_IMAGE_RESET 2017-06-01 14:52:12 +01:00
bl31 BL31: Program Priority Mask for SMC handling 2017-11-13 07:49:30 +00:00
bl32 bl32: add secure interrupt handling in AArch32 sp_min 2017-08-09 15:48:53 +02:00
common Workaround for CVE-2017-5715 on Cortex A57 and A72 2018-01-11 10:26:15 +00:00
drivers Merge pull request #1145 from etienne-lms/rfc-armv7-2 2017-11-23 23:41:24 +00:00
lib Workaround for CVE-2017-5715 on Cortex A73 and A75 2018-01-11 10:26:15 +00:00
plat Move TSP to TZC secured DRAM 2018-01-03 10:21:26 +00:00
services SPM: Rename SP_COMMUNICATE macros 2017-12-05 10:31:21 +00:00
tools_share Support Trusted OS firmware extra images in TF tools 2017-08-09 18:06:05 +08:00