aboutsummaryrefslogtreecommitdiff
path: root/tftf
diff options
context:
space:
mode:
authorAlexei Fedorov <Alexei.Fedorov@arm.com>2019-12-12 14:14:55 +0000
committerAlexei Fedorov <Alexei.Fedorov@arm.com>2019-12-12 14:16:13 +0000
commit2198e9a1fb8c48c68dc9aa5180ef6ceaca135c29 (patch)
tree571c838e8334bbff2970330c7db0491fb7478c12 /tftf
parentfc0b20764ec1d613ae41f7985485d8be81c5e526 (diff)
downloadtf-a-tests-2198e9a1fb8c48c68dc9aa5180ef6ceaca135c29.tar.gz
TFTF: Add missing D-cache invalidation
This patch adds missing D-cache invalidation of RW memory in tftf_entrypoint to safeguard against possible corruption of this memory by dirty cache lines in a system cache as a result of use by an earlier boot loader stage. Ref. GENFW-3455 Signed-off-by: Alexei Fedorov <Alexei.Fedorov@arm.com> Change-Id: I595344c307502a6c24c2e62d3e3f2f9d7a810dfa
Diffstat (limited to 'tftf')
-rw-r--r--tftf/framework/aarch32/entrypoint.S14
-rw-r--r--tftf/framework/aarch64/entrypoint.S12
2 files changed, 25 insertions, 1 deletions
diff --git a/tftf/framework/aarch32/entrypoint.S b/tftf/framework/aarch32/entrypoint.S
index 1f302fa84..eaa078831 100644
--- a/tftf/framework/aarch32/entrypoint.S
+++ b/tftf/framework/aarch32/entrypoint.S
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2019, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -19,6 +19,18 @@ func tftf_entrypoint
bl arch_init
/* --------------------------------------------------------------------
+ * Invalidate the RW memory used by TFTF image.
+ * This is done to safeguard against possible corruption of this
+ * memory by dirty cache lines in a system cache as a result of use
+ * by an earlier boot loader stage.
+ * --------------------------------------------------------------------
+ */
+ ldr r0, =__DATA_START__
+ ldr r1, =__DATA_END__
+ sub r1, r1, r0
+ bl inv_dcache_range
+
+ /* --------------------------------------------------------------------
* This code is expected to be executed only by the primary CPU.
* Save the mpid for the first core that executes and if a secondary
* CPU has lost its way make it spin forever.
diff --git a/tftf/framework/aarch64/entrypoint.S b/tftf/framework/aarch64/entrypoint.S
index 0a4afe0e0..81fd207b4 100644
--- a/tftf/framework/aarch64/entrypoint.S
+++ b/tftf/framework/aarch64/entrypoint.S
@@ -20,6 +20,18 @@ func tftf_entrypoint
bl arch_init
/* --------------------------------------------------------------------
+ * Invalidate the RW memory used by TFTF image.
+ * This is done to safeguard against possible corruption of this
+ * memory by dirty cache lines in a system cache as a result of use
+ * by an earlier boot loader stage.
+ * --------------------------------------------------------------------
+ */
+ adr x0, __DATA_START__
+ adr x1, __DATA_END__
+ sub x1, x1, x0
+ bl inv_dcache_range
+
+ /* --------------------------------------------------------------------
* This code is expected to be executed only by the primary CPU.
* Save the mpid for the first core that executes and if a secondary
* CPU has lost its way make it spin forever.