1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_POWERPC_KUP_H_
3 #define _ASM_POWERPC_KUP_H_
6 #include <asm/book3s/64/kup-radix.h>
11 #include <asm/pgtable.h>
15 #ifdef CONFIG_PPC_KUEP
16 void setup_kuep(bool disabled);
18 static inline void setup_kuep(bool disabled) { }
19 #endif /* CONFIG_PPC_KUEP */
21 #ifdef CONFIG_PPC_KUAP
22 void setup_kuap(bool disabled);
24 static inline void setup_kuap(bool disabled) { }
25 static inline void allow_user_access(void __user *to, const void __user *from,
26 unsigned long size) { }
27 static inline void prevent_user_access(void __user *to, const void __user *from,
28 unsigned long size) { }
29 static inline bool bad_kuap_fault(struct pt_regs *regs, bool is_write) { return false; }
30 #endif /* CONFIG_PPC_KUAP */
32 static inline void allow_read_from_user(const void __user *from, unsigned long size)
34 allow_user_access(NULL, from, size);
37 static inline void allow_write_to_user(void __user *to, unsigned long size)
39 allow_user_access(to, NULL, size);
42 static inline void prevent_read_from_user(const void __user *from, unsigned long size)
44 prevent_user_access(NULL, from, size);
47 static inline void prevent_write_to_user(void __user *to, unsigned long size)
49 prevent_user_access(to, NULL, size);
52 #endif /* !__ASSEMBLY__ */
54 #endif /* _ASM_POWERPC_KUP_H_ */