summaryrefslogtreecommitdiff
path: root/arch/s390/include/asm/nospec-branch.h
diff options
context:
space:
mode:
authorHeiko Carstens <hca@linux.ibm.com>2024-07-16 14:50:55 +0300
committerVasily Gorbik <gor@linux.ibm.com>2024-07-23 17:02:31 +0300
commit47837a5c74f432ad992239cfa5966543f466d4df (patch)
tree87699ed5a83d93168b86c0cd473b30254210bb15 /arch/s390/include/asm/nospec-branch.h
parent7f9d85998f6c5b989796470fd1ac066232c60723 (diff)
downloadlinux-47837a5c74f432ad992239cfa5966543f466d4df.tar.xz
s390/nospec: Push down alternative handling
The nospec implementation is deeply integrated into the alternatives code: only for nospec an alternative facility list is implemented and used by the alternative code, while it is modified by nospec specific needs. Push down the nospec alternative handling into the nospec by introducing a new alternative type and a specific nospec callback to decide if alternatives should be applied. Also introduce a new global nobp variable which together with facility 82 can be used to decide if nobp is enabled or not. Acked-by: Alexander Gordeev <agordeev@linux.ibm.com> Tested-by: Sven Schnelle <svens@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Diffstat (limited to 'arch/s390/include/asm/nospec-branch.h')
-rw-r--r--arch/s390/include/asm/nospec-branch.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/arch/s390/include/asm/nospec-branch.h b/arch/s390/include/asm/nospec-branch.h
index b9c1f3cae842..192835a3e24d 100644
--- a/arch/s390/include/asm/nospec-branch.h
+++ b/arch/s390/include/asm/nospec-branch.h
@@ -5,8 +5,17 @@
#ifndef __ASSEMBLY__
#include <linux/types.h>
+#include <asm/facility.h>
extern int nospec_disable;
+extern int nobp;
+
+static inline bool nobp_enabled(void)
+{
+ if (__is_defined(__DECOMPRESSOR))
+ return false;
+ return nobp && test_facility(82);
+}
void nospec_init_branches(void);
void nospec_auto_detect(void);