From: Michal Suchanek <msuchanek@suse.de>
To: linuxppc-dev@lists.ozlabs.org
Cc: "Kate Stewart" <kstewart@linuxfoundation.org>,
"Madhavan Srinivasan" <maddy@linux.vnet.ibm.com>,
"Paul Mackerras" <paulus@samba.org>,
"Michael Neuling" <mikey@neuling.org>,
"Bryant G. Ly" <bryantly@linux.vnet.ibm.com>,
"Mahesh Salgaonkar" <mahesh@linux.vnet.ibm.com>,
"Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>,
"Daniel Axtens" <dja@axtens.net>,
"Nicholas Piggin" <npiggin@gmail.com>,
"Al Viro" <viro@zeniv.linux.org.uk>,
"David Gibson" <david@gibson.dropbear.id.au>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
linux-kernel@vger.kernel.org,
"Sergey Senozhatsky" <sergey.senozhatsky@gmail.com>,
"Cédric Le Goater" <clg@kaod.org>,
"Masami Hiramatsu" <mhiramat@kernel.org>,
"Andrew Donnellan" <andrew.donnellan@au1.ibm.com>,
"Philippe Ombredanne" <pombredanne@nexb.com>,
"Joe Perches" <joe@perches.com>,
"Oliver O'Halloran" <oohall@gmail.com>,
"Andrew Morton" <akpm@linux-foundation.org>,
"Tobin C. Harding" <me@tobin.cc>,
"Michal Suchanek" <msuchanek@suse.de>
Subject: [PATCH RFC rebase 8/9] powerpc/64s: barrier_nospec: Add hcall triggerr
Date: Thu, 15 Mar 2018 20:15:57 +0100 [thread overview]
Message-ID: <54913b22e2f3647c670b6fb3e1fecce34729b736.1521141122.git.msuchanek@suse.de> (raw)
In-Reply-To: <cover.1521141122.git.msuchanek@suse.de>
In-Reply-To: <cover.1521141122.git.msuchanek@suse.de>
Adapted from the RFI implementation
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
---
arch/powerpc/platforms/pseries/mobility.c | 2 +-
arch/powerpc/platforms/pseries/pseries.h | 2 +-
arch/powerpc/platforms/pseries/setup.c | 37 ++++++++++++++++++++++---------
3 files changed, 29 insertions(+), 12 deletions(-)
diff --git a/arch/powerpc/platforms/pseries/mobility.c b/arch/powerpc/platforms/pseries/mobility.c
index 8a8033a249c7..9d506be1580e 100644
--- a/arch/powerpc/platforms/pseries/mobility.c
+++ b/arch/powerpc/platforms/pseries/mobility.c
@@ -349,7 +349,7 @@ void post_mobility_fixup(void)
"failed: %d\n", rc);
/* Possibly switch to a new RFI flush type */
- pseries_setup_rfi_flush();
+ pseries_setup_rfi_nospec();
return;
}
diff --git a/arch/powerpc/platforms/pseries/pseries.h b/arch/powerpc/platforms/pseries/pseries.h
index 27cdcb69fd18..d49670c67686 100644
--- a/arch/powerpc/platforms/pseries/pseries.h
+++ b/arch/powerpc/platforms/pseries/pseries.h
@@ -100,6 +100,6 @@ static inline unsigned long cmo_get_page_size(void)
int dlpar_workqueue_init(void);
-void pseries_setup_rfi_flush(void);
+void pseries_setup_rfi_nospec(void);
#endif /* _PSERIES_PSERIES_H */
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index 9877c3dfcdc8..4b899a4db6dd 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -459,30 +459,47 @@ static void __init find_and_init_phbs(void)
of_pci_check_probe_only();
}
-void pseries_setup_rfi_flush(void)
+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;
- types = L1D_FLUSH_FALLBACK;
+ flush_enable = true;
+ flush_types = L1D_FLUSH_FALLBACK;
+ barrier_enable = true;
+ /* no fallback available if the firmware does not tell us */
+ barrier_type = SPEC_BARRIER_NONE;
rc = plpar_get_cpu_characteristics(&result);
if (rc == H_SUCCESS) {
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;
if ((!(result.behaviour & H_CPU_BEHAV_L1D_FLUSH_PR)) ||
(!(result.behaviour & H_CPU_BEHAV_FAVOUR_SECURITY)))
- enable = false;
+ flush_enable = false;
+ /*
+ * Do not check H_CPU_BEHAV_BNDS_CHK_SPEC_BAR - the ORI does
+ * nothing anyway when not supported.
+ */
+ if ((!(result.behaviour & H_CPU_BEHAV_FAVOUR_SECURITY)))
+ barrier_enable = false;
+ } else {
+ /* Default to fallback if case hcall is not available */
+ 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
@@ -658,7 +675,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
next prev parent reply other threads:[~2018-03-15 19:15 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-13 18:32 [PATCH RFC 0/8] powerpc barrier_nospec Michal Suchanek
2018-03-13 18:32 ` [PATCH RFC 1/8] powerpc: Add barrier_nospec Michal Suchanek
2018-03-13 20:01 ` Peter Zijlstra
2018-03-15 19:15 ` [PATCH RFC rebase 0/9] powerpc barrier_nospec Michal Suchanek
2018-03-15 19:15 ` [PATCH RFC rebase 1/9] powerpc: Add barrier_nospec Michal Suchanek
2018-03-15 19:15 ` [PATCH RFC rebase 2/9] powerpc: Use barrier_nospec in copy_from_user Michal Suchanek
2018-03-15 21:37 ` Linus Torvalds
2018-03-16 13:22 ` Michael Ellerman
2018-03-15 19:15 ` [PATCH RFC rebase 3/9] powerpc/64: Use barrier_nospec in syscall entry Michal Suchanek
2018-03-16 5:18 ` Nicholas Piggin
2018-03-16 9:15 ` Michal Suchánek
2018-03-16 10:46 ` Nicholas Piggin
2018-03-16 13:28 ` Michael Ellerman
2018-03-16 17:08 ` Linus Torvalds
2018-03-15 19:15 ` [PATCH RFC rebase 4/9] powerpc/64s: Use barrier_nospec in RFI_FLUSH_SLOT Michal Suchanek
2018-03-15 19:15 ` [PATCH RFC rebase 5/9] powerpc/64s: Add support for ori barrier_nospec patching Michal Suchanek
2018-03-15 19:15 ` [PATCH RFC rebase 6/9] powerpc/64: Patch barrier_nospec in modules Michal Suchanek
2018-03-15 19:15 ` [PATCH RFC rebase 7/9] powerpc/64: barrier_nospec: Add debugfs trigger Michal Suchanek
2018-03-15 19:15 ` Michal Suchanek [this message]
2018-03-15 19:15 ` [PATCH RFC rebase 9/9] powerpc/64: barrier_nospec: Add commandline trigger Michal Suchanek
2018-03-23 15:59 ` Diana Madalina Craciun
2018-03-16 8:08 ` [PATCH RFC rebase 0/9] powerpc barrier_nospec Greg Kroah-Hartman
2018-03-16 9:31 ` Michal Suchánek
2018-03-13 18:33 ` [PATCH RFC 2/8] powerpc: Use barrier_nospec in copy_from_user Michal Suchanek
2018-03-13 18:33 ` [PATCH RFC 3/8] powerpc/64: Use barrier_nospec in syscall entry Michal Suchanek
2018-03-13 18:33 ` [PATCH RFC 4/8] powerpc/64s: Add support for ori barrier_nospec Michal Suchanek
2018-03-13 18:33 ` [PATCH RFC 5/8] powerpc/64: Patch barrier_nospec in modules Michal Suchanek
2018-03-13 18:33 ` [PATCH RFC 6/8] powerpc/64: barrier_nospec: Add debugfs trigger Michal Suchanek
2018-03-13 18:33 ` [PATCH RFC 7/8] powerpc/64s: barrier_nospec: Add hcall triggerr Michal Suchanek
2018-03-13 18:33 ` [PATCH RFC 8/8] powerpc/64: barrier_nospec: Add commandline trigger Michal Suchanek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54913b22e2f3647c670b6fb3e1fecce34729b736.1521141122.git.msuchanek@suse.de \
--to=msuchanek@suse.de \
--cc=akpm@linux-foundation.org \
--cc=andrew.donnellan@au1.ibm.com \
--cc=bryantly@linux.vnet.ibm.com \
--cc=clg@kaod.org \
--cc=david@gibson.dropbear.id.au \
--cc=dja@axtens.net \
--cc=gregkh@linuxfoundation.org \
--cc=joe@perches.com \
--cc=kstewart@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.vnet.ibm.com \
--cc=mahesh@linux.vnet.ibm.com \
--cc=me@tobin.cc \
--cc=mhiramat@kernel.org \
--cc=mikey@neuling.org \
--cc=naveen.n.rao@linux.vnet.ibm.com \
--cc=npiggin@gmail.com \
--cc=oohall@gmail.com \
--cc=paulus@samba.org \
--cc=pombredanne@nexb.com \
--cc=sergey.senozhatsky@gmail.com \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).