]> git.ipfire.org Git - people/arne_f/kernel.git/commitdiff
powerpc/fsl: Add macro to flush the branch predictor
authorDiana Craciun <diana.craciun@nxp.com>
Thu, 11 Apr 2019 11:46:19 +0000 (21:46 +1000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Apr 2019 06:36:42 +0000 (08:36 +0200)
commit 1cbf8990d79ff69da8ad09e8a3df014e1494462b upstream.

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/powerpc/include/asm/ppc_asm.h

index 24e95be3bfafed2f315a275dfea61e1fbeec5b86..bbd35ba36a2230b99ded42f040c29cb5275fe7af 100644 (file)
@@ -780,4 +780,25 @@ END_FTR_SECTION_IFCLR(CPU_FTR_601)
        .long 0x2400004c  /* rfid                               */
 #endif /* !CONFIG_PPC_BOOK3E */
 #endif /*  __ASSEMBLY__ */
+
+/*
+ * Helper macro for exception table entries
+ */
+#define EX_TABLE(_fault, _target)              \
+       stringify_in_c(.section __ex_table,"a";)\
+       stringify_in_c(.balign 4;)              \
+       stringify_in_c(.long (_fault) - . ;)    \
+       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 */