lkml.org 
[lkml]   [2018]   [Mar]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH RFC rebase 9/9] powerpc/64: barrier_nospec: Add commandline trigger
Date
Add commandline options spectre_v2 and nospectre_v2

These are named same as similar x86 options regardless of actual effect
to not require platform-specific configuration.

Supported options:
nospectre_v2 or spectre_v2=off - speculation barrier not used
spectre_v2=on or spectre_v2=auto - speculation barrier used

Changing the settings after boot is not supported and VM migration may
change requirements so auto is same as on.

Based on s390 implementation

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
---
arch/powerpc/kernel/setup_64.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)

diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index f6678a7b6114..c74e656265df 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -840,6 +840,28 @@ static int __init handle_no_pti(char *p)
}
early_param("nopti", handle_no_pti);

+static int __init nospectre_v2_setup_early(char *str)
+{
+ no_nospec = true;
+ return 0;
+}
+early_param("nospectre_v2", nospectre_v2_setup_early);
+
+static int __init spectre_v2_setup_early(char *str)
+{
+ if (str && !strncmp(str, "on", 2))
+ no_nospec = false;
+
+ if (str && !strncmp(str, "off", 3))
+ no_nospec = true;
+
+ if (str && !strncmp(str, "auto", 4))
+ no_nospec = false;
+
+ return 0;
+}
+early_param("spectre_v2", spectre_v2_setup_early);
+
static void do_nothing(void *unused)
{
/*
--
2.13.6
\
 
 \ /
  Last update: 2018-03-15 20:18    [W:0.680 / U:0.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site