Skip to content

Commit b2e2f43

Browse files
author
Martin Schwidefsky
committed
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 <[email protected]>
1 parent b9dd652 commit b2e2f43

File tree

3 files changed

+29
-25
lines changed

3 files changed

+29
-25
lines changed

arch/s390/kernel/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ obj-y += debug.o irq.o ipl.o dis.o diag.o vdso.o als.o
6161
obj-y += sysinfo.o jump_label.o lgr.o os_info.o machine_kexec.o pgm_check.o
6262
obj-y += runtime_instr.o cache.o fpu.o dumpstack.o guarded_storage.o sthyi.o
6363
obj-y += entry.o reipl.o relocate_kernel.o kdebugfs.o alternative.o
64+
obj-y += nospec-branch.o
6465

6566
extra-y += head.o head64.o vmlinux.lds
6667

67-
obj-$(CONFIG_EXPOLINE) += nospec-branch.o
68-
CFLAGS_REMOVE_expoline.o += $(CC_FLAGS_EXPOLINE)
68+
CFLAGS_REMOVE_nospec-branch.o += $(CC_FLAGS_EXPOLINE)
6969

7070
obj-$(CONFIG_MODULES) += module.o
7171
obj-$(CONFIG_SMP) += smp.o

arch/s390/kernel/alternative.c

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,6 @@ static int __init disable_alternative_instructions(char *str)
1515

1616
early_param("noaltinstr", disable_alternative_instructions);
1717

18-
static int __init nobp_setup_early(char *str)
19-
{
20-
bool enabled;
21-
int rc;
22-
23-
rc = kstrtobool(str, &enabled);
24-
if (rc)
25-
return rc;
26-
if (enabled && test_facility(82))
27-
__set_facility(82, S390_lowcore.alt_stfle_fac_list);
28-
else
29-
__clear_facility(82, S390_lowcore.alt_stfle_fac_list);
30-
return 0;
31-
}
32-
early_param("nobp", nobp_setup_early);
33-
34-
static int __init nospec_setup_early(char *str)
35-
{
36-
__clear_facility(82, S390_lowcore.alt_stfle_fac_list);
37-
return 0;
38-
}
39-
early_param("nospec", nospec_setup_early);
40-
4118
struct brcl_insn {
4219
u16 opc;
4320
s32 disp;

arch/s390/kernel/nospec-branch.c

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,31 @@
22
#include <linux/module.h>
33
#include <asm/nospec-branch.h>
44

5+
static int __init nobp_setup_early(char *str)
6+
{
7+
bool enabled;
8+
int rc;
9+
10+
rc = kstrtobool(str, &enabled);
11+
if (rc)
12+
return rc;
13+
if (enabled && test_facility(82))
14+
__set_facility(82, S390_lowcore.alt_stfle_fac_list);
15+
else
16+
__clear_facility(82, S390_lowcore.alt_stfle_fac_list);
17+
return 0;
18+
}
19+
early_param("nobp", nobp_setup_early);
20+
21+
static int __init nospec_setup_early(char *str)
22+
{
23+
__clear_facility(82, S390_lowcore.alt_stfle_fac_list);
24+
return 0;
25+
}
26+
early_param("nospec", nospec_setup_early);
27+
28+
#ifdef CONFIG_EXPOLINE
29+
530
int nospec_call_disable = IS_ENABLED(CONFIG_EXPOLINE_OFF);
631
int nospec_return_disable = !IS_ENABLED(CONFIG_EXPOLINE_FULL);
732

@@ -98,3 +123,5 @@ void __init nospec_init_branches(void)
98123
nospec_call_revert(__nospec_call_start, __nospec_call_end);
99124
nospec_return_revert(__nospec_return_start, __nospec_return_end);
100125
}
126+
127+
#endif /* CONFIG_EXPOLINE */

0 commit comments

Comments
 (0)