xref: /linux/arch/s390/include/asm/nospec-branch.h (revision 47837a5c74f432ad992239cfa5966543f466d4df)
1f19fbd5eSMartin Schwidefsky /* SPDX-License-Identifier: GPL-2.0 */
2f19fbd5eSMartin Schwidefsky #ifndef _ASM_S390_EXPOLINE_H
3f19fbd5eSMartin Schwidefsky #define _ASM_S390_EXPOLINE_H
4f19fbd5eSMartin Schwidefsky 
5f19fbd5eSMartin Schwidefsky #ifndef __ASSEMBLY__
6f19fbd5eSMartin Schwidefsky 
7f19fbd5eSMartin Schwidefsky #include <linux/types.h>
8*47837a5cSHeiko Carstens #include <asm/facility.h>
9f19fbd5eSMartin Schwidefsky 
106e179d64SMartin Schwidefsky extern int nospec_disable;
11*47837a5cSHeiko Carstens extern int nobp;
12*47837a5cSHeiko Carstens 
13*47837a5cSHeiko Carstens static inline bool nobp_enabled(void)
14*47837a5cSHeiko Carstens {
15*47837a5cSHeiko Carstens 	if (__is_defined(__DECOMPRESSOR))
16*47837a5cSHeiko Carstens 		return false;
17*47837a5cSHeiko Carstens 	return nobp && test_facility(82);
18*47837a5cSHeiko Carstens }
19f19fbd5eSMartin Schwidefsky 
20f19fbd5eSMartin Schwidefsky void nospec_init_branches(void);
216a3d1e81SMartin Schwidefsky void nospec_auto_detect(void);
226e179d64SMartin Schwidefsky void nospec_revert(s32 *start, s32 *end);
23f19fbd5eSMartin Schwidefsky 
245d17d4edSSven Schnelle static inline bool nospec_uses_trampoline(void)
255d17d4edSSven Schnelle {
265d17d4edSSven Schnelle 	return __is_defined(CC_USING_EXPOLINE) && !nospec_disable;
275d17d4edSSven Schnelle }
285d17d4edSSven Schnelle 
29ba05b39dSVasily Gorbik #ifdef CONFIG_EXPOLINE_EXTERN
30ba05b39dSVasily Gorbik 
31ba05b39dSVasily Gorbik void __s390_indirect_jump_r1(void);
32ba05b39dSVasily Gorbik void __s390_indirect_jump_r2(void);
33ba05b39dSVasily Gorbik void __s390_indirect_jump_r3(void);
34ba05b39dSVasily Gorbik void __s390_indirect_jump_r4(void);
35ba05b39dSVasily Gorbik void __s390_indirect_jump_r5(void);
36ba05b39dSVasily Gorbik void __s390_indirect_jump_r6(void);
37ba05b39dSVasily Gorbik void __s390_indirect_jump_r7(void);
38ba05b39dSVasily Gorbik void __s390_indirect_jump_r8(void);
39ba05b39dSVasily Gorbik void __s390_indirect_jump_r9(void);
40ba05b39dSVasily Gorbik void __s390_indirect_jump_r10(void);
41ba05b39dSVasily Gorbik void __s390_indirect_jump_r11(void);
42ba05b39dSVasily Gorbik void __s390_indirect_jump_r12(void);
43ba05b39dSVasily Gorbik void __s390_indirect_jump_r13(void);
44ba05b39dSVasily Gorbik void __s390_indirect_jump_r14(void);
45ba05b39dSVasily Gorbik void __s390_indirect_jump_r15(void);
46ba05b39dSVasily Gorbik 
47ba05b39dSVasily Gorbik #endif
48ba05b39dSVasily Gorbik 
49f19fbd5eSMartin Schwidefsky #endif /* __ASSEMBLY__ */
50f19fbd5eSMartin Schwidefsky 
51f19fbd5eSMartin Schwidefsky #endif /* _ASM_S390_EXPOLINE_H */
52