From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: AH8x227WLpVJu4OmSdGC7P8/w2DqV7+SjQVxDSZr9adNERCTzirEALS0RcKTKW8Cst1OhitXmZt8 ARC-Seal: i=1; a=rsa-sha256; t=1516611038; cv=none; d=google.com; s=arc-20160816; b=ViKd3N8ax6/i+xcZEFxXJkfKmBVBXSWRJP3gJ4k/y2eRX6lms6ZKNdVP3bkzgPsH/H sdi2V1L2iGxpfqKsQukN9Y4xl8fmq3jDytdMl77DQmLkkcS1RP6VDGC2so+6YcW390Os D1BDbMAkALysdpoH7I18eHttWSob9luHs7okVqMkNkWtXHCCAVSkikqIb4NI85l0TluT HFPKSc5/Ij5gG8cy37083gtD+AEMNQuYUrGc3l38uFOjtZ2RAP37bLyjM9ukKgKNVAuB Mu1OlLXoHntnfEbxGyQHW7OSBTH6U0ljvbCgwx0P5Qlk1rCctVhi37/tWsNcGpq86xss pGHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=yK1WgIXqmAcVi73tT8UcgNgR0ORME3Elnaw/9dnX0fI=; b=ZPE/1qCW63Da7s2OCNnoC8pYBzz4QQ2tgHTjLj6+VYPyb7DyRnxlnkx8HbdGSqSoWL 812/OgNfKLS4M/3981nT1svXAb3oX0TjpMFqc4L0htf9SvveEH7Vs5nOGsv0zWkbseeC VSkYpAgyHfd5TPGstpcbXoWnkpLt9cjCui4ycnz3lFNf4A0/AbGs1cbEGZmf2z4yaNDd pRjKLsvJyzE/N533hWiNStHC1z3oqW1ip2DC1ZS4nfKIcN48zIYQcbDxOWeqyGcS+fbJ iVU4Zb4KU485g00vIxFUVJiC/36AyGLLfblrcmrkhR7ge0dN4qmSHR+b8zqBo3D1DUu6 MUKQ== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning gregkh@linuxfoundation.org does not designate 90.92.71.90 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning gregkh@linuxfoundation.org does not designate 90.92.71.90 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org 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.14 14/89] powerpc/pseries: Query hypervisor for RFI flush settings Date: Mon, 22 Jan 2018 09:44:54 +0100 Message-Id: <20180122083956.108886736@linuxfoundation.org> X-Mailer: git-send-email 2.16.0 In-Reply-To: <20180122083954.683903493@linuxfoundation.org> References: <20180122083954.683903493@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-LABELS: =?utf-8?b?IlxcU2VudCI=?= X-GMAIL-THRID: =?utf-8?q?1590281936059047964?= X-GMAIL-MSGID: =?utf-8?q?1590281936059047964?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: 4.14-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 | 35 +++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) --- 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(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); @@ -476,6 +509,8 @@ static void __init pSeries_setup_arch(vo fwnmi_init(); + pseries_setup_rfi_flush(); + /* By default, only probe PCI (can be overridden by rtas_pci) */ pci_add_flags(PCI_PROBE_ONLY);