1 // SPDX-License-Identifier: GPL-2.0+
3 // Security related flags and so on.
5 // Copyright 2018, Michael Ellerman, IBM Corporation.
8 #include <linux/kernel.h>
9 #include <linux/device.h>
10 #include <linux/memblock.h>
11 #include <linux/nospec.h>
12 #include <linux/prctl.h>
13 #include <linux/seq_buf.h>
14 #include <linux/debugfs.h>
16 #include <asm/asm-prototypes.h>
17 #include <asm/code-patching.h>
18 #include <asm/security_features.h>
19 #include <asm/sections.h>
20 #include <asm/setup.h>
25 u64 powerpc_security_features __read_mostly = SEC_FTR_DEFAULT;
27 enum branch_cache_flush_type {
28 BRANCH_CACHE_FLUSH_NONE = 0x1,
29 BRANCH_CACHE_FLUSH_SW = 0x2,
30 BRANCH_CACHE_FLUSH_HW = 0x4,
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;
35 bool barrier_nospec_enabled;
36 static bool no_nospec;
37 static bool btb_flush_enabled;
38 #if defined(CONFIG_PPC_E500) || defined(CONFIG_PPC_BOOK3S_64)
39 static bool no_spectrev2;
42 static void enable_barrier_nospec(bool enable)
44 barrier_nospec_enabled = enable;
45 do_barrier_nospec_fixups(enable);
48 void __init setup_barrier_nospec(void)
53 * It would make sense to check SEC_FTR_SPEC_BAR_ORI31 below as well.
54 * But there's a good reason not to. The two flags we check below are
55 * both are enabled by default in the kernel, so if the hcall is not
56 * functional they will be enabled.
57 * On a system where the host firmware has been updated (so the ori
58 * functions as a barrier), but on which the hypervisor (KVM/Qemu) has
59 * not been updated, we would like to enable the barrier. Dropping the
60 * check for SEC_FTR_SPEC_BAR_ORI31 achieves that. The only downside is
61 * we potentially enable the barrier on systems where the host firmware
62 * is not updated, but that's harmless as it's a no-op.
64 enable = security_ftr_enabled(SEC_FTR_FAVOUR_SECURITY) &&
65 security_ftr_enabled(SEC_FTR_BNDS_CHK_SPEC_BAR);
67 if (!no_nospec && !cpu_mitigations_off())
68 enable_barrier_nospec(enable);
71 static int __init handle_nospectre_v1(char *p)
77 early_param("nospectre_v1", handle_nospectre_v1);
79 #ifdef CONFIG_DEBUG_FS
80 static int barrier_nospec_set(void *data, u64 val)
90 if (!!val == !!barrier_nospec_enabled)
93 enable_barrier_nospec(!!val);
98 static int barrier_nospec_get(void *data, u64 *val)
100 *val = barrier_nospec_enabled ? 1 : 0;
104 DEFINE_DEBUGFS_ATTRIBUTE(fops_barrier_nospec, barrier_nospec_get,
105 barrier_nospec_set, "%llu\n");
107 static __init int barrier_nospec_debugfs_init(void)
109 debugfs_create_file_unsafe("barrier_nospec", 0600,
110 arch_debugfs_dir, NULL,
111 &fops_barrier_nospec);
114 device_initcall(barrier_nospec_debugfs_init);
116 static __init int security_feature_debugfs_init(void)
118 debugfs_create_x64("security_features", 0400, arch_debugfs_dir,
119 &powerpc_security_features);
122 device_initcall(security_feature_debugfs_init);
123 #endif /* CONFIG_DEBUG_FS */
125 #if defined(CONFIG_PPC_E500) || defined(CONFIG_PPC_BOOK3S_64)
126 static int __init handle_nospectre_v2(char *p)
132 early_param("nospectre_v2", handle_nospectre_v2);
133 #endif /* CONFIG_PPC_E500 || CONFIG_PPC_BOOK3S_64 */
135 #ifdef CONFIG_PPC_E500
136 void __init setup_spectre_v2(void)
138 if (no_spectrev2 || cpu_mitigations_off())
139 do_btb_flush_fixups();
141 btb_flush_enabled = true;
143 #endif /* CONFIG_PPC_E500 */
145 #ifdef CONFIG_PPC_BOOK3S_64
146 ssize_t cpu_show_meltdown(struct device *dev, struct device_attribute *attr, char *buf)
150 thread_priv = security_ftr_enabled(SEC_FTR_L1D_THREAD_PRIV);
154 seq_buf_init(&s, buf, PAGE_SIZE - 1);
156 seq_buf_printf(&s, "Mitigation: RFI Flush");
158 seq_buf_printf(&s, ", L1D private per thread");
160 seq_buf_printf(&s, "\n");
166 return sprintf(buf, "Vulnerable: L1D private per thread\n");
168 if (!security_ftr_enabled(SEC_FTR_L1D_FLUSH_HV) &&
169 !security_ftr_enabled(SEC_FTR_L1D_FLUSH_PR))
170 return sprintf(buf, "Not affected\n");
172 return sprintf(buf, "Vulnerable\n");
175 ssize_t cpu_show_l1tf(struct device *dev, struct device_attribute *attr, char *buf)
177 return cpu_show_meltdown(dev, attr, buf);
181 ssize_t cpu_show_spectre_v1(struct device *dev, struct device_attribute *attr, char *buf)
185 seq_buf_init(&s, buf, PAGE_SIZE - 1);
187 if (security_ftr_enabled(SEC_FTR_BNDS_CHK_SPEC_BAR)) {
188 if (barrier_nospec_enabled)
189 seq_buf_printf(&s, "Mitigation: __user pointer sanitization");
191 seq_buf_printf(&s, "Vulnerable");
193 if (security_ftr_enabled(SEC_FTR_SPEC_BAR_ORI31))
194 seq_buf_printf(&s, ", ori31 speculation barrier enabled");
196 seq_buf_printf(&s, "\n");
198 seq_buf_printf(&s, "Not affected\n");
203 ssize_t cpu_show_spectre_v2(struct device *dev, struct device_attribute *attr, char *buf)
208 seq_buf_init(&s, buf, PAGE_SIZE - 1);
210 bcs = security_ftr_enabled(SEC_FTR_BCCTRL_SERIALISED);
211 ccd = security_ftr_enabled(SEC_FTR_COUNT_CACHE_DISABLED);
214 seq_buf_printf(&s, "Mitigation: ");
217 seq_buf_printf(&s, "Indirect branch serialisation (kernel only)");
220 seq_buf_printf(&s, ", ");
223 seq_buf_printf(&s, "Indirect branch cache disabled");
225 } else if (count_cache_flush_type != BRANCH_CACHE_FLUSH_NONE) {
226 seq_buf_printf(&s, "Mitigation: Software count cache flush");
228 if (count_cache_flush_type == BRANCH_CACHE_FLUSH_HW)
229 seq_buf_printf(&s, " (hardware accelerated)");
231 } else if (btb_flush_enabled) {
232 seq_buf_printf(&s, "Mitigation: Branch predictor state flush");
234 seq_buf_printf(&s, "Vulnerable");
237 if (bcs || ccd || count_cache_flush_type != BRANCH_CACHE_FLUSH_NONE) {
238 if (link_stack_flush_type != BRANCH_CACHE_FLUSH_NONE)
239 seq_buf_printf(&s, ", Software link stack flush");
240 if (link_stack_flush_type == BRANCH_CACHE_FLUSH_HW)
241 seq_buf_printf(&s, " (hardware accelerated)");
244 seq_buf_printf(&s, "\n");
249 #ifdef CONFIG_PPC_BOOK3S_64
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)
260 pr_info("stf-barrier: disabled on command line.");
261 no_stf_barrier = true;
265 early_param("no_stf_barrier", handle_no_stf_barrier);
267 enum stf_barrier_type stf_barrier_type_get(void)
269 return stf_enabled_flush_types;
272 /* This is the generic flag used by other architectures */
273 static int __init handle_ssbd(char *p)
275 if (!p || strncmp(p, "auto", 5) == 0 || strncmp(p, "on", 2) == 0 ) {
276 /* Until firmware tells us, we have the barrier with auto */
278 } else if (strncmp(p, "off", 3) == 0) {
279 handle_no_stf_barrier(NULL);
286 early_param("spec_store_bypass_disable", handle_ssbd);
288 /* This is the generic flag used by other architectures */
289 static int __init handle_no_ssbd(char *p)
291 handle_no_stf_barrier(NULL);
294 early_param("nospec_store_bypass_disable", handle_no_ssbd);
296 static void stf_barrier_enable(bool enable)
299 do_stf_barrier_fixups(stf_enabled_flush_types);
301 do_stf_barrier_fixups(STF_BARRIER_NONE);
303 stf_barrier = enable;
306 void setup_stf_barrier(void)
308 enum stf_barrier_type type;
311 /* Default to fallback in case fw-features are not available */
312 if (cpu_has_feature(CPU_FTR_ARCH_300))
313 type = STF_BARRIER_EIEIO;
314 else if (cpu_has_feature(CPU_FTR_ARCH_207S))
315 type = STF_BARRIER_SYNC_ORI;
316 else if (cpu_has_feature(CPU_FTR_ARCH_206))
317 type = STF_BARRIER_FALLBACK;
319 type = STF_BARRIER_NONE;
321 enable = security_ftr_enabled(SEC_FTR_FAVOUR_SECURITY) &&
322 security_ftr_enabled(SEC_FTR_STF_BARRIER);
324 if (type == STF_BARRIER_FALLBACK) {
325 pr_info("stf-barrier: fallback barrier available\n");
326 } else if (type == STF_BARRIER_SYNC_ORI) {
327 pr_info("stf-barrier: hwsync barrier available\n");
328 } else if (type == STF_BARRIER_EIEIO) {
329 pr_info("stf-barrier: eieio barrier available\n");
332 stf_enabled_flush_types = type;
334 if (!no_stf_barrier && !cpu_mitigations_off())
335 stf_barrier_enable(enable);
338 ssize_t cpu_show_spec_store_bypass(struct device *dev, struct device_attribute *attr, char *buf)
340 if (stf_barrier && stf_enabled_flush_types != STF_BARRIER_NONE) {
342 switch (stf_enabled_flush_types) {
343 case STF_BARRIER_EIEIO:
346 case STF_BARRIER_SYNC_ORI:
349 case STF_BARRIER_FALLBACK:
355 return sprintf(buf, "Mitigation: Kernel entry/exit barrier (%s)\n", type);
358 if (!security_ftr_enabled(SEC_FTR_L1D_FLUSH_HV) &&
359 !security_ftr_enabled(SEC_FTR_L1D_FLUSH_PR))
360 return sprintf(buf, "Not affected\n");
362 return sprintf(buf, "Vulnerable\n");
365 static int ssb_prctl_get(struct task_struct *task)
367 if (stf_enabled_flush_types == STF_BARRIER_NONE)
369 * We don't have an explicit signal from firmware that we're
370 * vulnerable or not, we only have certain CPU revisions that
371 * are known to be vulnerable.
373 * We assume that if we're on another CPU, where the barrier is
374 * NONE, then we are not vulnerable.
376 return PR_SPEC_NOT_AFFECTED;
379 * If we do have a barrier type then we are vulnerable. The
380 * barrier is not a global or per-process mitigation, so the
381 * only value we can report here is PR_SPEC_ENABLE, which
382 * appears as "vulnerable" in /proc.
384 return PR_SPEC_ENABLE;
389 int arch_prctl_spec_ctrl_get(struct task_struct *task, unsigned long which)
392 case PR_SPEC_STORE_BYPASS:
393 return ssb_prctl_get(task);
399 #ifdef CONFIG_DEBUG_FS
400 static int stf_barrier_set(void *data, u64 val)
411 /* Only do anything if we're changing state */
412 if (enable != stf_barrier)
413 stf_barrier_enable(enable);
418 static int stf_barrier_get(void *data, u64 *val)
420 *val = stf_barrier ? 1 : 0;
424 DEFINE_DEBUGFS_ATTRIBUTE(fops_stf_barrier, stf_barrier_get, stf_barrier_set,
427 static __init int stf_barrier_debugfs_init(void)
429 debugfs_create_file_unsafe("stf_barrier", 0600, arch_debugfs_dir,
430 NULL, &fops_stf_barrier);
433 device_initcall(stf_barrier_debugfs_init);
434 #endif /* CONFIG_DEBUG_FS */
436 static void update_branch_cache_flush(void)
438 u32 *site, __maybe_unused *site2;
440 #ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
441 site = &patch__call_kvm_flush_link_stack;
442 site2 = &patch__call_kvm_flush_link_stack_p9;
443 // This controls the branch from guest_exit_cont to kvm_flush_link_stack
444 if (link_stack_flush_type == BRANCH_CACHE_FLUSH_NONE) {
445 patch_instruction_site(site, ppc_inst(PPC_RAW_NOP()));
446 patch_instruction_site(site2, ppc_inst(PPC_RAW_NOP()));
448 // Could use HW flush, but that could also flush count cache
449 patch_branch_site(site, (u64)&kvm_flush_link_stack, BRANCH_SET_LINK);
450 patch_branch_site(site2, (u64)&kvm_flush_link_stack, BRANCH_SET_LINK);
454 // Patch out the bcctr first, then nop the rest
455 site = &patch__call_flush_branch_caches3;
456 patch_instruction_site(site, ppc_inst(PPC_RAW_NOP()));
457 site = &patch__call_flush_branch_caches2;
458 patch_instruction_site(site, ppc_inst(PPC_RAW_NOP()));
459 site = &patch__call_flush_branch_caches1;
460 patch_instruction_site(site, ppc_inst(PPC_RAW_NOP()));
462 // This controls the branch from _switch to flush_branch_caches
463 if (count_cache_flush_type == BRANCH_CACHE_FLUSH_NONE &&
464 link_stack_flush_type == BRANCH_CACHE_FLUSH_NONE) {
465 // Nothing to be done
467 } else if (count_cache_flush_type == BRANCH_CACHE_FLUSH_HW &&
468 link_stack_flush_type == BRANCH_CACHE_FLUSH_HW) {
469 // Patch in the bcctr last
470 site = &patch__call_flush_branch_caches1;
471 patch_instruction_site(site, ppc_inst(0x39207fff)); // li r9,0x7fff
472 site = &patch__call_flush_branch_caches2;
473 patch_instruction_site(site, ppc_inst(0x7d2903a6)); // mtctr r9
474 site = &patch__call_flush_branch_caches3;
475 patch_instruction_site(site, ppc_inst(PPC_INST_BCCTR_FLUSH));
478 patch_branch_site(site, (u64)&flush_branch_caches, BRANCH_SET_LINK);
480 // If we just need to flush the link stack, early return
481 if (count_cache_flush_type == BRANCH_CACHE_FLUSH_NONE) {
482 patch_instruction_site(&patch__flush_link_stack_return,
483 ppc_inst(PPC_RAW_BLR()));
485 // If we have flush instruction, early return
486 } else if (count_cache_flush_type == BRANCH_CACHE_FLUSH_HW) {
487 patch_instruction_site(&patch__flush_count_cache_return,
488 ppc_inst(PPC_RAW_BLR()));
493 static void toggle_branch_cache_flush(bool enable)
495 if (!enable || !security_ftr_enabled(SEC_FTR_FLUSH_COUNT_CACHE)) {
496 if (count_cache_flush_type != BRANCH_CACHE_FLUSH_NONE)
497 count_cache_flush_type = BRANCH_CACHE_FLUSH_NONE;
499 pr_info("count-cache-flush: flush disabled.\n");
501 if (security_ftr_enabled(SEC_FTR_BCCTR_FLUSH_ASSIST)) {
502 count_cache_flush_type = BRANCH_CACHE_FLUSH_HW;
503 pr_info("count-cache-flush: hardware flush enabled.\n");
505 count_cache_flush_type = BRANCH_CACHE_FLUSH_SW;
506 pr_info("count-cache-flush: software flush enabled.\n");
510 if (!enable || !security_ftr_enabled(SEC_FTR_FLUSH_LINK_STACK)) {
511 if (link_stack_flush_type != BRANCH_CACHE_FLUSH_NONE)
512 link_stack_flush_type = BRANCH_CACHE_FLUSH_NONE;
514 pr_info("link-stack-flush: flush disabled.\n");
516 if (security_ftr_enabled(SEC_FTR_BCCTR_LINK_FLUSH_ASSIST)) {
517 link_stack_flush_type = BRANCH_CACHE_FLUSH_HW;
518 pr_info("link-stack-flush: hardware flush enabled.\n");
520 link_stack_flush_type = BRANCH_CACHE_FLUSH_SW;
521 pr_info("link-stack-flush: software flush enabled.\n");
525 update_branch_cache_flush();
528 void setup_count_cache_flush(void)
532 if (no_spectrev2 || cpu_mitigations_off()) {
533 if (security_ftr_enabled(SEC_FTR_BCCTRL_SERIALISED) ||
534 security_ftr_enabled(SEC_FTR_COUNT_CACHE_DISABLED))
535 pr_warn("Spectre v2 mitigations not fully under software control, can't disable\n");
541 * There's no firmware feature flag/hypervisor bit to tell us we need to
542 * flush the link stack on context switch. So we set it here if we see
543 * either of the Spectre v2 mitigations that aim to protect userspace.
545 if (security_ftr_enabled(SEC_FTR_COUNT_CACHE_DISABLED) ||
546 security_ftr_enabled(SEC_FTR_FLUSH_COUNT_CACHE))
547 security_ftr_set(SEC_FTR_FLUSH_LINK_STACK);
549 toggle_branch_cache_flush(enable);
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;
560 DEFINE_STATIC_KEY_FALSE(uaccess_flush_key);
561 EXPORT_SYMBOL(uaccess_flush_key);
563 static int __init handle_no_rfi_flush(char *p)
565 pr_info("rfi-flush: disabled on command line.");
569 early_param("no_rfi_flush", handle_no_rfi_flush);
571 static int __init handle_no_entry_flush(char *p)
573 pr_info("entry-flush: disabled on command line.");
574 no_entry_flush = true;
577 early_param("no_entry_flush", handle_no_entry_flush);
579 static int __init handle_no_uaccess_flush(char *p)
581 pr_info("uaccess-flush: disabled on command line.");
582 no_uaccess_flush = true;
585 early_param("no_uaccess_flush", handle_no_uaccess_flush);
588 * The RFI flush is not KPTI, but because users will see doco that says to use
589 * nopti we hijack that option here to also disable the RFI flush.
591 static int __init handle_no_pti(char *p)
593 pr_info("rfi-flush: disabling due to 'nopti' on command line.\n");
594 handle_no_rfi_flush(NULL);
597 early_param("nopti", handle_no_pti);
599 static void do_nothing(void *unused)
602 * We don't need to do the flush explicitly, just enter+exit kernel is
603 * sufficient, the RFI exit handlers will do the right thing.
607 void rfi_flush_enable(bool enable)
610 do_rfi_flush_fixups(enabled_flush_types);
611 on_each_cpu(do_nothing, NULL, 1);
613 do_rfi_flush_fixups(L1D_FLUSH_NONE);
618 static void entry_flush_enable(bool enable)
621 do_entry_flush_fixups(enabled_flush_types);
622 on_each_cpu(do_nothing, NULL, 1);
624 do_entry_flush_fixups(L1D_FLUSH_NONE);
627 entry_flush = enable;
630 static void uaccess_flush_enable(bool enable)
633 do_uaccess_flush_fixups(enabled_flush_types);
634 static_branch_enable(&uaccess_flush_key);
635 on_each_cpu(do_nothing, NULL, 1);
637 static_branch_disable(&uaccess_flush_key);
638 do_uaccess_flush_fixups(L1D_FLUSH_NONE);
641 uaccess_flush = enable;
644 static void __ref init_fallback_flush(void)
649 /* Only allocate the fallback flush area once (at boot time). */
650 if (l1d_flush_fallback_area)
653 l1d_size = ppc64_caches.l1d.size;
656 * If there is no d-cache-size property in the device tree, l1d_size
657 * could be zero. That leads to the loop in the asm wrapping around to
658 * 2^64-1, and then walking off the end of the fallback area and
659 * eventually causing a page fault which is fatal. Just default to
660 * something vaguely sane.
663 l1d_size = (64 * 1024);
665 limit = min(ppc64_bolted_size(), ppc64_rma_size);
668 * Align to L1d size, and size it at 2x L1d size, to catch possible
669 * hardware prefetch runoff. We don't have a recipe for load patterns to
670 * reliably avoid the prefetcher.
672 l1d_flush_fallback_area = memblock_alloc_try_nid(l1d_size * 2,
673 l1d_size, MEMBLOCK_LOW_LIMIT,
674 limit, NUMA_NO_NODE);
675 if (!l1d_flush_fallback_area)
676 panic("%s: Failed to allocate %llu bytes align=0x%llx max_addr=%pa\n",
677 __func__, l1d_size * 2, l1d_size, &limit);
680 for_each_possible_cpu(cpu) {
681 struct paca_struct *paca = paca_ptrs[cpu];
682 paca->rfi_flush_fallback_area = l1d_flush_fallback_area;
683 paca->l1d_flush_size = l1d_size;
687 void setup_rfi_flush(enum l1d_flush_type types, bool enable)
689 if (types & L1D_FLUSH_FALLBACK) {
690 pr_info("rfi-flush: fallback displacement flush available\n");
691 init_fallback_flush();
694 if (types & L1D_FLUSH_ORI)
695 pr_info("rfi-flush: ori type flush available\n");
697 if (types & L1D_FLUSH_MTTRIG)
698 pr_info("rfi-flush: mttrig type flush available\n");
700 enabled_flush_types = types;
702 if (!cpu_mitigations_off() && !no_rfi_flush)
703 rfi_flush_enable(enable);
706 void setup_entry_flush(bool enable)
708 if (cpu_mitigations_off())
712 entry_flush_enable(enable);
715 void setup_uaccess_flush(bool enable)
717 if (cpu_mitigations_off())
720 if (!no_uaccess_flush)
721 uaccess_flush_enable(enable);
724 #ifdef CONFIG_DEBUG_FS
725 static int count_cache_flush_set(void *data, u64 val)
736 toggle_branch_cache_flush(enable);
741 static int count_cache_flush_get(void *data, u64 *val)
743 if (count_cache_flush_type == BRANCH_CACHE_FLUSH_NONE)
751 static int link_stack_flush_get(void *data, u64 *val)
753 if (link_stack_flush_type == BRANCH_CACHE_FLUSH_NONE)
761 DEFINE_DEBUGFS_ATTRIBUTE(fops_count_cache_flush, count_cache_flush_get,
762 count_cache_flush_set, "%llu\n");
763 DEFINE_DEBUGFS_ATTRIBUTE(fops_link_stack_flush, link_stack_flush_get,
764 count_cache_flush_set, "%llu\n");
766 static __init int count_cache_flush_debugfs_init(void)
768 debugfs_create_file_unsafe("count_cache_flush", 0600,
769 arch_debugfs_dir, NULL,
770 &fops_count_cache_flush);
771 debugfs_create_file_unsafe("link_stack_flush", 0600,
772 arch_debugfs_dir, NULL,
773 &fops_link_stack_flush);
776 device_initcall(count_cache_flush_debugfs_init);
778 static int rfi_flush_set(void *data, u64 val)
789 /* Only do anything if we're changing state */
790 if (enable != rfi_flush)
791 rfi_flush_enable(enable);
796 static int rfi_flush_get(void *data, u64 *val)
798 *val = rfi_flush ? 1 : 0;
802 DEFINE_SIMPLE_ATTRIBUTE(fops_rfi_flush, rfi_flush_get, rfi_flush_set, "%llu\n");
804 static int entry_flush_set(void *data, u64 val)
815 /* Only do anything if we're changing state */
816 if (enable != entry_flush)
817 entry_flush_enable(enable);
822 static int entry_flush_get(void *data, u64 *val)
824 *val = entry_flush ? 1 : 0;
828 DEFINE_SIMPLE_ATTRIBUTE(fops_entry_flush, entry_flush_get, entry_flush_set, "%llu\n");
830 static int uaccess_flush_set(void *data, u64 val)
841 /* Only do anything if we're changing state */
842 if (enable != uaccess_flush)
843 uaccess_flush_enable(enable);
848 static int uaccess_flush_get(void *data, u64 *val)
850 *val = uaccess_flush ? 1 : 0;
854 DEFINE_SIMPLE_ATTRIBUTE(fops_uaccess_flush, uaccess_flush_get, uaccess_flush_set, "%llu\n");
856 static __init int rfi_flush_debugfs_init(void)
858 debugfs_create_file("rfi_flush", 0600, arch_debugfs_dir, NULL, &fops_rfi_flush);
859 debugfs_create_file("entry_flush", 0600, arch_debugfs_dir, NULL, &fops_entry_flush);
860 debugfs_create_file("uaccess_flush", 0600, arch_debugfs_dir, NULL, &fops_uaccess_flush);
863 device_initcall(rfi_flush_debugfs_init);
864 #endif /* CONFIG_DEBUG_FS */
865 #endif /* CONFIG_PPC_BOOK3S_64 */