Lines Matching +full:static +full:- +full:enable
1 // SPDX-License-Identifier: GPL-2.0+
16 #include <asm/asm-prototypes.h>
17 #include <asm/code-patching.h>
32 static enum branch_cache_flush_type count_cache_flush_type = BRANCH_CACHE_FLUSH_NONE;
33 static enum branch_cache_flush_type link_stack_flush_type = BRANCH_CACHE_FLUSH_NONE;
36 static bool no_nospec;
37 static bool btb_flush_enabled;
39 static bool no_spectrev2;
42 static void enable_barrier_nospec(bool enable) in enable_barrier_nospec() argument
44 barrier_nospec_enabled = enable; in enable_barrier_nospec()
45 do_barrier_nospec_fixups(enable); in enable_barrier_nospec()
50 bool enable; in setup_barrier_nospec() local
59 * not been updated, we would like to enable the barrier. Dropping the in setup_barrier_nospec()
61 * we potentially enable the barrier on systems where the host firmware in setup_barrier_nospec()
62 * is not updated, but that's harmless as it's a no-op. in setup_barrier_nospec()
64 enable = security_ftr_enabled(SEC_FTR_FAVOUR_SECURITY) && in setup_barrier_nospec()
68 enable_barrier_nospec(enable); in setup_barrier_nospec()
71 static int __init handle_nospectre_v1(char *p) in handle_nospectre_v1()
80 static int barrier_nospec_set(void *data, u64 val) in barrier_nospec_set()
87 return -EINVAL; in barrier_nospec_set()
98 static int barrier_nospec_get(void *data, u64 *val) in barrier_nospec_get()
107 static __init int barrier_nospec_debugfs_init(void) in barrier_nospec_debugfs_init()
116 static __init int security_feature_debugfs_init(void) in security_feature_debugfs_init()
126 static int __init handle_nospectre_v2(char *p) in handle_nospectre_v2()
154 seq_buf_init(&s, buf, PAGE_SIZE - 1); in cpu_show_meltdown()
185 seq_buf_init(&s, buf, PAGE_SIZE - 1); in cpu_show_spectre_v1()
208 seq_buf_init(&s, buf, PAGE_SIZE - 1); in cpu_show_spectre_v2()
251 * Store-forwarding barrier support.
254 static enum stf_barrier_type stf_enabled_flush_types;
255 static bool no_stf_barrier;
256 static bool stf_barrier;
258 static int __init handle_no_stf_barrier(char *p) in handle_no_stf_barrier()
260 pr_info("stf-barrier: disabled on command line."); in handle_no_stf_barrier()
273 static int __init handle_ssbd(char *p) in handle_ssbd()
289 static int __init handle_no_ssbd(char *p) in handle_no_ssbd()
296 static void stf_barrier_enable(bool enable) in stf_barrier_enable() argument
298 if (enable) in stf_barrier_enable()
303 stf_barrier = enable; in stf_barrier_enable()
309 bool enable; in setup_stf_barrier() local
311 /* Default to fallback in case fw-features are not available */ in setup_stf_barrier()
321 enable = security_ftr_enabled(SEC_FTR_FAVOUR_SECURITY) && in setup_stf_barrier()
325 pr_info("stf-barrier: fallback barrier available\n"); in setup_stf_barrier()
327 pr_info("stf-barrier: hwsync barrier available\n"); in setup_stf_barrier()
329 pr_info("stf-barrier: eieio barrier available\n"); in setup_stf_barrier()
335 stf_barrier_enable(enable); in setup_stf_barrier()
365 static int ssb_prctl_get(struct task_struct *task) in ssb_prctl_get()
380 * barrier is not a global or per-process mitigation, so the in ssb_prctl_get()
386 return -EINVAL; in ssb_prctl_get()
395 return -ENODEV; in arch_prctl_spec_ctrl_get()
400 static int stf_barrier_set(void *data, u64 val) in stf_barrier_set()
402 bool enable; in stf_barrier_set() local
405 enable = true; in stf_barrier_set()
407 enable = false; in stf_barrier_set()
409 return -EINVAL; in stf_barrier_set()
412 if (enable != stf_barrier) in stf_barrier_set()
413 stf_barrier_enable(enable); in stf_barrier_set()
418 static int stf_barrier_get(void *data, u64 *val) in stf_barrier_get()
427 static __init int stf_barrier_debugfs_init(void) in stf_barrier_debugfs_init()
436 static void update_branch_cache_flush(void) in update_branch_cache_flush()
493 static void toggle_branch_cache_flush(bool enable) in toggle_branch_cache_flush() argument
495 if (!enable || !security_ftr_enabled(SEC_FTR_FLUSH_COUNT_CACHE)) { in toggle_branch_cache_flush()
499 pr_info("count-cache-flush: flush disabled.\n"); in toggle_branch_cache_flush()
503 pr_info("count-cache-flush: hardware flush enabled.\n"); in toggle_branch_cache_flush()
506 pr_info("count-cache-flush: software flush enabled.\n"); in toggle_branch_cache_flush()
510 if (!enable || !security_ftr_enabled(SEC_FTR_FLUSH_LINK_STACK)) { in toggle_branch_cache_flush()
514 pr_info("link-stack-flush: flush disabled.\n"); in toggle_branch_cache_flush()
518 pr_info("link-stack-flush: hardware flush enabled.\n"); in toggle_branch_cache_flush()
521 pr_info("link-stack-flush: software flush enabled.\n"); in toggle_branch_cache_flush()
530 bool enable = true; in setup_count_cache_flush() local
537 enable = false; in setup_count_cache_flush()
549 toggle_branch_cache_flush(enable); in setup_count_cache_flush()
552 static enum l1d_flush_type enabled_flush_types;
553 static void *l1d_flush_fallback_area;
554 static bool no_rfi_flush;
555 static bool no_entry_flush;
556 static bool no_uaccess_flush;
558 static bool entry_flush;
559 static bool uaccess_flush;
563 static int __init handle_no_rfi_flush(char *p) in handle_no_rfi_flush()
565 pr_info("rfi-flush: disabled on command line."); in handle_no_rfi_flush()
571 static int __init handle_no_entry_flush(char *p) in handle_no_entry_flush()
573 pr_info("entry-flush: disabled on command line."); in handle_no_entry_flush()
579 static int __init handle_no_uaccess_flush(char *p) in handle_no_uaccess_flush()
581 pr_info("uaccess-flush: disabled on command line."); in handle_no_uaccess_flush()
591 static int __init handle_no_pti(char *p) in handle_no_pti()
593 pr_info("rfi-flush: disabling due to 'nopti' on command line.\n"); in handle_no_pti()
599 static void do_nothing(void *unused) in do_nothing()
607 void rfi_flush_enable(bool enable) in rfi_flush_enable() argument
609 if (enable) { in rfi_flush_enable()
615 rfi_flush = enable; in rfi_flush_enable()
618 static void entry_flush_enable(bool enable) in entry_flush_enable() argument
620 if (enable) { in entry_flush_enable()
627 entry_flush = enable; in entry_flush_enable()
630 static void uaccess_flush_enable(bool enable) in uaccess_flush_enable() argument
632 if (enable) { in uaccess_flush_enable()
641 uaccess_flush = enable; in uaccess_flush_enable()
644 static void __ref init_fallback_flush(void) in init_fallback_flush()
656 * If there is no d-cache-size property in the device tree, l1d_size in init_fallback_flush()
658 * 2^64-1, and then walking off the end of the fallback area and in init_fallback_flush()
682 paca->rfi_flush_fallback_area = l1d_flush_fallback_area; in init_fallback_flush()
683 paca->l1d_flush_size = l1d_size; in init_fallback_flush()
687 void setup_rfi_flush(enum l1d_flush_type types, bool enable) in setup_rfi_flush() argument
690 pr_info("rfi-flush: fallback displacement flush available\n"); in setup_rfi_flush()
695 pr_info("rfi-flush: ori type flush available\n"); in setup_rfi_flush()
698 pr_info("rfi-flush: mttrig type flush available\n"); in setup_rfi_flush()
703 rfi_flush_enable(enable); in setup_rfi_flush()
706 void setup_entry_flush(bool enable) in setup_entry_flush() argument
712 entry_flush_enable(enable); in setup_entry_flush()
715 void setup_uaccess_flush(bool enable) in setup_uaccess_flush() argument
721 uaccess_flush_enable(enable); in setup_uaccess_flush()
725 static int count_cache_flush_set(void *data, u64 val) in count_cache_flush_set()
727 bool enable; in count_cache_flush_set() local
730 enable = true; in count_cache_flush_set()
732 enable = false; in count_cache_flush_set()
734 return -EINVAL; in count_cache_flush_set()
736 toggle_branch_cache_flush(enable); in count_cache_flush_set()
741 static int count_cache_flush_get(void *data, u64 *val) in count_cache_flush_get()
751 static int link_stack_flush_get(void *data, u64 *val) in link_stack_flush_get()
766 static __init int count_cache_flush_debugfs_init(void) in count_cache_flush_debugfs_init()
778 static int rfi_flush_set(void *data, u64 val) in rfi_flush_set()
780 bool enable; in rfi_flush_set() local
783 enable = true; in rfi_flush_set()
785 enable = false; in rfi_flush_set()
787 return -EINVAL; in rfi_flush_set()
790 if (enable != rfi_flush) in rfi_flush_set()
791 rfi_flush_enable(enable); in rfi_flush_set()
796 static int rfi_flush_get(void *data, u64 *val) in rfi_flush_get()
804 static int entry_flush_set(void *data, u64 val) in entry_flush_set()
806 bool enable; in entry_flush_set() local
809 enable = true; in entry_flush_set()
811 enable = false; in entry_flush_set()
813 return -EINVAL; in entry_flush_set()
816 if (enable != entry_flush) in entry_flush_set()
817 entry_flush_enable(enable); in entry_flush_set()
822 static int entry_flush_get(void *data, u64 *val) in entry_flush_get()
830 static int uaccess_flush_set(void *data, u64 val) in uaccess_flush_set()
832 bool enable; in uaccess_flush_set() local
835 enable = true; in uaccess_flush_set()
837 enable = false; in uaccess_flush_set()
839 return -EINVAL; in uaccess_flush_set()
842 if (enable != uaccess_flush) in uaccess_flush_set()
843 uaccess_flush_enable(enable); in uaccess_flush_set()
848 static int uaccess_flush_get(void *data, u64 *val) in uaccess_flush_get()
856 static __init int rfi_flush_debugfs_init(void) in rfi_flush_debugfs_init()