Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2449118yba; Mon, 15 Apr 2019 11:52:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqwXsgdL2TCW0N5/dDYUeUQykQT7M3aLAgMoXb9ACJeEc7F8ff+Kob6a6OLZ4VCu1/Niafy3 X-Received: by 2002:a17:902:e709:: with SMTP id co9mr78171019plb.86.1555354353800; Mon, 15 Apr 2019 11:52:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555354353; cv=none; d=google.com; s=arc-20160816; b=GehWD7KVCoorNemMmG8RIDSkyJan+dgoy+X/zGxbmtLC2+BUd0ROvlqaZ3in/svl/B CzfaFRaWZXHl0fHvaQ7vwukBmiErbxTL10ppxMHDHWFHb2qlPtzJ3U4uc+WYIDSWBiO4 AlBs+ZQk/iaVTP+kxn/agaCB+Rsa2pbbYHlAPSrtPtgCOwW3aBVtQrlNRgxWGPcmYJNZ z8eaMbXD7yA9gYDRzs63c47b2iEVhN7CZjUJfqY4BpAlc0gcCgvdqth/QOTzEev0mIhj pl+wgMDPJB28+/Q5agioxt2OHdZSdpYyM36WwR9g4y57jrO2nmkbHYhljgtq1n1E601z /TUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=OSxp/xaipcP91UkNdkT/uYwBtaqqbfTLXUWlLDKDH7k=; b=Htw594feE5gaXAyaaNuFzD/iooHm9tJ3MPsV5FPUQkpe0twbfKuXJW3ODfHFHEPajb Qp+9mSDhFBGkLMVoqZe487MDacJmUSRA5zpQ+ThWNyoNlKUWiEEh59qmn04MFdQWnvqG HP+N8sWiqDKShWfe9xPH6mCwYNW5Dqw28QwHrKl87rdi7WKCylSz7s80exO/kxiXe/SN KQXgIpU4QkBElAsGNHJ12fGUFD2uQ+1zviGQu6XZFXBmyhih1O5m+HY99Qse9pmMkAYI pzLy0hKZ+Zw8yrTnnQrvkgzoj4KT/Ozgms2F2utW10qACnrSyyV88JiDWC6lGOAhPXN4 uyow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=kuk5stXa; 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 l184si29467950pge.425.2019.04.15.11.52.17; Mon, 15 Apr 2019 11:52:33 -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; dkim=pass header.i=@kernel.org header.s=default header.b=kuk5stXa; 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 S1728533AbfDOSqM (ORCPT + 99 others); Mon, 15 Apr 2019 14:46:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:48728 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728511AbfDOSqH (ORCPT ); Mon, 15 Apr 2019 14:46:07 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A76792087C; Mon, 15 Apr 2019 18:46:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555353966; bh=uQVN4YjdpOiOYhOblB5qUPgSrZR6ogBCuS0yQjco0+0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kuk5stXaVMWzwv+xRInFQ+Iz4CLKtRlJMHXg9XDBVHAZzA5/XxAwH3qi5uw8ARUc4 oqW6n3I8SJna001IoH6ZvMuARY8OfhzeftzXdh+2byO805BkJ07Te9Iuq3qsMb5Qma +qvsAaHVFfJF8VVxA7o2bexKXKJaMIy9YSiorkmQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Diana Craciun , Michael Ellerman , Sasha Levin Subject: [PATCH 4.9 36/76] powerpc/fsl: Add nospectre_v2 command line argument Date: Mon, 15 Apr 2019 20:44:00 +0200 Message-Id: <20190415183717.159908152@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190415183707.712011689@linuxfoundation.org> References: <20190415183707.712011689@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org commit f633a8ad636efb5d4bba1a047d4a0f1ef719aa06 upstream. When the command line argument is present, the Spectre variant 2 mitigations are disabled. Signed-off-by: Diana Craciun Signed-off-by: Michael Ellerman Signed-off-by: Sasha Levin --- arch/powerpc/include/asm/setup.h | 5 +++++ arch/powerpc/kernel/security.c | 21 +++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/arch/powerpc/include/asm/setup.h b/arch/powerpc/include/asm/setup.h index 23ee67e279ae..862ebce3ae54 100644 --- a/arch/powerpc/include/asm/setup.h +++ b/arch/powerpc/include/asm/setup.h @@ -65,6 +65,11 @@ void do_barrier_nospec_fixups_range(bool enable, void *start, void *end); static inline void do_barrier_nospec_fixups_range(bool enable, void *start, void *end) { }; #endif +#ifdef CONFIG_PPC_FSL_BOOK3E +void setup_spectre_v2(void); +#else +static inline void setup_spectre_v2(void) {}; +#endif void do_btb_flush_fixups(void); #endif /* !__ASSEMBLY__ */ diff --git a/arch/powerpc/kernel/security.c b/arch/powerpc/kernel/security.c index fc41bccd9ab6..6dc5cdc2b87c 100644 --- a/arch/powerpc/kernel/security.c +++ b/arch/powerpc/kernel/security.c @@ -27,6 +27,10 @@ static enum count_cache_flush_type count_cache_flush_type = COUNT_CACHE_FLUSH_NO bool barrier_nospec_enabled; static bool no_nospec; +static bool btb_flush_enabled; +#ifdef CONFIG_PPC_FSL_BOOK3E +static bool no_spectrev2; +#endif static void enable_barrier_nospec(bool enable) { @@ -102,6 +106,23 @@ static __init int barrier_nospec_debugfs_init(void) device_initcall(barrier_nospec_debugfs_init); #endif /* CONFIG_DEBUG_FS */ +#ifdef CONFIG_PPC_FSL_BOOK3E +static int __init handle_nospectre_v2(char *p) +{ + no_spectrev2 = true; + + return 0; +} +early_param("nospectre_v2", handle_nospectre_v2); +void setup_spectre_v2(void) +{ + if (no_spectrev2) + do_btb_flush_fixups(); + else + btb_flush_enabled = true; +} +#endif /* CONFIG_PPC_FSL_BOOK3E */ + #ifdef CONFIG_PPC_BOOK3S_64 ssize_t cpu_show_meltdown(struct device *dev, struct device_attribute *attr, char *buf) { -- 2.19.1