Use Speculation Barrier instruction for v8.5 cores

Change-Id: Ie1018bfbae2fe95c699e58648665baa75e862000
Signed-off-by: Madhukar Pappireddy <madhukar.pappireddy@arm.com>
diff --git a/include/arch/aarch32/asm_macros.S b/include/arch/aarch32/asm_macros.S
index ea1636e..f75da0c 100644
--- a/include/arch/aarch32/asm_macros.S
+++ b/include/arch/aarch32/asm_macros.S
@@ -108,11 +108,16 @@
 #else
 	/*
 	 * Macro for mitigating against speculative execution beyond ERET.
+	 * If possible use Speculation Barrier instruction defined in ARMv8.5
 	 */
 	.macro exception_return
 	eret
+#if ARM_ARCH_AT_LEAST(8, 5)
+	sb
+#else
 	dsb	nsh
 	isb
+#endif
 	.endm
 #endif
 
diff --git a/include/arch/aarch64/asm_macros.S b/include/arch/aarch64/asm_macros.S
index a7d5a3d..cbb9f0b 100644
--- a/include/arch/aarch64/asm_macros.S
+++ b/include/arch/aarch64/asm_macros.S
@@ -220,11 +220,16 @@
 
 	/*
 	 * Macro for mitigating against speculative execution beyond ERET.
+	 * If possible use Speculation Barrier instruction defined in ARMv8.5
 	 */
 	.macro exception_return
 	eret
-	dsb nsh
+#if ARM_ARCH_AT_LEAST(8, 5)
+	sb
+#else
+	dsb	nsh
 	isb
+#endif
 	.endm
 
 #endif /* ASM_MACROS_S */