GNU Linux-libre 4.9.318-gnu1
[releases.git] / arch / powerpc / include / asm / kup.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_POWERPC_KUP_H_
3 #define _ASM_POWERPC_KUP_H_
4
5 #ifndef __ASSEMBLY__
6
7 #include <asm/pgtable.h>
8
9 #ifdef CONFIG_PPC_BOOK3S_64
10 #include <asm/book3s/64/kup-radix.h>
11 #else
12 static inline void allow_user_access(void __user *to, const void __user *from,
13                                      unsigned long size) { }
14 static inline void prevent_user_access(void __user *to, const void __user *from,
15                                        unsigned long size) { }
16 #endif /* CONFIG_PPC_BOOK3S_64 */
17
18 static inline void allow_read_from_user(const void __user *from, unsigned long size)
19 {
20         allow_user_access(NULL, from, size);
21 }
22
23 static inline void allow_write_to_user(void __user *to, unsigned long size)
24 {
25         allow_user_access(to, NULL, size);
26 }
27
28 static inline void prevent_read_from_user(const void __user *from, unsigned long size)
29 {
30         prevent_user_access(NULL, from, size);
31 }
32
33 static inline void prevent_write_to_user(void __user *to, unsigned long size)
34 {
35         prevent_user_access(to, NULL, size);
36 }
37
38 #endif /* !__ASSEMBLY__ */
39
40 #endif /* _ASM_POWERPC_KUP_H_ */