mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 07:12:09 +00:00
powerpc/security: change link stack flush state to the flush type enum
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> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20200609070610.846703-3-npiggin@gmail.com
This commit is contained in:
parent
1026798c64
commit
c06ac27710
1 changed files with 5 additions and 5 deletions
|
@ -27,7 +27,7 @@ enum branch_cache_flush_type {
|
||||||
BRANCH_CACHE_FLUSH_HW = 0x4,
|
BRANCH_CACHE_FLUSH_HW = 0x4,
|
||||||
};
|
};
|
||||||
static enum branch_cache_flush_type count_cache_flush_type = BRANCH_CACHE_FLUSH_NONE;
|
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;
|
bool barrier_nospec_enabled;
|
||||||
static bool no_nospec;
|
static bool no_nospec;
|
||||||
|
@ -219,7 +219,7 @@ ssize_t cpu_show_spectre_v2(struct device *dev, struct device_attribute *attr, c
|
||||||
if (ccd)
|
if (ccd)
|
||||||
seq_buf_printf(&s, "Indirect branch cache disabled");
|
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");
|
seq_buf_printf(&s, ", Software link stack flush");
|
||||||
|
|
||||||
} else if (count_cache_flush_type != BRANCH_CACHE_FLUSH_NONE) {
|
} 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)
|
if (count_cache_flush_type == BRANCH_CACHE_FLUSH_HW)
|
||||||
seq_buf_printf(&s, " (hardware accelerated)");
|
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");
|
seq_buf_printf(&s, ", Software link stack flush");
|
||||||
|
|
||||||
} else if (btb_flush_enabled) {
|
} else if (btb_flush_enabled) {
|
||||||
|
@ -447,7 +447,7 @@ static void toggle_branch_cache_flush(bool enable)
|
||||||
ppc_inst(PPC_INST_NOP));
|
ppc_inst(PPC_INST_NOP));
|
||||||
#endif
|
#endif
|
||||||
pr_info("link-stack-flush: software flush disabled.\n");
|
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();
|
no_count_cache_flush();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -463,7 +463,7 @@ static void toggle_branch_cache_flush(bool enable)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
pr_info("link-stack-flush: software flush enabled.\n");
|
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 we just need to flush the link stack, patch an early return
|
||||||
if (!security_ftr_enabled(SEC_FTR_FLUSH_COUNT_CACHE)) {
|
if (!security_ftr_enabled(SEC_FTR_FLUSH_COUNT_CACHE)) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue