summaryrefslogtreecommitdiffstats
path: root/arch/s390/kernel/nospec-branch.c
diff options
context:
space:
mode:
authorMartin Schwidefsky <schwidefsky@de.ibm.com>2018-03-23 17:09:39 +0100
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2018-03-28 08:38:23 +0200
commitb2e2f43a01bace1a25bdbae04c9f9846882b727a (patch)
treed00215b5fb0845a57053000173c111efb69b7634 /arch/s390/kernel/nospec-branch.c
parentb9dd652499d645707dda2b835a905455e3718157 (diff)
downloadlinux-stable-b2e2f43a01bace1a25bdbae04c9f9846882b727a.tar.gz
linux-stable-b2e2f43a01bace1a25bdbae04c9f9846882b727a.tar.bz2
linux-stable-b2e2f43a01bace1a25bdbae04c9f9846882b727a.zip
s390: move nobp parameter functions to nospec-branch.c
Keep the code for the nobp parameter handling with the code for expolines. Both are related to the spectre v2 mitigation. Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/kernel/nospec-branch.c')
-rw-r--r--arch/s390/kernel/nospec-branch.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/arch/s390/kernel/nospec-branch.c b/arch/s390/kernel/nospec-branch.c
index 9aff72d3abda..69ce00d02d1b 100644
--- a/arch/s390/kernel/nospec-branch.c
+++ b/arch/s390/kernel/nospec-branch.c
@@ -2,6 +2,31 @@
#include <linux/module.h>
#include <asm/nospec-branch.h>
+static int __init nobp_setup_early(char *str)
+{
+ bool enabled;
+ int rc;
+
+ rc = kstrtobool(str, &enabled);
+ if (rc)
+ return rc;
+ if (enabled && test_facility(82))
+ __set_facility(82, S390_lowcore.alt_stfle_fac_list);
+ else
+ __clear_facility(82, S390_lowcore.alt_stfle_fac_list);
+ return 0;
+}
+early_param("nobp", nobp_setup_early);
+
+static int __init nospec_setup_early(char *str)
+{
+ __clear_facility(82, S390_lowcore.alt_stfle_fac_list);
+ return 0;
+}
+early_param("nospec", nospec_setup_early);
+
+#ifdef CONFIG_EXPOLINE
+
int nospec_call_disable = IS_ENABLED(CONFIG_EXPOLINE_OFF);
int nospec_return_disable = !IS_ENABLED(CONFIG_EXPOLINE_FULL);
@@ -98,3 +123,5 @@ void __init nospec_init_branches(void)
nospec_call_revert(__nospec_call_start, __nospec_call_end);
nospec_return_revert(__nospec_return_start, __nospec_return_end);
}
+
+#endif /* CONFIG_EXPOLINE */