arm-trusted-firmware/plat/arm/board/tc
Boyan Karatotev 83ec7e452c perf(amu): greatly simplify AMU context management
The current code is incredibly resilient to updates to the spec and
has worked quite well so far. However, recent implementations expose a
weakness in that this is rather slow. A large part of it is written in
assembly, making it opaque to the compiler for optimisations. The
future proofness requires reading registers that are effectively
`volatile`, making it even harder for the compiler, as well as adding
lots of implicit barriers, making it hard for the microarchitecutre to
optimise as well.

We can make a few assumptions, checked by a few well placed asserts, and
remove a lot of this burden. For a start, at the moment there are 4
group 0 counters with static assignments. Contexting them is a trivial
affair that doesn't need a loop. Similarly, there can only be up to 16
group 1 counters. Contexting them is a bit harder, but we can do with a
single branch with a falling through switch. If/when both of these
change, we have a pair of asserts and the feature detection mechanism to
guard us against pretending that we support something we don't.

We can drop contexting of the offset registers. They are fully
accessible by EL2 and as such are its responsibility to preserve on
powerdown.

Another small thing we can do, is pass the core_pos into the hook.
The caller already knows which core we're running on, we don't need to
call this non-trivial function again.

Finally, knowing this, we don't really need the auxiliary AMUs to be
described by the device tree. Linux doesn't care at the moment, and any
information we need for EL3 can be neatly placed in a simple array.

All of this, combined with lifting the actual saving out of assembly,
reduces the instructions to save the context from 180 to 40, including a
lot fewer branches. The code is also much shorter and easier to read.

Also propagate to aarch32 so that the two don't diverge too much.

Change-Id: Ib62e6e9ba5be7fb9fb8965c8eee148d5598a5361
Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com>
2025-02-25 08:50:46 +00:00
..
fdts feat(tc): move flash device to own node 2024-10-11 09:45:36 +02:00
include refactor(tc): add plat_rse_comms_init 2025-02-12 10:11:49 +01:00
nv_counter_test.c refactor(tc): add plat_rse_comms_init 2025-02-12 10:11:49 +01:00
plat_def_fip_uuid.h refactor(tc): change all occurrences of RSS to RSE 2024-04-22 15:44:38 +02:00
plat_tc_mbedtls_config.h refactor(mbedtls): rename default mbedtls confs 2024-12-09 15:59:45 +00:00
platform.mk perf(amu): greatly simplify AMU context management 2025-02-25 08:50:46 +00:00
platform_test.mk refactor(tc): add plat_rse_comms_init 2025-02-12 10:11:49 +01:00
region_defs.h fix(tc): rename macro to match PSA spec 2023-07-05 10:37:13 -05:00
rotpk_test.c refactor(tc): add plat_rse_comms_init 2025-02-12 10:11:49 +01:00
rse_ap_test_stubs.c refactor(tc): change all occurrences of RSS to RSE 2024-04-22 15:44:38 +02:00
rse_ap_tests.c refactor(tc): add plat_rse_comms_init 2025-02-12 10:11:49 +01:00
rse_ap_testsuites.c refactor(tc): change all occurrences of RSS to RSE 2024-04-22 15:44:38 +02:00
rse_ap_testsuites.h refactor(tc): change all occurrences of RSS to RSE 2024-04-22 15:44:38 +02:00
tc_bl1_dpe.c refactor(tc): add plat_rse_comms_init 2025-02-12 10:11:49 +01:00
tc_bl1_measured_boot.c refactor(tc): add plat_rse_comms_init 2025-02-12 10:11:49 +01:00
tc_bl1_setup.c fix(tc): add stubs for soc_css_init functions 2024-07-03 12:09:11 +01:00
tc_bl2_dpe.c refactor(tc): add plat_rse_comms_init 2025-02-12 10:11:49 +01:00
tc_bl2_measured_boot.c refactor(tc): add plat_rse_comms_init 2025-02-12 10:11:49 +01:00
tc_bl2_setup.c
tc_bl31_setup.c perf(amu): greatly simplify AMU context management 2025-02-25 08:50:46 +00:00
tc_common_dpe.c refactor(tc): change all occurrences of RSS to RSE 2024-04-22 15:44:38 +02:00
tc_common_measured_boot.c refactor(tc): change all occurrences of RSS to RSE 2024-04-22 15:44:38 +02:00
tc_dpe.h feat(tc): provide target_locality info of AP FW components 2024-07-03 15:03:20 +02:00
tc_err.c
tc_interconnect.c
tc_plat.c fix(tc): map mem_protect flash region 2024-12-11 10:55:20 +00:00
tc_rng_trap.c feat(tc): enable trng 2025-02-04 10:26:00 +00:00
tc_rse_comms.c refactor(arm): switch to rse_mbx_init 2025-02-12 10:11:49 +01:00
tc_security.c fix(tc): don't enable TZC on TC3 2024-07-04 14:35:04 +01:00
tc_stack_protector.c feat(tc): enable stack protector 2025-01-31 13:45:28 +01:00
tc_topology.c feat(plat): add platform API that gets cluster ID 2024-05-09 10:00:16 -05:00
tc_trng.c feat(tc): get entropy with PSA Crypto API 2025-02-04 10:28:18 +00:00
tc_trusted_boot.c