thermal: fix Mediatek thermal controller build
[linux/fpc-iii.git] / arch / x86 / include / asm / mpx.h
blob7a35495275a9b7b1150bde2935757a212defde59
1 #ifndef _ASM_X86_MPX_H
2 #define _ASM_X86_MPX_H
4 #include <linux/types.h>
5 #include <asm/ptrace.h>
6 #include <asm/insn.h>
8 /*
9 * NULL is theoretically a valid place to put the bounds
10 * directory, so point this at an invalid address.
12 #define MPX_INVALID_BOUNDS_DIR ((void __user *)-1)
13 #define MPX_BNDCFG_ENABLE_FLAG 0x1
14 #define MPX_BD_ENTRY_VALID_FLAG 0x1
17 * The upper 28 bits [47:20] of the virtual address in 64-bit
18 * are used to index into bounds directory (BD).
20 * The directory is 2G (2^31) in size, and with 8-byte entries
21 * it has 2^28 entries.
23 #define MPX_BD_SIZE_BYTES_64 (1UL<<31)
24 #define MPX_BD_ENTRY_BYTES_64 8
25 #define MPX_BD_NR_ENTRIES_64 (MPX_BD_SIZE_BYTES_64/MPX_BD_ENTRY_BYTES_64)
28 * The 32-bit directory is 4MB (2^22) in size, and with 4-byte
29 * entries it has 2^20 entries.
31 #define MPX_BD_SIZE_BYTES_32 (1UL<<22)
32 #define MPX_BD_ENTRY_BYTES_32 4
33 #define MPX_BD_NR_ENTRIES_32 (MPX_BD_SIZE_BYTES_32/MPX_BD_ENTRY_BYTES_32)
36 * A 64-bit table is 4MB total in size, and an entry is
37 * 4 64-bit pointers in size.
39 #define MPX_BT_SIZE_BYTES_64 (1UL<<22)
40 #define MPX_BT_ENTRY_BYTES_64 32
41 #define MPX_BT_NR_ENTRIES_64 (MPX_BT_SIZE_BYTES_64/MPX_BT_ENTRY_BYTES_64)
44 * A 32-bit table is 16kB total in size, and an entry is
45 * 4 32-bit pointers in size.
47 #define MPX_BT_SIZE_BYTES_32 (1UL<<14)
48 #define MPX_BT_ENTRY_BYTES_32 16
49 #define MPX_BT_NR_ENTRIES_32 (MPX_BT_SIZE_BYTES_32/MPX_BT_ENTRY_BYTES_32)
51 #define MPX_BNDSTA_TAIL 2
52 #define MPX_BNDCFG_TAIL 12
53 #define MPX_BNDSTA_ADDR_MASK (~((1UL<<MPX_BNDSTA_TAIL)-1))
54 #define MPX_BNDCFG_ADDR_MASK (~((1UL<<MPX_BNDCFG_TAIL)-1))
55 #define MPX_BNDSTA_ERROR_CODE 0x3
57 #ifdef CONFIG_X86_INTEL_MPX
58 siginfo_t *mpx_generate_siginfo(struct pt_regs *regs);
59 int mpx_handle_bd_fault(void);
60 static inline int kernel_managing_mpx_tables(struct mm_struct *mm)
62 return (mm->bd_addr != MPX_INVALID_BOUNDS_DIR);
64 static inline void mpx_mm_init(struct mm_struct *mm)
67 * NULL is theoretically a valid place to put the bounds
68 * directory, so point this at an invalid address.
70 mm->bd_addr = MPX_INVALID_BOUNDS_DIR;
72 void mpx_notify_unmap(struct mm_struct *mm, struct vm_area_struct *vma,
73 unsigned long start, unsigned long end);
74 #else
75 static inline siginfo_t *mpx_generate_siginfo(struct pt_regs *regs)
77 return NULL;
79 static inline int mpx_handle_bd_fault(void)
81 return -EINVAL;
83 static inline int kernel_managing_mpx_tables(struct mm_struct *mm)
85 return 0;
87 static inline void mpx_mm_init(struct mm_struct *mm)
90 static inline void mpx_notify_unmap(struct mm_struct *mm,
91 struct vm_area_struct *vma,
92 unsigned long start, unsigned long end)
95 #endif /* CONFIG_X86_INTEL_MPX */
97 #endif /* _ASM_X86_MPX_H */