Received: by 10.213.65.68 with SMTP id h4csp147378imn; Thu, 15 Mar 2018 12:17:57 -0700 (PDT) X-Google-Smtp-Source: AG47ELvvvzkAzVd1HeAWAaB5e0CQG0/RbnI4YfQCkTsLu4mqbIz27FMcWrQAQuI2j5haOgEcFjiZ X-Received: by 10.99.126.73 with SMTP id o9mr7678159pgn.406.1521141477327; Thu, 15 Mar 2018 12:17:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521141477; cv=none; d=google.com; s=arc-20160816; b=K6BJ6zneVA0opwcqviXt0WK4qRTCY7SLkjVYI7M4fMXsnRb6p29fqYkkgtaNlfGJv8 BhDaSFHmOBq/vrqk6YIcokHGy+wMIFBx2mVfIDjWjzYJRWQQZpzJRM4DLk6Kh5F9p/Gg l8C18KRp6EqS9kZ5kjrpGg2deXiJtLA1QUWqyCwIxFqRMxu7KZ08zJMoaWlCNXPxe1i6 XjXub3Ljh0luma3d2IP1hfIOe3yB0AbKMno6MVTevnRZ7ams46zwiQ8l7Hjanp+vF18E mVKDULLtYz48eLEhvVgp+5upuidTkUZKHfIoZk6jB9zBwEqk40hYyMn+C8z9uON5z0bT zT2g== 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=XUfm8YYgtxGynaHkC+bobRw6IFwZa1ner4MwuzA4+Ss=; b=FRFABu5xAaLj9I6RHyywRnbRq6q32Z6m8964yG1YX1wuANvd6T4WdgqKG1ll4ChZGi /q6JNr3E7qRcg7pVHxrA1mr29A/0six7b6T4YUi5UiF/+FZlJC7PCSeEP2oOt8YF9IJl /I1FaJ6JWHGMq8UzUuGjJV54geL8y8pF5ftTIKpAgRMoGVG5bGfBxfoJS8J2Na8TxiGT 6T1W1XairkyPO1AiRXZpq/ju2Khncz6aiJyh/RaVahFvmt//G/JYHZAOH8nypSWn5qO4 bMBkYp+xVvPY14FL1c9i793GOleLDIX+GtdG+BSuFMg4MyJWjVQ9HMB6xyE5T3Bir6si Meww== 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 h5si3815175pgn.402.2018.03.15.12.17.42; Thu, 15 Mar 2018 12:17:57 -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 S1751572AbeCOTQd (ORCPT + 99 others); Thu, 15 Mar 2018 15:16:33 -0400 Received: from mx2.suse.de ([195.135.220.15]:45205 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753037AbeCOTQZ (ORCPT ); Thu, 15 Mar 2018 15:16:25 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 92538AFB7; Thu, 15 Mar 2018 19:16:24 +0000 (UTC) From: Michal Suchanek To: linuxppc-dev@lists.ozlabs.org Cc: Kate Stewart , Madhavan Srinivasan , Paul Mackerras , Michael Neuling , "Bryant G. Ly" , Mahesh Salgaonkar , "Naveen N. Rao" , Daniel Axtens , Nicholas Piggin , Al Viro , David Gibson , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, Sergey Senozhatsky , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Masami Hiramatsu , Andrew Donnellan , Philippe Ombredanne , Joe Perches , Oliver O'Halloran , Andrew Morton , "Tobin C. Harding" , Michal Suchanek Subject: [PATCH RFC rebase 7/9] powerpc/64: barrier_nospec: Add debugfs trigger Date: Thu, 15 Mar 2018 20:15:56 +0100 Message-Id: <3fe550ea345920af7edea4f4d24ba075430ca9d0.1521141122.git.msuchanek@suse.de> X-Mailer: git-send-email 2.13.6 In-Reply-To: References: <20180313200108.GA4082@hirez.programming.kicks-ass.net> 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 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