[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <614dfe0abb78fffd35f127d0ba78e644e1a0570a.1520965380.git.msuchanek@suse.de>
Date: Tue, 13 Mar 2018 19:33:04 +0100
From: Michal Suchanek <msuchanek@...e.de>
To: linuxppc-dev@...ts.ozlabs.org
Cc: Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Paul Mackerras <paulus@...ba.org>,
Michael Ellerman <mpe@...erman.id.au>,
Peter Zijlstra <peterz@...radead.org>,
Michal Suchanek <msuchanek@...e.de>,
Kate Stewart <kstewart@...uxfoundation.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Philippe Ombredanne <pombredanne@...b.com>,
Nicholas Piggin <npiggin@...il.com>,
"Tobin C. Harding" <me@...in.cc>,
Mahesh Salgaonkar <mahesh@...ux.vnet.ibm.com>,
David Gibson <david@...son.dropbear.id.au>,
Al Viro <viro@...iv.linux.org.uk>,
Michael Neuling <mikey@...ling.org>,
"Oliver O'Halloran" <oohall@...il.com>,
"Naveen N. Rao" <naveen.n.rao@...ux.vnet.ibm.com>,
Madhavan Srinivasan <maddy@...ux.vnet.ibm.com>,
Masami Hiramatsu <mhiramat@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Balbir Singh <bsingharora@...il.com>,
Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
Christophe Leroy <christophe.leroy@....fr>,
Andrew Donnellan <andrew.donnellan@....ibm.com>,
Daniel Axtens <dja@...ens.net>,
Russell Currey <ruscur@...sell.cc>,
Joe Perches <joe@...ches.com>,
"Bryant G. Ly" <bryantly@...ux.vnet.ibm.com>,
Cédric Le Goater <clg@...d.org>,
linux-kernel@...r.kernel.org
Subject: [PATCH RFC 6/8] powerpc/64: barrier_nospec: Add debugfs trigger
Copypasta from rfi implementation
Signed-off-by: Michal Suchanek <msuchanek@...e.de>
---
arch/powerpc/kernel/setup_64.c | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index d1d9f047161e..4b67b7b877d9 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -955,6 +955,41 @@ static __init int rfi_flush_debugfs_init(void)
return 0;
}
device_initcall(rfi_flush_debugfs_init);
+
+static int barrier_nospec_set(void *data, u64 val)
+{
+ switch (val) {
+ case 0:
+ case 1:
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ if (!!val == !!barrier_nospec_enabled)
+ return 0;
+
+ barrier_nospec_enable(!!val);
+
+ return 0;
+}
+
+static int barrier_nospec_get(void *data, u64 *val)
+{
+ *val = barrier_nospec_enabled ? 1 : 0;
+ return 0;
+}
+
+DEFINE_SIMPLE_ATTRIBUTE(fops_barrier_nospec,
+ barrier_nospec_get, barrier_nospec_set, "%llu\n");
+
+static __init int barrier_nospec_debugfs_init(void)
+{
+ debugfs_create_file("barrier_nospec", 0600, powerpc_debugfs_root, NULL,
+ &fops_barrier_nospec);
+ return 0;
+}
+device_initcall(barrier_nospec_debugfs_init);
#endif
ssize_t cpu_show_meltdown(struct device *dev, struct device_attribute *attr, char *buf)
--
2.13.6
Powered by blists - more mailing lists