Lines Matching +full:static +full:- +full:enable
1 // SPDX-License-Identifier: GPL-2.0+
14 #include <asm/asm-prototypes.h>
15 #include <asm/code-patching.h>
29 static enum branch_cache_flush_type count_cache_flush_type = BRANCH_CACHE_FLUSH_NONE;
30 static enum branch_cache_flush_type link_stack_flush_type = BRANCH_CACHE_FLUSH_NONE;
33 static bool no_nospec;
34 static bool btb_flush_enabled;
36 static bool no_spectrev2;
39 static void enable_barrier_nospec(bool enable) in enable_barrier_nospec() argument
41 barrier_nospec_enabled = enable; in enable_barrier_nospec()
42 do_barrier_nospec_fixups(enable); in enable_barrier_nospec()
47 bool enable; in setup_barrier_nospec() local
56 * not been updated, we would like to enable the barrier. Dropping the in setup_barrier_nospec()
58 * we potentially enable the barrier on systems where the host firmware in setup_barrier_nospec()
59 * is not updated, but that's harmless as it's a no-op. in setup_barrier_nospec()
61 enable = security_ftr_enabled(SEC_FTR_FAVOUR_SECURITY) && in setup_barrier_nospec()
65 enable_barrier_nospec(enable); in setup_barrier_nospec()
68 static int __init handle_nospectre_v1(char *p) in handle_nospectre_v1()
77 static int barrier_nospec_set(void *data, u64 val) in barrier_nospec_set()
84 return -EINVAL; in barrier_nospec_set()
95 static int barrier_nospec_get(void *data, u64 *val) in barrier_nospec_get()
104 static __init int barrier_nospec_debugfs_init(void) in barrier_nospec_debugfs_init()
113 static __init int security_feature_debugfs_init(void) in security_feature_debugfs_init()
123 static int __init handle_nospectre_v2(char *p) in handle_nospectre_v2()
151 seq_buf_init(&s, buf, PAGE_SIZE - 1); in cpu_show_meltdown()
182 seq_buf_init(&s, buf, PAGE_SIZE - 1); in cpu_show_spectre_v1()
205 seq_buf_init(&s, buf, PAGE_SIZE - 1); in cpu_show_spectre_v2()
248 * Store-forwarding barrier support.
251 static enum stf_barrier_type stf_enabled_flush_types;
252 static bool no_stf_barrier;
255 static int __init handle_no_stf_barrier(char *p) in handle_no_stf_barrier()
257 pr_info("stf-barrier: disabled on command line."); in handle_no_stf_barrier()
265 static int __init handle_ssbd(char *p) in handle_ssbd()
281 static int __init handle_no_ssbd(char *p) in handle_no_ssbd()
288 static void stf_barrier_enable(bool enable) in stf_barrier_enable() argument
290 if (enable) in stf_barrier_enable()
295 stf_barrier = enable; in stf_barrier_enable()
301 bool enable, hv; in setup_stf_barrier() local
305 /* Default to fallback in case fw-features are not available */ in setup_stf_barrier()
315 enable = security_ftr_enabled(SEC_FTR_FAVOUR_SECURITY) && in setup_stf_barrier()
320 pr_info("stf-barrier: fallback barrier available\n"); in setup_stf_barrier()
322 pr_info("stf-barrier: hwsync barrier available\n"); in setup_stf_barrier()
324 pr_info("stf-barrier: eieio barrier available\n"); in setup_stf_barrier()
330 stf_barrier_enable(enable); in setup_stf_barrier()
360 static int ssb_prctl_get(struct task_struct *task) in ssb_prctl_get()
375 * barrier is not a global or per-process mitigation, so the in ssb_prctl_get()
381 return -EINVAL; in ssb_prctl_get()
390 return -ENODEV; in arch_prctl_spec_ctrl_get()
395 static int stf_barrier_set(void *data, u64 val) in stf_barrier_set()
397 bool enable; in stf_barrier_set() local
400 enable = true; in stf_barrier_set()
402 enable = false; in stf_barrier_set()
404 return -EINVAL; in stf_barrier_set()
407 if (enable != stf_barrier) in stf_barrier_set()
408 stf_barrier_enable(enable); in stf_barrier_set()
413 static int stf_barrier_get(void *data, u64 *val) in stf_barrier_get()
422 static __init int stf_barrier_debugfs_init(void) in stf_barrier_debugfs_init()
431 static void update_branch_cache_flush(void) in update_branch_cache_flush()
485 static void toggle_branch_cache_flush(bool enable) in toggle_branch_cache_flush() argument
487 if (!enable || !security_ftr_enabled(SEC_FTR_FLUSH_COUNT_CACHE)) { in toggle_branch_cache_flush()
491 pr_info("count-cache-flush: flush disabled.\n"); in toggle_branch_cache_flush()
495 pr_info("count-cache-flush: hardware flush enabled.\n"); in toggle_branch_cache_flush()
498 pr_info("count-cache-flush: software flush enabled.\n"); in toggle_branch_cache_flush()
502 if (!enable || !security_ftr_enabled(SEC_FTR_FLUSH_LINK_STACK)) { in toggle_branch_cache_flush()
506 pr_info("link-stack-flush: flush disabled.\n"); in toggle_branch_cache_flush()
510 pr_info("link-stack-flush: hardware flush enabled.\n"); in toggle_branch_cache_flush()
513 pr_info("link-stack-flush: software flush enabled.\n"); in toggle_branch_cache_flush()
522 bool enable = true; in setup_count_cache_flush() local
529 enable = false; in setup_count_cache_flush()
541 toggle_branch_cache_flush(enable); in setup_count_cache_flush()
545 static int count_cache_flush_set(void *data, u64 val) in count_cache_flush_set()
547 bool enable; in count_cache_flush_set() local
550 enable = true; in count_cache_flush_set()
552 enable = false; in count_cache_flush_set()
554 return -EINVAL; in count_cache_flush_set()
556 toggle_branch_cache_flush(enable); in count_cache_flush_set()
561 static int count_cache_flush_get(void *data, u64 *val) in count_cache_flush_get()
574 static __init int count_cache_flush_debugfs_init(void) in count_cache_flush_debugfs_init()