Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1955036imm; Thu, 24 May 2018 03:33:21 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrSx58FqUtcsiYhHlUsd00siXI3AHtj8ODPeJnJpN8Ifodid9v2XAazTKNfIPJPc4lC0Hxc X-Received: by 2002:a63:8c4f:: with SMTP id q15-v6mr4511906pgn.236.1527158001917; Thu, 24 May 2018 03:33:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527158001; cv=none; d=google.com; s=arc-20160816; b=kf2t5ZoSjJ9KXlLjNceyDJphaO82plXgX1uBrPkVzoHDAhmnLmy6XV7P0AlV9c1Qf/ ffYNnOzauhGa+GhmS07lwCzw2/SWsJ/d+R8lS4spP/F1DOb3e3vL86KkFZQUmwLfdPYc 6aL4hUz1VqDKlH1lwOaA546ufxDV5on5CXPYU+RkhXUJ1hwl88qKeLaOVyg81qCJaq86 xqWCw2cKl5gHbh3A1HdDh5K4YI96OgewMq6eQ0hGSU4vsDZ6MhM+LfVhLgW35phYCx2v 8NoggYvg4ru9pdAMry+axK73glHuFED0B9lPWJhfqisdMMmf4pMCvV7IHWTypfJ5x+eO EeIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=MeEaFOk0MGNSQPypQCHfNEMqtZ0DZyXw7LeuV9+vKO0=; b=D/a8W55ENR4yV5iH0NXxHNlWNddP7pFYnSbN8vsG/lc+IKTqmhDbVlquKCNwHZacpv O+eRtf1uH9gnr2QMPiD2Vs/2v5WhnND0CMNyKsvDxHaGlRaIh+/cDEUsW8fZklwpe8Ba OBW59+Z1yuUeC6AqaZ4uJY79blEYXAYbMgVyoD4N5IySwfUpCPBkhAbrY8HqkdkUVYOj 82z1I9rPvGO+D8xsQ/Sc40kuhixAdpTQYq2eaIkxj1Wiin7v7Iscw3lAFGHdSJmsdWV5 RsdG1wG3HZQJD77RWXl7uzIVyNx5DH9uiWmqxxKpegfbasiPWagYvocNm8o0ai8tyYlJ dBLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=cB8HFQkl; 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 r126-v6si21387032pfc.202.2018.05.24.03.33.07; Thu, 24 May 2018 03:33:21 -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=cB8HFQkl; 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 S968499AbeEXKAw (ORCPT + 99 others); Thu, 24 May 2018 06:00:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:43762 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S968486AbeEXKAp (ORCPT ); Thu, 24 May 2018 06:00:45 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (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 4AE112088E; Thu, 24 May 2018 10:00:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527156044; bh=xMyAHp/Yk26rdl344fdtkwhuoqcgv60jnNz02QeJvNE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cB8HFQklR+wR6xbmFUzdsBHxITIo9fcyjpTZCLQMBUvrtIiZfnuq2HCdxyKjGVqgR goZAqYYXYF1HQN1lmXDTzSyXWS356LJrSM2qg6N2qN7jEpp2+TQYHJhvkrwbkOHzSH v0ZdxyFfZLfIzh0p74ADO5jtsY7WekYUyKIhob2I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, greg@kroah.com Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Ellerman Subject: [PATCH 4.16 043/161] powerpc/pseries: Use the security flags in pseries_setup_rfi_flush() Date: Thu, 24 May 2018 11:37:48 +0200 Message-Id: <20180524093023.538534106@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180524093018.331893860@linuxfoundation.org> References: <20180524093018.331893860@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.16-stable review patch. If anyone has any objections, please let me know. ------------------ From: Michael Ellerman commit 2e4a16161fcd324b1f9bf6cb6856529f7eaf0689 upstream. Now that we have the security flags we can simplify the code in pseries_setup_rfi_flush() because the security flags have pessimistic defaults. Signed-off-by: Michael Ellerman Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/platforms/pseries/setup.c | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) --- a/arch/powerpc/platforms/pseries/setup.c +++ b/arch/powerpc/platforms/pseries/setup.c @@ -501,30 +501,27 @@ static void pseries_setup_rfi_flush(void bool enable; long rc; - /* Enable by default */ - enable = true; - types = L1D_FLUSH_FALLBACK; - rc = plpar_get_cpu_characteristics(&result); - if (rc == H_SUCCESS) { + if (rc == H_SUCCESS) init_cpu_char_feature_flags(&result); - if (result.character & H_CPU_CHAR_L1D_FLUSH_TRIG2) - types |= L1D_FLUSH_MTTRIG; - if (result.character & H_CPU_CHAR_L1D_FLUSH_ORI30) - types |= L1D_FLUSH_ORI; - - if ((!(result.behaviour & H_CPU_BEHAV_L1D_FLUSH_PR)) || - (!(result.behaviour & H_CPU_BEHAV_FAVOUR_SECURITY))) - enable = false; - } - /* * We're the guest so this doesn't apply to us, clear it to simplify * handling of it elsewhere. */ security_ftr_clear(SEC_FTR_L1D_FLUSH_HV); + types = L1D_FLUSH_FALLBACK; + + if (security_ftr_enabled(SEC_FTR_L1D_FLUSH_TRIG2)) + types |= L1D_FLUSH_MTTRIG; + + if (security_ftr_enabled(SEC_FTR_L1D_FLUSH_ORI30)) + types |= L1D_FLUSH_ORI; + + enable = security_ftr_enabled(SEC_FTR_FAVOUR_SECURITY) && \ + security_ftr_enabled(SEC_FTR_L1D_FLUSH_PR); + setup_rfi_flush(types, enable); }