Received: by 10.223.185.116 with SMTP id b49csp2383954wrg; Thu, 15 Feb 2018 10:46:54 -0800 (PST) X-Google-Smtp-Source: AH8x2241VapTwrFYQ88PiCdiGXu86MRAk9IoV6vzvvEtjN9owvDPMV3VF8eyS6pVcL2taygjCNzV X-Received: by 10.99.60.72 with SMTP id i8mr2892542pgn.399.1518720413913; Thu, 15 Feb 2018 10:46:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518720413; cv=none; d=google.com; s=arc-20160816; b=IKbJqoT2NEFFTBCWrCjWHGre4BzVusfYcgfBLECbXv/6EGf+duaI3oRkMvqq2P+9eg gvja2ZYTKCu4Uyo97FR2CK/JngtJZx9Y72I3Cfswv+cROdgVbTVJKJHVXnonfN+X2lVq PCEE7lxjZAEcLBacfYaBytR7aOnRjIV2rS0HmDvQzm9FLO8Ixt2DDpr6tYnKKsRuQGir vUW+jGaL1jzXAO35QO3pIFGesFRcD4vcUL3engJAIHmE7Skbf/FF4Fa1pLy9pw8Xoucc zQNWYusPbnd4AlDY90LDuix8tcfC8O3rft5XSqPhC8mXgl2P8F8yH7NuTreXA/gk2n71 mSaQ== 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 :arc-authentication-results; bh=PKMSvQ6UD9enXgLyfhppuqLG/AKV4XN9AoC6uYGmokE=; b=YubTBs5lqcZISXgCgqY1l5nXBdBKrzu8P1cqWVg1FMZXJQXETxL+iUVU0czVWfOCsi 5ROSzk59Zd+NQdqWlH5JeiOGQEFRFO1TtO1Z2iuLS/C4f6w2oSm9xPnYmpUePazqb9OX 4cjK3RBOVWWE6PGSy7z1PCdi5LHmQt5oDChp3wHJ/4LbDWp+TqK1mhlGAFOexP6KKDMH 8ZiJ2R2t51YiM2cZg9VAVFfqgqFT8hVCTc78UM25SzLT7vCxiIRMo9WMbIYgtSpn/X0K W7b2rMgEELZLEPn1kelzEVfOhU8xnUW0eUgxQLGzciYWBya11tkmtCHTQcQ7wmLppSc+ xbUQ== 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 c11-v6si1738178pll.95.2018.02.15.10.46.39; Thu, 15 Feb 2018 10:46:53 -0800 (PST) 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 S1166879AbeBOSph (ORCPT + 99 others); Thu, 15 Feb 2018 13:45:37 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:50288 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1162468AbeBOPWx (ORCPT ); Thu, 15 Feb 2018 10:22:53 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id A8B1CEA1; Thu, 15 Feb 2018 15:22:36 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Neuling , Michael Ellerman Subject: [PATCH 4.4 013/108] powerpc/pseries: Query hypervisor for RFI flush settings Date: Thu, 15 Feb 2018 16:16:10 +0100 Message-Id: <20180215151224.307039604@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180215151222.267507937@linuxfoundation.org> References: <20180215151222.267507937@linuxfoundation.org> User-Agent: quilt/0.65 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.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Michael Neuling commit 8989d56878a7735dfdb234707a2fee6faf631085 upstream. 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: Greg Kroah-Hartman --- arch/powerpc/platforms/pseries/setup.c | 37 ++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) --- a/arch/powerpc/platforms/pseries/setup.c +++ b/arch/powerpc/platforms/pseries/setup.c @@ -499,6 +499,39 @@ static void __init find_and_init_phbs(vo of_pci_check_probe_only(); } +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 = true; + + rc = plpar_get_cpu_characteristics(&result); + if (rc == H_SUCCESS) { + types = L1D_FLUSH_NONE; + + 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; + + /* Use fallback if nothing set in hcall */ + if (types == L1D_FLUSH_NONE) + types = L1D_FLUSH_FALLBACK; + + if (!(result.behaviour & H_CPU_BEHAV_L1D_FLUSH_PR)) + enable = false; + } else { + /* Default to fallback if case hcall is not available */ + types = L1D_FLUSH_FALLBACK; + } + + setup_rfi_flush(types, enable); +} + static void __init pSeries_setup_arch(void) { set_arch_panic_timeout(10, ARCH_PANIC_TIMEOUT); @@ -515,7 +548,9 @@ static void __init pSeries_setup_arch(vo fwnmi_init(); - /* 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); /* Find and initialize PCI host bridges */