powerpc/fsl: Add macro to flush the branch predictor
authorDiana Craciun <diana.craciun@nxp.com>
Wed, 12 Dec 2018 14:03:01 +0000 (16:03 +0200)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 20 Dec 2018 11:58:57 +0000 (22:58 +1100)
The BUCSR register can be used to invalidate the entries in the
branch prediction mechanisms.

Signed-off-by: Diana Craciun <diana.craciun@nxp.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/include/asm/ppc_asm.h

index 378432995eb701430afdb4c203f59e92df16583a..e0637730a8e7e53f36916c04a0f4bef9e321f90d 100644 (file)
@@ -806,4 +806,14 @@ END_FTR_SECTION_IFCLR(CPU_FTR_601)
        stringify_in_c(.long (_target) - . ;)   \
        stringify_in_c(.previous)
 
+#ifdef CONFIG_PPC_FSL_BOOK3E
+#define BTB_FLUSH(reg)                 \
+       lis reg,BUCSR_INIT@h;           \
+       ori reg,reg,BUCSR_INIT@l;       \
+       mtspr SPRN_BUCSR,reg;           \
+       isync;
+#else
+#define BTB_FLUSH(reg)
+#endif /* CONFIG_PPC_FSL_BOOK3E */
+
 #endif /* _ASM_POWERPC_PPC_ASM_H */