|
10 | 10 | #include <linux/slab.h> |
11 | 11 | #include <linux/mm.h> |
12 | 12 | #include <asm/mmu_context.h> |
| 13 | +#include <asm/page-states.h> |
13 | 14 | #include <asm/pgalloc.h> |
14 | 15 | #include <asm/gmap.h> |
15 | 16 | #include <asm/tlb.h> |
@@ -43,11 +44,13 @@ __initcall(page_table_register_sysctl); |
43 | 44 | unsigned long *crst_table_alloc(struct mm_struct *mm) |
44 | 45 | { |
45 | 46 | struct ptdesc *ptdesc = pagetable_alloc(GFP_KERNEL, CRST_ALLOC_ORDER); |
| 47 | + unsigned long *table; |
46 | 48 |
|
47 | 49 | if (!ptdesc) |
48 | 50 | return NULL; |
49 | | - arch_set_page_dat(ptdesc_page(ptdesc), CRST_ALLOC_ORDER); |
50 | | - return (unsigned long *) ptdesc_to_virt(ptdesc); |
| 51 | + table = ptdesc_to_virt(ptdesc); |
| 52 | + __arch_set_page_dat(table, 1UL << CRST_ALLOC_ORDER); |
| 53 | + return table; |
51 | 54 | } |
52 | 55 |
|
53 | 56 | void crst_table_free(struct mm_struct *mm, unsigned long *table) |
@@ -145,7 +148,7 @@ struct page *page_table_alloc_pgste(struct mm_struct *mm) |
145 | 148 | ptdesc = pagetable_alloc(GFP_KERNEL, 0); |
146 | 149 | if (ptdesc) { |
147 | 150 | table = (u64 *)ptdesc_to_virt(ptdesc); |
148 | | - arch_set_page_dat(virt_to_page(table), 0); |
| 151 | + __arch_set_page_dat(table, 1); |
149 | 152 | memset64(table, _PAGE_INVALID, PTRS_PER_PTE); |
150 | 153 | memset64(table + PTRS_PER_PTE, 0, PTRS_PER_PTE); |
151 | 154 | } |
@@ -285,9 +288,9 @@ unsigned long *page_table_alloc(struct mm_struct *mm) |
285 | 288 | pagetable_free(ptdesc); |
286 | 289 | return NULL; |
287 | 290 | } |
288 | | - arch_set_page_dat(ptdesc_page(ptdesc), 0); |
289 | 291 | /* Initialize page table */ |
290 | | - table = (unsigned long *) ptdesc_to_virt(ptdesc); |
| 292 | + table = ptdesc_to_virt(ptdesc); |
| 293 | + __arch_set_page_dat(table, 1); |
291 | 294 | if (mm_alloc_pgste(mm)) { |
292 | 295 | /* Return 4K page table with PGSTEs */ |
293 | 296 | INIT_LIST_HEAD(&ptdesc->pt_list); |
|
0 commit comments