arm-trusted-firmware/lib
Antonio Nino Diaz 3e318e4037 xlat v2: Flush xlat tables after being modified
During cold boot, the initial translation tables are created with data
caches disabled, so all modifications go to memory directly. After the
MMU is enabled and data cache is enabled, any modification to the tables
goes to data cache, and eventually may get flushed to memory.

If CPU0 modifies the tables while CPU1 is off, CPU0 will have the
modified tables in its data cache. When CPU1 is powered on, the MMU is
enabled, then it enables coherency, and then it enables the data cache.
Until this is done, CPU1 isn't in coherency, and the translation tables
it sees can be outdated if CPU0 still has some modified entries in its
data cache.

This can be a problem in some cases. For example, the warm boot code
uses only the tables mapped during cold boot, which don't normally
change. However, if they are modified (and a RO page is made RW, or a XN
page is made executable) the CPU will see the old attributes and crash
when it tries to access it.

This doesn't happen in systems with HW_ASSISTED_COHERENCY or
WARMBOOT_ENABLE_DCACHE_EARLY. In these systems, the data cache is
enabled at the same time as the MMU. As soon as this happens, the CPU is
in coherency.

There was an attempt of a fix in psci_helpers.S, but it didn't solve the
problem. That code has been deleted. The code was introduced in commit
<264410306381> ("Invalidate TLB entries during warm boot").

Now, during a map or unmap operation, the memory associated to each
modified table is flushed. Traversing a table will also flush it's
memory, as there is no way to tell in the current implementation if the
table that has been traversed has also been modified.

Change-Id: I4b520bca27502f1018878061bc5fb82af740bb92
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2018-08-07 12:47:12 +01:00
..
aarch32 ARMv7: division support for missing __aeabi_*divmod 2017-11-08 14:42:07 +01:00
aarch64 BL31: Introduce jump primitives 2018-06-21 16:15:23 +01:00
compiler-rt Import ctzdi2.c from LLVM compiler-rt 2017-07-26 09:28:23 +01:00
coreboot coreboot: Add support for CBMEM console 2018-01-19 15:21:12 -08:00
cpus Add initial CPU support for Cortex-Helios 2018-07-11 13:26:52 +01:00
el3_runtime Merge pull request #1392 from dp-arm/dp/cve_2018_3639 2018-05-29 09:28:05 +01:00
extensions RAS: ras_common: Add null pointer check for error record probe function 2018-07-26 21:58:45 +05:30
libfdt Use SPDX license identifiers 2017-05-03 09:39:28 +01:00
locks Fix MISRA Rule 5.3 Part 4 2018-06-12 13:21:36 +01:00
optee Fix MISRA Rule 5.7 Part 3 2018-06-12 13:21:36 +01:00
pmf Merge pull request #1313 from jonathanwright-ARM/jw/MISRA-switch-statements 2018-03-29 13:20:05 +01:00
psci xlat v2: Flush xlat tables after being modified 2018-08-07 12:47:12 +01:00
semihosting Use SPDX license identifiers 2017-05-03 09:39:28 +01:00
stack_protector Use SPDX license identifiers 2017-05-03 09:39:28 +01:00
stdlib stdlib: remove comparison with EOF macro to comply with MISRA 2018-03-15 13:32:54 +00:00
utils Fix MISRA rule 8.3 2018-07-10 11:17:51 +01:00
xlat_tables xlat: Use bool instead of int 2018-08-02 15:08:18 +01:00
xlat_tables_v2 xlat v2: Flush xlat tables after being modified 2018-08-07 12:47:12 +01:00
zlib zlib: Fix build error when LOG_LEVEL=50 2018-02-08 09:36:48 +01:00