]>
Commit | Line | Data |
---|---|---|
3cd9d207 GKH |
1 | From e6d932f77faa0f3f1430f083f74792cd391b1ada Mon Sep 17 00:00:00 2001 |
2 | From: Josh Poimboeuf <jpoimboe@redhat.com> | |
3 | Date: Fri, 12 Apr 2019 15:39:31 -0500 | |
4 | Subject: [PATCH 23/27] s390/speculation: Support 'mitigations=' cmdline option | |
5 | ||
6 | commit 0336e04a6520bdaefdb0769d2a70084fa52e81ed upstream | |
7 | ||
8 | Configure s390 runtime CPU speculation bug mitigations in accordance | |
9 | with the 'mitigations=' cmdline option. This affects Spectre v1 and | |
10 | Spectre v2. | |
11 | ||
12 | The default behavior is unchanged. | |
13 | ||
14 | Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com> | |
15 | Signed-off-by: Thomas Gleixner <tglx@linutronix.de> | |
16 | Tested-by: Jiri Kosina <jkosina@suse.cz> (on x86) | |
17 | Reviewed-by: Jiri Kosina <jkosina@suse.cz> | |
18 | Cc: Borislav Petkov <bp@alien8.de> | |
19 | Cc: "H . Peter Anvin" <hpa@zytor.com> | |
20 | Cc: Andy Lutomirski <luto@kernel.org> | |
21 | Cc: Peter Zijlstra <peterz@infradead.org> | |
22 | Cc: Jiri Kosina <jikos@kernel.org> | |
23 | Cc: Waiman Long <longman@redhat.com> | |
24 | Cc: Andrea Arcangeli <aarcange@redhat.com> | |
25 | Cc: Jon Masters <jcm@redhat.com> | |
26 | Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> | |
27 | Cc: Paul Mackerras <paulus@samba.org> | |
28 | Cc: Michael Ellerman <mpe@ellerman.id.au> | |
29 | Cc: linuxppc-dev@lists.ozlabs.org | |
30 | Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> | |
31 | Cc: Heiko Carstens <heiko.carstens@de.ibm.com> | |
32 | Cc: linux-s390@vger.kernel.org | |
33 | Cc: Catalin Marinas <catalin.marinas@arm.com> | |
34 | Cc: Will Deacon <will.deacon@arm.com> | |
35 | Cc: linux-arm-kernel@lists.infradead.org | |
36 | Cc: linux-arch@vger.kernel.org | |
37 | Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
38 | Cc: Tyler Hicks <tyhicks@canonical.com> | |
39 | Cc: Linus Torvalds <torvalds@linux-foundation.org> | |
40 | Cc: Randy Dunlap <rdunlap@infradead.org> | |
41 | Cc: Steven Price <steven.price@arm.com> | |
42 | Cc: Phil Auld <pauld@redhat.com> | |
43 | Link: https://lkml.kernel.org/r/e4a161805458a5ec88812aac0307ae3908a030fc.1555085500.git.jpoimboe@redhat.com | |
44 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
45 | --- | |
46 | Documentation/admin-guide/kernel-parameters.txt | 5 +++-- | |
47 | arch/s390/kernel/nospec-branch.c | 3 ++- | |
48 | 2 files changed, 5 insertions(+), 3 deletions(-) | |
49 | ||
50 | diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt | |
51 | index 3294030d7f57..2bf137f97902 100644 | |
52 | --- a/Documentation/admin-guide/kernel-parameters.txt | |
53 | +++ b/Documentation/admin-guide/kernel-parameters.txt | |
54 | @@ -2571,7 +2571,7 @@ | |
55 | http://repo.or.cz/w/linux-2.6/mini2440.git | |
56 | ||
57 | mitigations= | |
58 | - [X86,PPC] Control optional mitigations for CPU | |
59 | + [X86,PPC,S390] Control optional mitigations for CPU | |
60 | vulnerabilities. This is a set of curated, | |
61 | arch-independent options, each of which is an | |
62 | aggregation of existing arch-specific options. | |
63 | @@ -2582,7 +2582,8 @@ | |
64 | expose users to several CPU vulnerabilities. | |
65 | Equivalent to: nopti [X86,PPC] | |
66 | nospectre_v1 [PPC] | |
67 | - nospectre_v2 [X86,PPC] | |
68 | + nobp=0 [S390] | |
69 | + nospectre_v2 [X86,PPC,S390] | |
70 | spectre_v2_user=off [X86] | |
71 | spec_store_bypass_disable=off [X86,PPC] | |
72 | l1tf=off [X86] | |
73 | diff --git a/arch/s390/kernel/nospec-branch.c b/arch/s390/kernel/nospec-branch.c | |
74 | index bdddaae96559..649135cbedd5 100644 | |
75 | --- a/arch/s390/kernel/nospec-branch.c | |
76 | +++ b/arch/s390/kernel/nospec-branch.c | |
77 | @@ -1,6 +1,7 @@ | |
78 | // SPDX-License-Identifier: GPL-2.0 | |
79 | #include <linux/module.h> | |
80 | #include <linux/device.h> | |
81 | +#include <linux/cpu.h> | |
82 | #include <asm/nospec-branch.h> | |
83 | ||
84 | static int __init nobp_setup_early(char *str) | |
85 | @@ -58,7 +59,7 @@ early_param("nospectre_v2", nospectre_v2_setup_early); | |
86 | ||
87 | void __init nospec_auto_detect(void) | |
88 | { | |
89 | - if (test_facility(156)) { | |
90 | + if (test_facility(156) || cpu_mitigations_off()) { | |
91 | /* | |
92 | * The machine supports etokens. | |
93 | * Disable expolines and disable nobp. | |
94 | -- | |
95 | 2.21.0 | |
96 |