arm-trusted-firmware/lib/cpus/aarch64
Boyan Karatotev 89dba82dfa perf(cpus): make reset errata do fewer branches
Errata application is painful for performance. For a start, it's done
when the core has just come out of reset, which means branch predictors
and caches will be empty so a branch to a workaround function must be
fetched from memory and that round trip is very slow. Then it also runs
with the I-cache off, which means that the loop to iterate over the
workarounds must also be fetched from memory on each iteration.

We can remove both branches. First, we can simply apply every erratum
directly instead of defining a workaround function and jumping to it.
Currently, no errata that need to be applied at both reset and runtime,
with the same workaround function, exist. If the need arose in future,
this should be achievable with a reset + runtime wrapper combo.

Then, we can construct a function that applies each erratum linearly
instead of looping over the list. If this function is part of the reset
function, then the only "far" branches at reset will be for the checker
functions. Importantly, this mitigates the slowdown even when an erratum
is disabled.

The result is ~50% speedup on N1SDP and ~20% on AArch64 Juno on wakeup
from PSCI calls that end in powerdown. This is roughly back to the
baseline of v2.9, before the errata framework regressed on performance
(or a little better). It is important to note that there are other
slowdowns since then that remain unknown.

Change-Id: Ie4d5288a331b11fd648e5c4a0b652b74160b07b9
Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com>
2025-02-24 09:36:11 +00:00
..
a64fx.S perf(cpus): inline the reset function 2025-02-24 09:36:10 +00:00
aem_generic.S perf(cpus): make reset errata do fewer branches 2025-02-24 09:36:11 +00:00
cortex_a35.S perf(cpus): make reset errata do fewer branches 2025-02-24 09:36:11 +00:00
cortex_a53.S perf(cpus): make reset errata do fewer branches 2025-02-24 09:36:11 +00:00
cortex_a55.S perf(cpus): make reset errata do fewer branches 2025-02-24 09:36:11 +00:00
cortex_a57.S perf(cpus): make reset errata do fewer branches 2025-02-24 09:36:11 +00:00
cortex_a65.S perf(cpus): make reset errata do fewer branches 2025-02-24 09:36:11 +00:00
cortex_a65ae.S perf(cpus): make reset errata do fewer branches 2025-02-24 09:36:11 +00:00
cortex_a72.S perf(cpus): make reset errata do fewer branches 2025-02-24 09:36:11 +00:00
cortex_a73.S perf(cpus): make reset errata do fewer branches 2025-02-24 09:36:11 +00:00
cortex_a75.S perf(cpus): make reset errata do fewer branches 2025-02-24 09:36:11 +00:00
cortex_a75_pubsub.c chore: update to use Arm word across TF-A 2023-08-08 15:12:30 +01:00
cortex_a76.S perf(cpus): make reset errata do fewer branches 2025-02-24 09:36:11 +00:00
cortex_a76ae.S perf(cpus): make reset errata do fewer branches 2025-02-24 09:36:11 +00:00
cortex_a77.S perf(cpus): make reset errata do fewer branches 2025-02-24 09:36:11 +00:00
cortex_a78.S perf(cpus): make reset errata do fewer branches 2025-02-24 09:36:11 +00:00
cortex_a78_ae.S perf(cpus): make reset errata do fewer branches 2025-02-24 09:36:11 +00:00
cortex_a78c.S perf(cpus): make reset errata do fewer branches 2025-02-24 09:36:11 +00:00
cortex_a510.S perf(cpus): make reset errata do fewer branches 2025-02-24 09:36:11 +00:00
cortex_a520.S perf(cpus): make reset errata do fewer branches 2025-02-24 09:36:11 +00:00
cortex_a710.S perf(cpus): make reset errata do fewer branches 2025-02-24 09:36:11 +00:00
cortex_a715.S perf(cpus): make reset errata do fewer branches 2025-02-24 09:36:11 +00:00
cortex_a720.S perf(cpus): make reset errata do fewer branches 2025-02-24 09:36:11 +00:00
cortex_a720_ae.S perf(cpus): make reset errata do fewer branches 2025-02-24 09:36:11 +00:00
cortex_a725.S perf(cpus): make reset errata do fewer branches 2025-02-24 09:36:11 +00:00
cortex_alto.S perf(cpus): make reset errata do fewer branches 2025-02-24 09:36:11 +00:00
cortex_arcadia.S perf(cpus): make reset errata do fewer branches 2025-02-24 09:36:11 +00:00
cortex_gelas.S perf(cpus): make reset errata do fewer branches 2025-02-24 09:36:11 +00:00
cortex_x1.S perf(cpus): make reset errata do fewer branches 2025-02-24 09:36:11 +00:00
cortex_x2.S perf(cpus): make reset errata do fewer branches 2025-02-24 09:36:11 +00:00
cortex_x3.S perf(cpus): make reset errata do fewer branches 2025-02-24 09:36:11 +00:00
cortex_x4.S perf(cpus): make reset errata do fewer branches 2025-02-24 09:36:11 +00:00
cortex_x925.S perf(cpus): make reset errata do fewer branches 2025-02-24 09:36:11 +00:00
cpu_helpers.S perf(cpus): inline the reset function 2025-02-24 09:36:10 +00:00
cpuamu.c Sanitise includes across codebase 2019-01-04 10:43:17 +00:00
cpuamu_helpers.S chore: update to use Arm word across TF-A 2023-08-08 15:12:30 +01:00
denver.S perf(cpus): make reset errata do fewer branches 2025-02-24 09:36:11 +00:00
generic.S perf(cpus): make reset errata do fewer branches 2025-02-24 09:36:11 +00:00
neoverse_e1.S perf(cpus): make reset errata do fewer branches 2025-02-24 09:36:11 +00:00
neoverse_n1.S perf(cpus): make reset errata do fewer branches 2025-02-24 09:36:11 +00:00
neoverse_n1_pubsub.c chore: update to use Arm word across TF-A 2023-08-08 15:12:30 +01:00
neoverse_n2.S perf(cpus): make reset errata do fewer branches 2025-02-24 09:36:11 +00:00
neoverse_n3.S perf(cpus): make reset errata do fewer branches 2025-02-24 09:36:11 +00:00
neoverse_v1.S perf(cpus): make reset errata do fewer branches 2025-02-24 09:36:11 +00:00
neoverse_v2.S perf(cpus): make reset errata do fewer branches 2025-02-24 09:36:11 +00:00
neoverse_v3.S perf(cpus): make reset errata do fewer branches 2025-02-24 09:36:11 +00:00
nevis.S perf(cpus): make reset errata do fewer branches 2025-02-24 09:36:11 +00:00
qemu_max.S perf(cpus): make reset errata do fewer branches 2025-02-24 09:36:11 +00:00
rainier.S perf(cpus): make reset errata do fewer branches 2025-02-24 09:36:11 +00:00
travis.S perf(cpus): make reset errata do fewer branches 2025-02-24 09:36:11 +00:00
wa_cve_2017_5715_bpiall.S chore: update to use Arm word across TF-A 2023-08-08 15:12:30 +01:00
wa_cve_2017_5715_mmu.S chore: update to use Arm word across TF-A 2023-08-08 15:12:30 +01:00
wa_cve_2022_23960_bhb.S chore: update to use Arm word across TF-A 2023-08-08 15:12:30 +01:00
wa_cve_2022_23960_bhb_vector.S fix(security): workaround for CVE-2022-23960 2022-03-10 23:57:14 -06:00