Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935265AbeAHQ4W (ORCPT + 1 other); Mon, 8 Jan 2018 11:56:22 -0500 Received: from ozlabs.org ([103.22.144.67]:33605 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932368AbeAHQzx (ORCPT ); Mon, 8 Jan 2018 11:55:53 -0500 From: Michael Ellerman To: linuxppc-dev@ozlabs.org Cc: linux-kernel@vger.kernel.org, tglx@linutronix.de, peterz@infradead.org, npiggin@gmail.com, anton@samba.org, mikey@neuling.org, oohall@gmail.com, paulus@samba.org Subject: [PATCH 10/11] powerpc/pseries: Query hypervisor for RFI flush settings Date: Tue, 9 Jan 2018 03:54:52 +1100 Message-Id: <20180108165453.26066-10-mpe@ellerman.id.au> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180108165453.26066-1-mpe@ellerman.id.au> References: <20180108165453.26066-1-mpe@ellerman.id.au> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: From: Michael Neuling 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 --- arch/powerpc/platforms/pseries/setup.c | 35 ++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c index 28b286df0e91..db76963e693d 100644 --- a/arch/powerpc/platforms/pseries/setup.c +++ b/arch/powerpc/platforms/pseries/setup.c @@ -459,6 +459,39 @@ static void __init find_and_init_phbs(void) 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); @@ -476,6 +509,8 @@ static void __init pSeries_setup_arch(void) fwnmi_init(); + pseries_setup_rfi_flush(); + /* By default, only probe PCI (can be overridden by rtas_pci) */ pci_add_flags(PCI_PROBE_ONLY); -- 2.14.3