arm-trusted-firmware/lib
Boyan Karatotev 5c52d7e540 refactor(cm): remove world differentiation for EL2 context restore
The EL2 context save/restore functions have an optimisation to not
bother with the EL2 context when SEL2 is not in use. However, this
decision is made on the current value of SCR_EL3.EEL2, which is not
the value for the selected security state, but rather, for the
security state that came before it. This relies on the EEL2 bit's
value to propagate identically to all worlds.

This has an unintended side effect that for the first entry into
secure world, the restoring of the context is fully skipped, because
SCR_EL3 is only initialized after the call to the restoring routine
which means the EEL2 bit is not initialized (except when FEAT_RME
is present). This is inconsistent with normal and realm worlds which
always get their EL2 registers zeroed.

Remove this optimization to remove all the complexity with managing
the EEL2 bit's value. Instead unconditionally save/restore all
registers. It is worth noting that there is no performance penalty
in the case where SEL2 is empty with this change. This is because
SEL2 will never be entered, and as such no secure save/restore will
happen anyway, while normal world remains unchanged.

Removing the value management of the EEL2 bit causes the
CTX_ICC_SRE_EL2 register to be inaccessible in Secure world for some
configurations.
Make the SCR_EL3.NS workaround in cm_prepare_el3_exit_ns() generic
on every access to the register.

Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com>
Change-Id: I1f56d85814c5897b468e82d4bd4a08e3a90a7f8f
2023-10-05 17:44:49 +01:00
..
aarch32 chore: update to use Arm word across TF-A 2023-08-08 15:12:30 +01:00
aarch64 chore: update to use Arm word across TF-A 2023-08-08 15:12:30 +01:00
bl_aux_params chore: update to use Arm word across TF-A 2023-08-08 15:12:30 +01:00
compiler-rt chore: update to use Arm word across TF-A 2023-08-08 15:12:30 +01:00
coreboot chore: update to use Arm word across TF-A 2023-08-08 15:12:30 +01:00
cpus Merge changes from topic "errata" into integration 2023-09-22 20:22:19 +02:00
debugfs chore: update to use Arm word across TF-A 2023-08-08 15:12:30 +01:00
el3_runtime refactor(cm): remove world differentiation for EL2 context restore 2023-10-05 17:44:49 +01:00
extensions refactor(cm): clean up SCR_EL3 and CPTR_EL3 initialization 2023-10-05 17:42:23 +01:00
fconf chore: update to use Arm word across TF-A 2023-08-08 15:12:30 +01:00
gpt_rme fix(gpt_rme): fix compilation error for gpt_rme.c 2022-12-09 11:27:14 +00:00
libc chore: update to use Arm word across TF-A 2023-08-08 15:12:30 +01:00
libfdt chore: update to use Arm word across TF-A 2023-08-08 15:12:30 +01:00
locks chore: update to use Arm word across TF-A 2023-08-08 15:12:30 +01:00
mpmm fix(errata): workaround for Cortex-A510 erratum 2250311 2022-02-24 23:30:41 +02:00
optee chore: update to use Arm word across TF-A 2023-08-08 15:12:30 +01:00
pmf chore: update to use Arm word across TF-A 2023-08-08 15:12:30 +01:00
psa feat(psa): interface with RSS for retrieving ROTPK 2023-07-14 14:04:31 -05:00
psci chore: update to use Arm word across TF-A 2023-08-08 15:12:30 +01:00
romlib chore: update to use Arm word across TF-A 2023-08-08 15:12:30 +01:00
semihosting chore: update to use Arm word across TF-A 2023-08-08 15:12:30 +01:00
stack_protector chore: update to use Arm word across TF-A 2023-08-08 15:12:30 +01:00
transfer_list feat(handoff): introduce firmware handoff library 2023-09-22 10:56:51 +01:00
utils chore: update to use Arm word across TF-A 2023-08-08 15:12:30 +01:00
xlat_mpu chore: update to use Arm word across TF-A 2023-08-08 15:12:30 +01:00
xlat_tables chore: update to use Arm word across TF-A 2023-08-08 15:12:30 +01:00
xlat_tables_v2 chore: update to use Arm word across TF-A 2023-08-08 15:12:30 +01:00
zlib chore: update to use Arm word across TF-A 2023-08-08 15:12:30 +01:00