[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <3fe550ea345920af7edea4f4d24ba075430ca9d0.1521141122.git.msuchanek@suse.de>
Date: Thu, 15 Mar 2018 20:15:56 +0100
From: Michal Suchanek <msuchanek@...e.de>
To: linuxppc-dev@...ts.ozlabs.org
Cc: Kate Stewart <kstewart@...uxfoundation.org>,
Madhavan Srinivasan <maddy@...ux.vnet.ibm.com>,
Paul Mackerras <paulus@...ba.org>,
Michael Neuling <mikey@...ling.org>,
"Bryant G. Ly" <bryantly@...ux.vnet.ibm.com>,
Mahesh Salgaonkar <mahesh@...ux.vnet.ibm.com>,
"Naveen N. Rao" <naveen.n.rao@...ux.vnet.ibm.com>,
Daniel Axtens <dja@...ens.net>,
Nicholas Piggin <npiggin@...il.com>,
Al Viro <viro@...iv.linux.org.uk>,
David Gibson <david@...son.dropbear.id.au>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-kernel@...r.kernel.org,
Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
Cédric Le Goater <clg@...d.org>,
Masami Hiramatsu <mhiramat@...nel.org>,
Andrew Donnellan <andrew.donnellan@....ibm.com>,
Philippe Ombredanne <pombredanne@...b.com>,
Joe Perches <joe@...ches.com>,
Oliver O'Halloran <oohall@...il.com>,
Andrew Morton <akpm@...ux-foundation.org>,
"Tobin C. Harding" <me@...in.cc>,
Michal Suchanek <msuchanek@...e.de>
Subject: [PATCH RFC rebase 7/9] 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 f60e0e3b5ad2..f6678a7b6114 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -963,6 +963,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