]>
Commit | Line | Data |
---|---|---|
1f91e7a4 GKH |
1 | From foo@baz Tue 14 May 2019 08:29:35 PM CEST |
2 | From: Thomas Gleixner <tglx@linutronix.de> | |
3 | Date: Sun, 25 Nov 2018 19:33:44 +0100 | |
4 | Subject: x86/speculation: Unify conditional spectre v2 print functions | |
5 | ||
6 | From: Thomas Gleixner <tglx@linutronix.de> | |
7 | ||
8 | commit 495d470e9828500e0155027f230449ac5e29c025 upstream. | |
9 | ||
10 | There is no point in having two functions and a conditional at the call | |
11 | site. | |
12 | ||
13 | Signed-off-by: Thomas Gleixner <tglx@linutronix.de> | |
14 | Reviewed-by: Ingo Molnar <mingo@kernel.org> | |
15 | Cc: Peter Zijlstra <peterz@infradead.org> | |
16 | Cc: Andy Lutomirski <luto@kernel.org> | |
17 | Cc: Linus Torvalds <torvalds@linux-foundation.org> | |
18 | Cc: Jiri Kosina <jkosina@suse.cz> | |
19 | Cc: Tom Lendacky <thomas.lendacky@amd.com> | |
20 | Cc: Josh Poimboeuf <jpoimboe@redhat.com> | |
21 | Cc: Andrea Arcangeli <aarcange@redhat.com> | |
22 | Cc: David Woodhouse <dwmw@amazon.co.uk> | |
23 | Cc: Tim Chen <tim.c.chen@linux.intel.com> | |
24 | Cc: Andi Kleen <ak@linux.intel.com> | |
25 | Cc: Dave Hansen <dave.hansen@intel.com> | |
26 | Cc: Casey Schaufler <casey.schaufler@intel.com> | |
27 | Cc: Asit Mallick <asit.k.mallick@intel.com> | |
28 | Cc: Arjan van de Ven <arjan@linux.intel.com> | |
29 | Cc: Jon Masters <jcm@redhat.com> | |
30 | Cc: Waiman Long <longman9394@gmail.com> | |
31 | Cc: Greg KH <gregkh@linuxfoundation.org> | |
32 | Cc: Dave Stewart <david.c.stewart@intel.com> | |
33 | Cc: Kees Cook <keescook@chromium.org> | |
34 | Link: https://lkml.kernel.org/r/20181125185004.986890749@linutronix.de | |
35 | Signed-off-by: Ben Hutchings <ben@decadent.org.uk> | |
36 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
37 | --- | |
38 | arch/x86/kernel/cpu/bugs.c | 17 ++++------------- | |
39 | 1 file changed, 4 insertions(+), 13 deletions(-) | |
40 | ||
41 | --- a/arch/x86/kernel/cpu/bugs.c | |
42 | +++ b/arch/x86/kernel/cpu/bugs.c | |
43 | @@ -249,15 +249,9 @@ static const struct { | |
44 | { "auto", SPECTRE_V2_CMD_AUTO, false }, | |
45 | }; | |
46 | ||
47 | -static void __init spec2_print_if_insecure(const char *reason) | |
48 | +static void __init spec_v2_print_cond(const char *reason, bool secure) | |
49 | { | |
50 | - if (boot_cpu_has_bug(X86_BUG_SPECTRE_V2)) | |
51 | - pr_info("%s selected on command line.\n", reason); | |
52 | -} | |
53 | - | |
54 | -static void __init spec2_print_if_secure(const char *reason) | |
55 | -{ | |
56 | - if (!boot_cpu_has_bug(X86_BUG_SPECTRE_V2)) | |
57 | + if (boot_cpu_has_bug(X86_BUG_SPECTRE_V2) != secure) | |
58 | pr_info("%s selected on command line.\n", reason); | |
59 | } | |
60 | ||
61 | @@ -305,11 +299,8 @@ static enum spectre_v2_mitigation_cmd __ | |
62 | return SPECTRE_V2_CMD_AUTO; | |
63 | } | |
64 | ||
65 | - if (mitigation_options[i].secure) | |
66 | - spec2_print_if_secure(mitigation_options[i].option); | |
67 | - else | |
68 | - spec2_print_if_insecure(mitigation_options[i].option); | |
69 | - | |
70 | + spec_v2_print_cond(mitigation_options[i].option, | |
71 | + mitigation_options[i].secure); | |
72 | return cmd; | |
73 | } | |
74 |