Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.9 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3E532C004C9 for ; Tue, 7 May 2019 09:56:26 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8E5452053B for ; Tue, 7 May 2019 09:56:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8E5452053B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ellerman.id.au Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 44yw3p6hQrzDqNB for ; Tue, 7 May 2019 19:56:22 +1000 (AEST) Received: from ozlabs.org (bilbo.ozlabs.org [203.11.71.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 44yw2B20tHzDqHR for ; Tue, 7 May 2019 19:54:58 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=ellerman.id.au Received: by ozlabs.org (Postfix) id 44yw2B0rqSz9sB8; Tue, 7 May 2019 19:54:58 +1000 (AEST) Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 44yw296RWtz9sB3; Tue, 7 May 2019 19:54:57 +1000 (AEST) From: Michael Ellerman To: "Christopher M. Riedl" , linuxppc-dev@ozlabs.org Subject: Re: [PATCH v2] powerpc/64s: support nospectre_v2 cmdline option In-Reply-To: <20190507024321.22281-1-cmr@informatik.wtf> References: <20190507024321.22281-1-cmr@informatik.wtf> Date: Tue, 07 May 2019 19:54:55 +1000 Message-ID: <87mujywpw0.fsf@concordia.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Christopher M. Riedl" , ajd@linux.ibm.com Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" "Christopher M. Riedl" writes: > diff --git a/arch/powerpc/kernel/security.c b/arch/powerpc/kernel/security.c > index b33bafb8fcea..d775da9b9227 100644 > --- a/arch/powerpc/kernel/security.c > +++ b/arch/powerpc/kernel/security.c > @@ -391,6 +394,15 @@ static void toggle_count_cache_flush(bool enable) > > void setup_count_cache_flush(void) > { > + if (no_spectrev2) { > + if (security_ftr_enabled(SEC_FTR_BCCTRL_SERIALISED) > + || security_ftr_enabled(SEC_FTR_COUNT_CACHE_DISABLED)) > + pr_warn("Spectre v2 mitigations not under software control, can't disable\n"); > + > + toggle_count_cache_flush(false); > + return; > + } > + > toggle_count_cache_flush(true); > } I'm nit-picking, but would it be better as: void setup_count_cache_flush(void) { bool enable = true; if (no_spectrev2) { if (security_ftr_enabled(SEC_FTR_BCCTRL_SERIALISED) || security_ftr_enabled(SEC_FTR_COUNT_CACHE_DISABLED)) pr_warn("Spectre v2 mitigations not under software control, can't disable\n"); enable = false; } toggle_count_cache_flush(enable); } ??? cheers