]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
s390: move nobp parameter functions to nospec-branch.c
authorMartin Schwidefsky <schwidefsky@de.ibm.com>
Fri, 23 Mar 2018 16:09:39 +0000 (17:09 +0100)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Wed, 28 Mar 2018 06:38:23 +0000 (08:38 +0200)
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>
arch/s390/kernel/Makefile
arch/s390/kernel/alternative.c
arch/s390/kernel/nospec-branch.c

index 7f27e3da9709c1a968bff98f9750d551a7d53bcc..b06a6f79c1ec3b3dba230e6c7a3eadf8e935beea 100644 (file)
@@ -61,11 +61,11 @@ obj-y       += debug.o irq.o ipl.o dis.o diag.o vdso.o als.o
 obj-y  += sysinfo.o jump_label.o lgr.o os_info.o machine_kexec.o pgm_check.o
 obj-y  += runtime_instr.o cache.o fpu.o dumpstack.o guarded_storage.o sthyi.o
 obj-y  += entry.o reipl.o relocate_kernel.o kdebugfs.o alternative.o
+obj-y  += nospec-branch.o
 
 extra-y                                += head.o head64.o vmlinux.lds
 
-obj-$(CONFIG_EXPOLINE)         += nospec-branch.o
-CFLAGS_REMOVE_expoline.o       += $(CC_FLAGS_EXPOLINE)
+CFLAGS_REMOVE_nospec-branch.o  += $(CC_FLAGS_EXPOLINE)
 
 obj-$(CONFIG_MODULES)          += module.o
 obj-$(CONFIG_SMP)              += smp.o
index 22476135f738440a56372b6ac065f7c9cb8b3930..1abf4f35d059e55bc5906af05ffc97e498a80b1a 100644 (file)
@@ -15,29 +15,6 @@ static int __init disable_alternative_instructions(char *str)
 
 early_param("noaltinstr", disable_alternative_instructions);
 
-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);
-
 struct brcl_insn {
        u16 opc;
        s32 disp;
index 9aff72d3abda3148a0a6decb358713e6369a43a7..69ce00d02d1bc439af2353d48897aa8eb607f99b 100644 (file)
@@ -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 */