GNU Linux-libre 4.4.288-gnu1
[releases.git] / arch / powerpc / include / asm / book3s / 64 / kup-radix.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_POWERPC_BOOK3S_64_KUP_RADIX_H
3 #define _ASM_POWERPC_BOOK3S_64_KUP_RADIX_H
4 #include <linux/jump_label.h>
5
6 DECLARE_STATIC_KEY_FALSE(uaccess_flush_key);
7
8 /* Prototype for function defined in exceptions-64s.S */
9 void do_uaccess_flush(void);
10
11 static __always_inline void allow_user_access(void __user *to, const void __user *from,
12                                               unsigned long size)
13 {
14 }
15
16 static inline void prevent_user_access(void __user *to, const void __user *from,
17                                        unsigned long size)
18 {
19         if (static_branch_unlikely(&uaccess_flush_key))
20                 do_uaccess_flush();
21 }
22
23 #endif /* _ASM_POWERPC_BOOK3S_64_KUP_RADIX_H */