]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.4/powerpc-fsl-add-macro-to-flush-the-branch-predictor.patch
4.4-stable patches
[thirdparty/kernel/stable-queue.git] / queue-4.4 / powerpc-fsl-add-macro-to-flush-the-branch-predictor.patch
1 From foo@baz Mon 29 Apr 2019 11:38:37 AM CEST
2 From: Michael Ellerman <mpe@ellerman.id.au>
3 Date: Mon, 22 Apr 2019 00:20:31 +1000
4 Subject: powerpc/fsl: Add macro to flush the branch predictor
5 To: stable@vger.kernel.org, gregkh@linuxfoundation.org
6 Cc: linuxppc-dev@ozlabs.org, diana.craciun@nxp.com, msuchanek@suse.de, npiggin@gmail.com, christophe.leroy@c-s.fr
7 Message-ID: <20190421142037.21881-47-mpe@ellerman.id.au>
8
9 From: Diana Craciun <diana.craciun@nxp.com>
10
11 commit 1cbf8990d79ff69da8ad09e8a3df014e1494462b upstream.
12
13 The BUCSR register can be used to invalidate the entries in the
14 branch prediction mechanisms.
15
16 Signed-off-by: Diana Craciun <diana.craciun@nxp.com>
17 Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
18 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
19 ---
20 arch/powerpc/include/asm/ppc_asm.h | 11 +++++++++++
21 1 file changed, 11 insertions(+)
22
23 --- a/arch/powerpc/include/asm/ppc_asm.h
24 +++ b/arch/powerpc/include/asm/ppc_asm.h
25 @@ -821,4 +821,15 @@ END_FTR_SECTION_NESTED(CPU_FTR_HAS_PPR,C
26 .long 0x2400004c /* rfid */
27 #endif /* !CONFIG_PPC_BOOK3E */
28 #endif /* __ASSEMBLY__ */
29 +
30 +#ifdef CONFIG_PPC_FSL_BOOK3E
31 +#define BTB_FLUSH(reg) \
32 + lis reg,BUCSR_INIT@h; \
33 + ori reg,reg,BUCSR_INIT@l; \
34 + mtspr SPRN_BUCSR,reg; \
35 + isync;
36 +#else
37 +#define BTB_FLUSH(reg)
38 +#endif /* CONFIG_PPC_FSL_BOOK3E */
39 +
40 #endif /* _ASM_POWERPC_PPC_ASM_H */