Received: by 10.213.65.68 with SMTP id h4csp518889imn; Tue, 13 Mar 2018 11:36:27 -0700 (PDT) X-Google-Smtp-Source: AG47ELtDHe6/ypiCUQfS+EqHH0WLQmFj8o4e1T4cJryPANfXBEHxTlyjarZIvmRlBQr74frNE3WI X-Received: by 10.98.90.196 with SMTP id o187mr1541183pfb.170.1520966187258; Tue, 13 Mar 2018 11:36:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520966187; cv=none; d=google.com; s=arc-20160816; b=C2gN+xWP7YEnSq4xJxBxAPFeByvjKQ540UZ6UbU+K1mCG7TnmILcNrzyBpEXa7tv+a TbjHIg1RtHK7EuAMWyc0GtLSQZs1GB1kOV1vuTehGlYzxai4yKEgXoJ9C9CqHMcobEIK 52h08TqCiezPZTpYakzZwn2H3r0R0i9mkdqIvXL9lHWGBGUJKaVBL1UISSZL8JJpoIDm wX6t7V/nko868g/t6pkyXVaz/Y2rk0g1IJxoSMxfYuCJ4hNvHv79VJul7ZLYKFDjM/2u 6juJAYDJTFjFrz0VQwyph/5rz2ghV7vlq6rDmNLKV/F2XbEm+nR/SAlbDNWxDTY2AgIA 11Tg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=9xqgUluudFFO5C1nUSkvzdpWoO4JVF+wgannQeY73nY=; b=cfLCBzR+U2Iq96f7kYorfLdX9NU4En9jmsjDqgOWldy+2KCaiY5cgdNYqFPhXIQvPC 6ezqvIH3nOBp5eDapmBS9VAzeA2cwUjWGi33WNN7Q/n6RA401tSvesEKIeKvwYKiBIFK fgo/sgKzS8m+ae0g8cDTWm8HPnX91TXE9KyJDkTcpB8X5caEOGPAmz8J/3Tl1eu0rm6n Y6MFpRrXp+HxsNu79UKPqHSaDtxQTxYkkxBAiSC41lc1KBdOVMxkDe0yuNZvCAJMV68K 4N/jSE7FrLAVFwbOxbBbYSuqnpMMJNagmpVZ+fACnVW2zRi5jo402pvHVtDshXb9OjPa UbOg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c23-v6si535110pli.306.2018.03.13.11.36.12; Tue, 13 Mar 2018 11:36:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752581AbeCMSec (ORCPT + 99 others); Tue, 13 Mar 2018 14:34:32 -0400 Received: from mx2.suse.de ([195.135.220.15]:53592 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751529AbeCMSdz (ORCPT ); Tue, 13 Mar 2018 14:33:55 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id B26DFAF58; Tue, 13 Mar 2018 18:33:53 +0000 (UTC) From: Michal Suchanek To: linuxppc-dev@lists.ozlabs.org Cc: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Peter Zijlstra , Michal Suchanek , Kate Stewart , Greg Kroah-Hartman , Philippe Ombredanne , Nicholas Piggin , "Tobin C. Harding" , Mahesh Salgaonkar , David Gibson , Al Viro , Michael Neuling , "Oliver O'Halloran" , "Naveen N. Rao" , Madhavan Srinivasan , Masami Hiramatsu , Andrew Morton , Balbir Singh , Sergey Senozhatsky , Christophe Leroy , Andrew Donnellan , Daniel Axtens , Russell Currey , Joe Perches , "Bryant G. Ly" , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , linux-kernel@vger.kernel.org Subject: [PATCH RFC 6/8] powerpc/64: barrier_nospec: Add debugfs trigger Date: Tue, 13 Mar 2018 19:33:04 +0100 Message-Id: <614dfe0abb78fffd35f127d0ba78e644e1a0570a.1520965380.git.msuchanek@suse.de> X-Mailer: git-send-email 2.13.6 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Copypasta from rfi implementation Signed-off-by: Michal Suchanek --- 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