arm64: barrier: Add CSDB macros to control data-value prediction
authorMark Rutland <mark.rutland@arm.com>
Thu, 12 Apr 2018 11:10:57 +0000 (12:10 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 20 Apr 2018 06:20:42 +0000 (08:20 +0200)
From: Will Deacon <will.deacon@arm.com>

commit 669474e772b952b14f4de4845a1558fd4c0414a4 upstream.

For CPUs capable of data value prediction, CSDB waits for any outstanding
predictions to architecturally resolve before allowing speculative execution
to continue. Provide macros to expose it to the arch code.

Reviewed-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Mark Rutland <mark.rutland@arm.com [v4.9 backport]
Tested-by: Greg Hackmann <ghackmann@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/arm64/include/asm/assembler.h
arch/arm64/include/asm/barrier.h

index 7193bf97b8dacd55efb3da37cbc7fb5957934243..b223b1b4d5cdfeb3d8ea91a8f8f1fabf3e6a6fa6 100644 (file)
        dmb     \opt
        .endm
 
+/*
+ * Value prediction barrier
+ */
+       .macro  csdb
+       hint    #20
+       .endm
+
 /*
  * NOP sequence
  */
index 0fe7e43b7fbc26bf2f6f2a47354a21943ae56ab9..c68fdc5707edbcac307884988337844c3d0d0c9c 100644 (file)
@@ -31,6 +31,8 @@
 #define dmb(opt)       asm volatile("dmb " #opt : : : "memory")
 #define dsb(opt)       asm volatile("dsb " #opt : : : "memory")
 
+#define csdb()         asm volatile("hint #20" : : : "memory")
+
 #define mb()           dsb(sy)
 #define rmb()          dsb(ld)
 #define wmb()          dsb(st)