pandora: defconfig: update
[pandora-kernel.git] / include / linux / kaiser.h
1 #ifndef _LINUX_KAISER_H
2 #define _LINUX_KAISER_H
3
4 #ifdef CONFIG_PAGE_TABLE_ISOLATION
5 #include <asm/kaiser.h>
6
7 static inline int kaiser_map_thread_stack(void *stack)
8 {
9         /*
10          * Map that page of kernel stack on which we enter from user context.
11          */
12         return kaiser_add_mapping((unsigned long)stack +
13                         THREAD_SIZE - PAGE_SIZE, PAGE_SIZE, __PAGE_KERNEL);
14 }
15
16 static inline void kaiser_unmap_thread_stack(void *stack)
17 {
18         /*
19          * Note: may be called even when kaiser_map_thread_stack() failed.
20          */
21         kaiser_remove_mapping((unsigned long)stack +
22                         THREAD_SIZE - PAGE_SIZE, PAGE_SIZE);
23 }
24 #else
25
26 /*
27  * These stubs are used whenever CONFIG_PAGE_TABLE_ISOLATION is off, which
28  * includes architectures that support KAISER, but have it disabled.
29  */
30
31 static inline void kaiser_init(void)
32 {
33 }
34 static inline int kaiser_add_mapping(unsigned long addr,
35                                      unsigned long size, u64 flags)
36 {
37         return 0;
38 }
39 static inline void kaiser_remove_mapping(unsigned long start,
40                                          unsigned long size)
41 {
42 }
43 static inline int kaiser_map_thread_stack(void *stack)
44 {
45         return 0;
46 }
47 static inline void kaiser_unmap_thread_stack(void *stack)
48 {
49 }
50
51 #endif /* !CONFIG_PAGE_TABLE_ISOLATION */
52 #endif /* _LINUX_KAISER_H */