Return-Path: Received: from mail-co1nam03on0106.outbound.protection.outlook.com ([104.47.40.106]:30688 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1032310AbeCAPdt (ORCPT ); Thu, 1 Mar 2018 10:33:49 -0500 From: Sasha Levin To: "stable@vger.kernel.org" , "stable-commits@vger.kernel.org" CC: Michael Neuling , Michael Ellerman , Sasha Levin Subject: [added to the 4.1 stable tree] powerpc/pseries: Query hypervisor for RFI flush settings Date: Thu, 1 Mar 2018 15:25:48 +0000 Message-ID: <20180301152116.1486-303-alexander.levin@microsoft.com> References: <20180301152116.1486-1-alexander.levin@microsoft.com> In-Reply-To: <20180301152116.1486-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Michael Neuling This patch has been added to the 4.1 stable tree. If you have any objections, please let us know. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D [ Upstream commit 8989d56878a7735dfdb234707a2fee6faf631085 ] A new hypervisor call is available which tells the guest settings related to the RFI flush. Use it to query the appropriate flush instruction(s), and whether the flush is required. Signed-off-by: Michael Neuling Signed-off-by: Michael Ellerman Signed-off-by: Sasha Levin --- arch/powerpc/platforms/pseries/setup.c | 37 ++++++++++++++++++++++++++++++= +++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platform= s/pseries/setup.c index e6e8b241d717..b4867b4d5a1e 100644 --- a/arch/powerpc/platforms/pseries/setup.c +++ b/arch/powerpc/platforms/pseries/setup.c @@ -507,6 +507,39 @@ static void __init find_and_init_phbs(void) } } =20 +static void pseries_setup_rfi_flush(void) +{ + struct h_cpu_char_result result; + enum l1d_flush_type types; + bool enable; + long rc; + + /* Enable by default */ + enable =3D true; + + rc =3D plpar_get_cpu_characteristics(&result); + if (rc =3D=3D H_SUCCESS) { + types =3D L1D_FLUSH_NONE; + + if (result.character & H_CPU_CHAR_L1D_FLUSH_TRIG2) + types |=3D L1D_FLUSH_MTTRIG; + if (result.character & H_CPU_CHAR_L1D_FLUSH_ORI30) + types |=3D L1D_FLUSH_ORI; + + /* Use fallback if nothing set in hcall */ + if (types =3D=3D L1D_FLUSH_NONE) + types =3D L1D_FLUSH_FALLBACK; + + if (!(result.behaviour & H_CPU_BEHAV_L1D_FLUSH_PR)) + enable =3D false; + } else { + /* Default to fallback if case hcall is not available */ + types =3D L1D_FLUSH_FALLBACK; + } + + setup_rfi_flush(types, enable); +} + static void __init pSeries_setup_arch(void) { set_arch_panic_timeout(10, ARCH_PANIC_TIMEOUT); @@ -523,7 +556,9 @@ static void __init pSeries_setup_arch(void) =20 fwnmi_init(); =20 - /* By default, only probe PCI (can be overriden by rtas_pci) */ + pseries_setup_rfi_flush(); + + /* By default, only probe PCI (can be overridden by rtas_pci) */ pci_add_flags(PCI_PROBE_ONLY); =20 /* Find and initialize PCI host bridges */ --=20 2.14.1