.. | .. |
---|
34 | 34 | memset64((u64 *)crst, entry, _CRST_ENTRIES); |
---|
35 | 35 | } |
---|
36 | 36 | |
---|
37 | | -static inline unsigned long pgd_entry_type(struct mm_struct *mm) |
---|
38 | | -{ |
---|
39 | | - if (mm_pmd_folded(mm)) |
---|
40 | | - return _SEGMENT_ENTRY_EMPTY; |
---|
41 | | - if (mm_pud_folded(mm)) |
---|
42 | | - return _REGION3_ENTRY_EMPTY; |
---|
43 | | - if (mm_p4d_folded(mm)) |
---|
44 | | - return _REGION2_ENTRY_EMPTY; |
---|
45 | | - return _REGION1_ENTRY_EMPTY; |
---|
46 | | -} |
---|
47 | | - |
---|
48 | 37 | int crst_table_upgrade(struct mm_struct *mm, unsigned long limit); |
---|
49 | | -void crst_table_downgrade(struct mm_struct *); |
---|
| 38 | + |
---|
| 39 | +static inline unsigned long check_asce_limit(struct mm_struct *mm, unsigned long addr, |
---|
| 40 | + unsigned long len) |
---|
| 41 | +{ |
---|
| 42 | + int rc; |
---|
| 43 | + |
---|
| 44 | + if (addr + len > mm->context.asce_limit && |
---|
| 45 | + addr + len <= TASK_SIZE) { |
---|
| 46 | + rc = crst_table_upgrade(mm, addr + len); |
---|
| 47 | + if (rc) |
---|
| 48 | + return (unsigned long) rc; |
---|
| 49 | + } |
---|
| 50 | + return addr; |
---|
| 51 | +} |
---|
50 | 52 | |
---|
51 | 53 | static inline p4d_t *p4d_alloc_one(struct mm_struct *mm, unsigned long address) |
---|
52 | 54 | { |
---|
.. | .. |
---|
116 | 118 | |
---|
117 | 119 | static inline pgd_t *pgd_alloc(struct mm_struct *mm) |
---|
118 | 120 | { |
---|
119 | | - unsigned long *table = crst_table_alloc(mm); |
---|
120 | | - |
---|
121 | | - if (!table) |
---|
122 | | - return NULL; |
---|
123 | | - if (mm->context.asce_limit == _REGION3_SIZE) { |
---|
124 | | - /* Forking a compat process with 2 page table levels */ |
---|
125 | | - if (!pgtable_pmd_page_ctor(virt_to_page(table))) { |
---|
126 | | - crst_table_free(mm, table); |
---|
127 | | - return NULL; |
---|
128 | | - } |
---|
129 | | - } |
---|
130 | | - return (pgd_t *) table; |
---|
| 121 | + return (pgd_t *) crst_table_alloc(mm); |
---|
131 | 122 | } |
---|
132 | 123 | |
---|
133 | 124 | static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd) |
---|
134 | 125 | { |
---|
135 | | - if (mm->context.asce_limit == _REGION3_SIZE) |
---|
136 | | - pgtable_pmd_page_dtor(virt_to_page(pgd)); |
---|
137 | 126 | crst_table_free(mm, (unsigned long *) pgd); |
---|
138 | 127 | } |
---|
139 | 128 | |
---|
.. | .. |
---|
151 | 140 | /* |
---|
152 | 141 | * page table entry allocation/free routines. |
---|
153 | 142 | */ |
---|
154 | | -#define pte_alloc_one_kernel(mm, vmaddr) ((pte_t *) page_table_alloc(mm)) |
---|
155 | | -#define pte_alloc_one(mm, vmaddr) ((pte_t *) page_table_alloc(mm)) |
---|
| 143 | +#define pte_alloc_one_kernel(mm) ((pte_t *)page_table_alloc(mm)) |
---|
| 144 | +#define pte_alloc_one(mm) ((pte_t *)page_table_alloc(mm)) |
---|
156 | 145 | |
---|
157 | 146 | #define pte_free_kernel(mm, pte) page_table_free(mm, (unsigned long *) pte) |
---|
158 | 147 | #define pte_free(mm, pte) page_table_free(mm, (unsigned long *) pte) |
---|
159 | | - |
---|
160 | | -extern void rcu_table_freelist_finish(void); |
---|
161 | 148 | |
---|
162 | 149 | void vmem_map_init(void); |
---|
163 | 150 | void *vmem_crst_alloc(unsigned long val); |
---|