[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1c687d0e029de81ae27465dd4c32036e956f4970.1520965380.git.msuchanek@suse.de>
Date: Tue, 13 Mar 2018 19:33:05 +0100
From: Michal Suchanek <msuchanek@...e.de>
To: linuxppc-dev@...ts.ozlabs.org
Cc: Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Paul Mackerras <paulus@...ba.org>,
Michael Ellerman <mpe@...erman.id.au>,
Peter Zijlstra <peterz@...radead.org>,
Michal Suchanek <msuchanek@...e.de>,
Kate Stewart <kstewart@...uxfoundation.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Philippe Ombredanne <pombredanne@...b.com>,
Nicholas Piggin <npiggin@...il.com>,
"Tobin C. Harding" <me@...in.cc>,
Mahesh Salgaonkar <mahesh@...ux.vnet.ibm.com>,
David Gibson <david@...son.dropbear.id.au>,
Al Viro <viro@...iv.linux.org.uk>,
Michael Neuling <mikey@...ling.org>,
"Oliver O'Halloran" <oohall@...il.com>,
"Naveen N. Rao" <naveen.n.rao@...ux.vnet.ibm.com>,
Madhavan Srinivasan <maddy@...ux.vnet.ibm.com>,
Masami Hiramatsu <mhiramat@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Balbir Singh <bsingharora@...il.com>,
Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
Christophe Leroy <christophe.leroy@....fr>,
Andrew Donnellan <andrew.donnellan@....ibm.com>,
Daniel Axtens <dja@...ens.net>,
Russell Currey <ruscur@...sell.cc>,
Joe Perches <joe@...ches.com>,
"Bryant G. Ly" <bryantly@...ux.vnet.ibm.com>,
Cédric Le Goater <clg@...d.org>,
linux-kernel@...r.kernel.org
Subject: [PATCH RFC 7/8] powerpc/64s: barrier_nospec: Add hcall triggerr
Copypasta from rfi implementation
Signed-off-by: Michal Suchanek <msuchanek@...e.de>
---
arch/powerpc/platforms/pseries/setup.c | 38 ++++++++++++++++++++++------------
1 file changed, 25 insertions(+), 13 deletions(-)
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index 1a527625acf7..b779ddb8e250 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -459,38 +459,50 @@ static void __init find_and_init_phbs(void)
of_pci_check_probe_only();
}
-static void pseries_setup_rfi_flush(void)
+static void pseries_setup_rfi_nospec(void)
{
struct h_cpu_char_result result;
- enum l1d_flush_type types;
- bool enable;
+ enum l1d_flush_type flush_types;
+ enum spec_barrier_type barrier_type;
+ bool flush_enable;
+ bool barrier_enable;
long rc;
/* Enable by default */
- enable = true;
+ flush_enable = true;
+ barrier_enable = true;
+ /* no fallback if the firmware does not tell us */
+ barrier_type = SPEC_BARRIER_NONE;
rc = plpar_get_cpu_characteristics(&result);
if (rc == H_SUCCESS) {
- types = L1D_FLUSH_NONE;
+ flush_types = L1D_FLUSH_NONE;
if (result.character & H_CPU_CHAR_L1D_FLUSH_TRIG2)
- types |= L1D_FLUSH_MTTRIG;
+ flush_types |= L1D_FLUSH_MTTRIG;
if (result.character & H_CPU_CHAR_L1D_FLUSH_ORI30)
- types |= L1D_FLUSH_ORI;
+ flush_types |= L1D_FLUSH_ORI;
+ if (result.character & H_CPU_CHAR_SPEC_BAR_ORI31)
+ barrier_type |= SPEC_BARRIER_ORI;
/* Use fallback if nothing set in hcall */
- if (types == L1D_FLUSH_NONE)
- types = L1D_FLUSH_FALLBACK;
+ if (flush_types == L1D_FLUSH_NONE)
+ flush_types = L1D_FLUSH_FALLBACK;
if ((!(result.behaviour & H_CPU_BEHAV_L1D_FLUSH_PR)) ||
(!(result.behaviour & H_CPU_BEHAV_FAVOUR_SECURITY)))
- enable = false;
+ flush_enable = false;
+
+ if ((!(result.behaviour & H_CPU_BEHAV_BNDS_CHK_SPEC_BAR)) ||
+ (!(result.behaviour & H_CPU_BEHAV_FAVOUR_SECURITY)))
+ barrier_enable = false;
} else {
/* Default to fallback if case hcall is not available */
- types = L1D_FLUSH_FALLBACK;
+ flush_types = L1D_FLUSH_FALLBACK;
}
- setup_rfi_flush(types, enable);
+ setup_barrier_nospec(barrier_type, barrier_enable);
+ setup_rfi_flush(flush_types, flush_enable);
}
#ifdef CONFIG_PCI_IOV
@@ -666,7 +678,7 @@ static void __init pSeries_setup_arch(void)
fwnmi_init();
- pseries_setup_rfi_flush();
+ pseries_setup_rfi_nospec();
/* By default, only probe PCI (can be overridden by rtas_pci) */
pci_add_flags(PCI_PROBE_ONLY);
--
2.13.6
Powered by blists - more mailing lists