aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorChris Kay <chris.kay@arm.com>2021-03-09 13:34:35 +0000
committerChris Kay <chris.kay@arm.com>2021-03-18 12:34:34 +0100
commit4e04478aace24232d9acb9ca7c71af8ae845811f (patch)
tree2ca0d8bc0865838798453bbf282b8e4a0d18c959 /include
parente3ff1766e3a657882a4f59d411c63880c7254d29 (diff)
downloadtrusted-firmware-a-4e04478aace24232d9acb9ca7c71af8ae845811f.tar.gz
arch: Enable `FEAT_SB` for supported non-Armv8.5-A platforms
The speculation barrier feature (`FEAT_SB`) was introduced with and made mandatory in the Armv8.5-A extension. It was retroactively made optional in prior extensions, but the checks in our code-base do not reflect that, assuming that it is only available in Armv8.5-A or later. This change introduces the `ENABLE_FEAT_SB` definition, which derives support for the `sb` instruction in the assembler from the feature flags passed to it. Note that we assume that if this feature is enabled then all the cores in the system support it - enabling speculation barriers for only a subset of the cores is unsupported. Signed-off-by: Chris Kay <chris.kay@arm.com> Change-Id: I978ed38829385b221b10ba56d49b78f4756e20ea
Diffstat (limited to 'include')
-rw-r--r--include/arch/aarch32/asm_macros.S6
-rw-r--r--include/arch/aarch64/asm_macros.S6
2 files changed, 6 insertions, 6 deletions
diff --git a/include/arch/aarch32/asm_macros.S b/include/arch/aarch32/asm_macros.S
index f75da0ce62..483f9fe056 100644
--- a/include/arch/aarch32/asm_macros.S
+++ b/include/arch/aarch32/asm_macros.S
@@ -107,12 +107,12 @@
#else
/*
- * Macro for mitigating against speculative execution beyond ERET.
- * If possible use Speculation Barrier instruction defined in ARMv8.5
+ * Macro for mitigating against speculative execution beyond ERET. Uses the
+ * speculation barrier instruction introduced by FEAT_SB, if it's enabled.
*/
.macro exception_return
eret
-#if ARM_ARCH_AT_LEAST(8, 5)
+#if ENABLE_FEAT_SB
sb
#else
dsb nsh
diff --git a/include/arch/aarch64/asm_macros.S b/include/arch/aarch64/asm_macros.S
index cbb9f0be8f..464c05be1a 100644
--- a/include/arch/aarch64/asm_macros.S
+++ b/include/arch/aarch64/asm_macros.S
@@ -219,12 +219,12 @@
.endm
/*
- * Macro for mitigating against speculative execution beyond ERET.
- * If possible use Speculation Barrier instruction defined in ARMv8.5
+ * Macro for mitigating against speculative execution beyond ERET. Uses the
+ * speculation barrier instruction introduced by FEAT_SB, if it's enabled.
*/
.macro exception_return
eret
-#if ARM_ARCH_AT_LEAST(8, 5)
+#if ENABLE_FEAT_SB
sb
#else
dsb nsh