summaryrefslogtreecommitdiff
path: root/include/common
diff options
context:
space:
mode:
authorSathees Balya <sathees.balya@arm.com>2018-12-06 13:33:24 +0000
committerSathees Balya <sathees.balya@arm.com>2019-01-03 17:33:09 +0000
commit65849aa595fa0fad1e9b9fd13c24d5b756e61aa6 (patch)
tree90cb44d6f2694a00718940cede1d8f7fc57efb28 /include/common
parentc8765826f4c2d10db0b660defccc84f7bce11af0 (diff)
Enable DIT if supported
This patch enables the Data Independent Timing functionality (DIT) in EL3 if supported by the platform. Change-Id: Ia527d6aa2ee88a9a9fe1c941220404b9ff5567e5 Signed-off-by: Sathees Balya <sathees.balya@arm.com>
Diffstat (limited to 'include/common')
-rw-r--r--include/common/aarch32/el3_common_macros.S12
-rw-r--r--include/common/aarch64/el3_common_macros.S12
2 files changed, 24 insertions, 0 deletions
diff --git a/include/common/aarch32/el3_common_macros.S b/include/common/aarch32/el3_common_macros.S
index 24384232..048f1610 100644
--- a/include/common/aarch32/el3_common_macros.S
+++ b/include/common/aarch32/el3_common_macros.S
@@ -110,6 +110,18 @@
stcopr r0, SDCR
#endif
+ /*
+ * If Data Independent Timing (DIT) functionality is implemented,
+ * always enable DIT in EL3
+ */
+ ldcopr r0, ID_PFR0
+ and r0, r0, #(ID_PFR0_DIT_MASK << ID_PFR0_DIT_SHIFT)
+ cmp r0, #ID_PFR0_DIT_SUPPORTED
+ bne 1f
+ mrs r0, cpsr
+ orr r0, r0, #CPSR_DIT_BIT
+ msr cpsr_cxsf, r0
+1:
.endm
/* -----------------------------------------------------------------------------
diff --git a/include/common/aarch64/el3_common_macros.S b/include/common/aarch64/el3_common_macros.S
index 008daca9..410aeab7 100644
--- a/include/common/aarch64/el3_common_macros.S
+++ b/include/common/aarch64/el3_common_macros.S
@@ -130,6 +130,18 @@
*/
mov_imm x0, (CPTR_EL3_RESET_VAL & ~(TCPAC_BIT | TTA_BIT | TFP_BIT))
msr cptr_el3, x0
+
+ /*
+ * If Data Independent Timing (DIT) functionality is implemented,
+ * always enable DIT in EL3
+ */
+ mrs x0, id_aa64pfr0_el1
+ ubfx x0, x0, #ID_AA64PFR0_DIT_SHIFT, #ID_AA64PFR0_DIT_LENGTH
+ cmp x0, #ID_AA64PFR0_DIT_SUPPORTED
+ bne 1f
+ mov x0, #DIT_BIT
+ msr DIT, x0
+1:
.endm
/* -----------------------------------------------------------------------------