aboutsummaryrefslogtreecommitdiffstats
path: root/bl31/aarch64/runtime_exceptions.S
diff options
context:
space:
mode:
authorAlexei Fedorov <Alexei.Fedorov@arm.com>2019-08-13 15:17:53 +0100
committerAlexei Fedorov <Alexei.Fedorov@arm.com>2019-08-21 15:43:24 +0100
commite290a8fcbc836d51566da1607add8a320d0f1a20 (patch)
tree568a10c4c8e732fed313c612e275a25d1b8f5b58 /bl31/aarch64/runtime_exceptions.S
parent5119fa7b8d674d8ae6466836c0687433f8e1694d (diff)
downloadplatform_external_arm-trusted-firmware-e290a8fcbc836d51566da1607add8a320d0f1a20.tar.gz
platform_external_arm-trusted-firmware-e290a8fcbc836d51566da1607add8a320d0f1a20.tar.bz2
platform_external_arm-trusted-firmware-e290a8fcbc836d51566da1607add8a320d0f1a20.zip
AArch64: Disable Secure Cycle Counter
This patch fixes an issue when secure world timing information can be leaked because Secure Cycle Counter is not disabled. For ARMv8.5 the counter gets disabled by setting MDCR_El3.SCCD bit on CPU cold/warm boot. For the earlier architectures PMCR_EL0 register is saved/restored on secure world entry/exit from/to Non-secure state, and cycle counting gets disabled by setting PMCR_EL0.DP bit. 'include\aarch64\arch.h' header file was tided up and new ARMv8.5-PMU related definitions were added. Change-Id: I6f56db6bc77504634a352388990ad925a69ebbfa Signed-off-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
Diffstat (limited to 'bl31/aarch64/runtime_exceptions.S')
-rw-r--r--bl31/aarch64/runtime_exceptions.S22
1 files changed, 22 insertions, 0 deletions
diff --git a/bl31/aarch64/runtime_exceptions.S b/bl31/aarch64/runtime_exceptions.S
index 6ffd99555..fd7656e2c 100644
--- a/bl31/aarch64/runtime_exceptions.S
+++ b/bl31/aarch64/runtime_exceptions.S
@@ -67,6 +67,14 @@
/* Save GP registers and restore them afterwards */
bl save_gp_registers
+
+ /*
+ * If Secure Cycle Counter is not disabled in MDCR_EL3
+ * when ARMv8.5-PMU is implemented, save PMCR_EL0 and
+ * disable all event counters and cycle counter.
+ */
+ bl save_pmcr_disable_pmu
+
bl handle_lower_el_ea_esb
bl restore_gp_registers
@@ -123,6 +131,13 @@
bl save_gp_registers
+ /*
+ * If Secure Cycle Counter is not disabled in MDCR_EL3
+ * when ARMv8.5-PMU is implemented, save PMCR_EL0 and
+ * disable all event counters and cycle counter.
+ */
+ bl save_pmcr_disable_pmu
+
/* Save ARMv8.3-PAuth registers and load firmware key */
#if CTX_INCLUDE_PAUTH_REGS
bl pauth_context_save
@@ -335,6 +350,13 @@ smc_handler64:
/* Save general purpose registers */
bl save_gp_registers
+ /*
+ * If Secure Cycle Counter is not disabled in MDCR_EL3
+ * when ARMv8.5-PMU is implemented, save PMCR_EL0 and
+ * disable all event counters and cycle counter.
+ */
+ bl save_pmcr_disable_pmu
+
/* Save ARMv8.3-PAuth registers and load firmware key */
#if CTX_INCLUDE_PAUTH_REGS
bl pauth_context_save