From: Nicholas Piggin <npiggin@gmail.com>
Cc: linuxppc-dev@lists.ozlabs.org, Nicholas Piggin <npiggin@gmail.com>
Subject: [PATCH 2/7] powerpc/security: change link stack flush state to the flush type enum
Date: Tue, 9 Jun 2020 16:16:26 +1000 [thread overview]
Message-ID: <20200609061631.844390-3-npiggin@gmail.com> (raw)
In-Reply-To: <20200609061631.844390-1-npiggin@gmail.com>
Prepare to allow for hardware link stack flushing by using the
none/sw/hw type, same as the count cache state.
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
arch/powerpc/kernel/security.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/arch/powerpc/kernel/security.c b/arch/powerpc/kernel/security.c
index df2a3eff950b..28f4cb062f69 100644
--- a/arch/powerpc/kernel/security.c
+++ b/arch/powerpc/kernel/security.c
@@ -27,7 +27,7 @@ enum branch_cache_flush_type {
BRANCH_CACHE_FLUSH_HW = 0x4,
};
static enum branch_cache_flush_type count_cache_flush_type = BRANCH_CACHE_FLUSH_NONE;
-static bool link_stack_flush_enabled;
+static enum branch_cache_flush_type link_stack_flush_type = BRANCH_CACHE_FLUSH_NONE;
bool barrier_nospec_enabled;
static bool no_nospec;
@@ -219,7 +219,7 @@ ssize_t cpu_show_spectre_v2(struct device *dev, struct device_attribute *attr, c
if (ccd)
seq_buf_printf(&s, "Indirect branch cache disabled");
- if (link_stack_flush_enabled)
+ if (link_stack_flush_type == BRANCH_CACHE_FLUSH_SW)
seq_buf_printf(&s, ", Software link stack flush");
} else if (count_cache_flush_type != BRANCH_CACHE_FLUSH_NONE) {
@@ -228,7 +228,7 @@ ssize_t cpu_show_spectre_v2(struct device *dev, struct device_attribute *attr, c
if (count_cache_flush_type == BRANCH_CACHE_FLUSH_HW)
seq_buf_printf(&s, " (hardware accelerated)");
- if (link_stack_flush_enabled)
+ if (link_stack_flush_type == BRANCH_CACHE_FLUSH_SW)
seq_buf_printf(&s, ", Software link stack flush");
} else if (btb_flush_enabled) {
@@ -447,7 +447,7 @@ static void toggle_branch_cache_flush(bool enable)
ppc_inst(PPC_INST_NOP));
#endif
pr_info("link-stack-flush: software flush disabled.\n");
- link_stack_flush_enabled = false;
+ link_stack_flush_type = BRANCH_CACHE_FLUSH_NONE;
no_count_cache_flush();
return;
}
@@ -463,7 +463,7 @@ static void toggle_branch_cache_flush(bool enable)
#endif
pr_info("link-stack-flush: software flush enabled.\n");
- link_stack_flush_enabled = true;
+ link_stack_flush_type = BRANCH_CACHE_FLUSH_SW;
// If we just need to flush the link stack, patch an early return
if (!security_ftr_enabled(SEC_FTR_FLUSH_COUNT_CACHE)) {
--
2.23.0
next prev parent reply other threads:[~2020-06-09 7:13 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-09 6:16 [PATCH 0/7] powerpc: branch cache flush changes Nicholas Piggin
2020-06-09 6:16 ` [PATCH 1/7] powerpc/security: re-name count cache flush to branch cache flush Nicholas Piggin
2020-06-09 6:16 ` Nicholas Piggin [this message]
2020-06-09 6:16 ` [PATCH 3/7] powerpc/security: make display of branch cache flush more consistent Nicholas Piggin
2020-06-09 6:16 ` [PATCH 4/7] powerpc/security: split branch cache flush toggle from code patching Nicholas Piggin
2020-06-09 6:16 ` [PATCH 5/7] powerpc/64s: Move branch cache flushing bcctr variant to ppc-ops.h Nicholas Piggin
2020-06-09 6:16 ` [PATCH 6/7] powerpc/security: Allow for processors that flush the link stack using the special bcctr Nicholas Piggin
2020-06-09 6:16 ` [PATCH 7/7] powerpc/64s: advertise hardware link stack flush Nicholas Piggin
-- strict thread matches above, loose matches on Subject: below --
2020-06-09 7:06 [PATCH 0/7] powerpc: branch cache flush changes Nicholas Piggin
2020-06-09 7:06 ` [PATCH 2/7] powerpc/security: change link stack flush state to the flush type enum Nicholas Piggin
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=20200609061631.844390-3-npiggin@gmail.com \
--to=npiggin@gmail.com \
--cc=linuxppc-dev@lists.ozlabs.org \
/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).