arm-trusted-firmware/lib
Boyan Karatotev f0c96a2e35 refactor(cm): clean up SCR_EL3 and CPTR_EL3 initialization
As with MDCR_EL3, setting some bits of these registers is redundant at
reset since they do not matter for EL3 execution and the registers get
context switched so they get overwritten anyway.

The SCR_EL3.{TWE, TWI, SMD, API, APK} bits only affect lower ELs so
their place is in context management. The API and APK bits are a bit
special as they would get implicitly unset for secure world when
CTX_INCLUDE_PAUTH_REGS is unset. This is now explicit with their normal
world values being always set as PAuth defaults to enabled. The same
sequence is also added to realm world too. The reasoning is the same as
for Secure world - PAuth will be enabled for NS, and unless explicitly
handled by firmware, it should not leak to realm.

The CPTR_EL3.{ESM, EZ, TAM} bits are set by the relevant
feat_enable()s in lib/extensions so they can be skipped too.

CPTR_EL3.TFP is special as it's needed for access to generic floating
point registers even when SVE is not present. So keep it but move to
context management.

This leaves CPTR_EL3.TCPAC which affects several extensions. This bit
was set centrally at reset, however the earliest need for it is in BL2.
So set it in cm_setup_context_common(). However, this CPTR_EL3 is only
restored for BL31 which is clearly not the case. So always restore it.

Finally, setting CPTR_EL3 to a fresh RESET_VAL for each security state
prevents any bits from leaking between them.

Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com>
Signed-off-by: Jayanth Dodderi Chidanand <jayanthdodderi.chidanand@arm.com>
Change-Id: Ie7095e967bd4a6d6ca6acf314c7086d89fec8900
2023-10-05 17:42:23 +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): clean up SCR_EL3 and CPTR_EL3 initialization 2023-10-05 17:42:23 +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