Lines Matching full:table
3 * Page table allocation functions
54 void crst_table_free(struct mm_struct *mm, unsigned long *table) in crst_table_free() argument
56 if (!table) in crst_table_free()
58 pagetable_free(virt_to_ptdesc(table)); in crst_table_free()
146 u64 *table; in page_table_alloc_pgste() local
150 table = (u64 *)ptdesc_to_virt(ptdesc); in page_table_alloc_pgste()
151 arch_set_page_dat(virt_to_page(table), 0); in page_table_alloc_pgste()
152 memset64(table, _PAGE_INVALID, PTRS_PER_PTE); in page_table_alloc_pgste()
153 memset64(table + PTRS_PER_PTE, 0, PTRS_PER_PTE); in page_table_alloc_pgste()
247 unsigned long *table; in page_table_alloc() local
251 /* Try to get a fragment of a 4K page as a 2K page table */ in page_table_alloc()
253 table = NULL; in page_table_alloc()
270 table = (unsigned long *) ptdesc_to_virt(ptdesc); in page_table_alloc()
273 table += PTRS_PER_PTE; in page_table_alloc()
280 if (table) in page_table_alloc()
281 return table; in page_table_alloc()
292 /* Initialize page table */ in page_table_alloc()
293 table = (unsigned long *) ptdesc_to_virt(ptdesc); in page_table_alloc()
295 /* Return 4K page table with PGSTEs */ in page_table_alloc()
298 memset64((u64 *)table, _PAGE_INVALID, PTRS_PER_PTE); in page_table_alloc()
299 memset64((u64 *)table + PTRS_PER_PTE, 0, PTRS_PER_PTE); in page_table_alloc()
303 memset64((u64 *)table, _PAGE_INVALID, 2 * PTRS_PER_PTE); in page_table_alloc()
308 return table; in page_table_alloc()
311 static void page_table_release_check(struct page *page, void *table, in page_table_release_check() argument
322 table, half, mask); in page_table_release_check()
335 void page_table_free(struct mm_struct *mm, unsigned long *table) in page_table_free() argument
338 struct ptdesc *ptdesc = virt_to_ptdesc(table); in page_table_free()
341 /* Free 2K page table fragment of a 4K page */ in page_table_free()
342 bit = ((unsigned long) table & ~PAGE_MASK)/(PTRS_PER_PTE*sizeof(pte_t)); in page_table_free()
374 page_table_release_check(ptdesc_page(ptdesc), table, half, mask); in page_table_free()
381 void page_table_free_rcu(struct mmu_gather *tlb, unsigned long *table, in page_table_free_rcu() argument
386 struct ptdesc *ptdesc = virt_to_ptdesc(table); in page_table_free_rcu()
390 gmap_unlink(mm, table, vmaddr); in page_table_free_rcu()
391 table = (unsigned long *) ((unsigned long)table | 0x03U); in page_table_free_rcu()
392 tlb_remove_ptdesc(tlb, table); in page_table_free_rcu()
395 bit = ((unsigned long) table & ~PAGE_MASK) / (PTRS_PER_PTE*sizeof(pte_t)); in page_table_free_rcu()
417 table = (unsigned long *) ((unsigned long) table | (0x01U << bit)); in page_table_free_rcu()
418 tlb_remove_table(tlb, table); in page_table_free_rcu()
424 void *table = (void *)((unsigned long) _table ^ mask); in __tlb_remove_table() local
425 struct ptdesc *ptdesc = virt_to_ptdesc(table); in __tlb_remove_table()
431 case 0x01U: /* lower 2K of a 4K page table */ in __tlb_remove_table()
432 case 0x02U: /* higher 2K of a 4K page table */ in __tlb_remove_table()
438 case 0x03U: /* 4K page table with pgstes */ in __tlb_remove_table()
444 page_table_release_check(ptdesc_page(ptdesc), table, half, mask); in __tlb_remove_table()
476 unsigned long *table; in base_pgt_alloc() local
478 table = kmem_cache_alloc(base_pgt_cache, GFP_KERNEL); in base_pgt_alloc()
479 if (table) in base_pgt_alloc()
480 memset64((u64 *)table, _PAGE_INVALID, PTRS_PER_PTE); in base_pgt_alloc()
481 return table; in base_pgt_alloc()
484 static void base_pgt_free(unsigned long *table) in base_pgt_free() argument
486 kmem_cache_free(base_pgt_cache, table); in base_pgt_free()
491 unsigned long *table; in base_crst_alloc() local
497 table = ptdesc_address(ptdesc); in base_crst_alloc()
499 crst_table_init(table, val); in base_crst_alloc()
500 return table; in base_crst_alloc()
503 static void base_crst_free(unsigned long *table) in base_crst_free() argument
505 if (!table) in base_crst_free()
507 pagetable_free(virt_to_ptdesc(table)); in base_crst_free()
554 unsigned long *ste, next, *table; in base_segment_walk() local
564 table = base_pgt_alloc(); in base_segment_walk()
565 if (!table) in base_segment_walk()
567 *ste = __pa(table) | _SEGMENT_ENTRY; in base_segment_walk()
569 table = __va(*ste & _SEGMENT_ENTRY_ORIGIN); in base_segment_walk()
570 rc = base_page_walk(table, addr, next, alloc); in base_segment_walk()
574 base_pgt_free(table); in base_segment_walk()
583 unsigned long *rtte, next, *table; in base_region3_walk() local
593 table = base_crst_alloc(_SEGMENT_ENTRY_EMPTY); in base_region3_walk()
594 if (!table) in base_region3_walk()
596 *rtte = __pa(table) | _REGION3_ENTRY; in base_region3_walk()
598 table = __va(*rtte & _REGION_ENTRY_ORIGIN); in base_region3_walk()
599 rc = base_segment_walk(table, addr, next, alloc); in base_region3_walk()
603 base_crst_free(table); in base_region3_walk()
611 unsigned long *rste, next, *table; in base_region2_walk() local
621 table = base_crst_alloc(_REGION3_ENTRY_EMPTY); in base_region2_walk()
622 if (!table) in base_region2_walk()
624 *rste = __pa(table) | _REGION2_ENTRY; in base_region2_walk()
626 table = __va(*rste & _REGION_ENTRY_ORIGIN); in base_region2_walk()
627 rc = base_region3_walk(table, addr, next, alloc); in base_region2_walk()
631 base_crst_free(table); in base_region2_walk()
639 unsigned long *rfte, next, *table; in base_region1_walk() local
649 table = base_crst_alloc(_REGION2_ENTRY_EMPTY); in base_region1_walk()
650 if (!table) in base_region1_walk()
652 *rfte = __pa(table) | _REGION1_ENTRY; in base_region1_walk()
654 table = __va(*rfte & _REGION_ENTRY_ORIGIN); in base_region1_walk()
655 rc = base_region2_walk(table, addr, next, alloc); in base_region1_walk()
659 base_crst_free(table); in base_region1_walk()
673 unsigned long *table = __va(asce & _ASCE_ORIGIN); in base_asce_free() local
679 base_segment_walk(table, 0, _REGION3_SIZE, 0); in base_asce_free()
682 base_region3_walk(table, 0, _REGION2_SIZE, 0); in base_asce_free()
685 base_region2_walk(table, 0, _REGION1_SIZE, 0); in base_asce_free()
688 base_region1_walk(table, 0, TASK_SIZE_MAX, 0); in base_asce_free()
691 base_crst_free(table); in base_asce_free()
725 unsigned long asce, *table, end; in base_asce_alloc() local
732 table = base_crst_alloc(_SEGMENT_ENTRY_EMPTY); in base_asce_alloc()
733 if (!table) in base_asce_alloc()
735 rc = base_segment_walk(table, addr, end, 1); in base_asce_alloc()
736 asce = __pa(table) | _ASCE_TYPE_SEGMENT | _ASCE_TABLE_LENGTH; in base_asce_alloc()
738 table = base_crst_alloc(_REGION3_ENTRY_EMPTY); in base_asce_alloc()
739 if (!table) in base_asce_alloc()
741 rc = base_region3_walk(table, addr, end, 1); in base_asce_alloc()
742 asce = __pa(table) | _ASCE_TYPE_REGION3 | _ASCE_TABLE_LENGTH; in base_asce_alloc()
744 table = base_crst_alloc(_REGION2_ENTRY_EMPTY); in base_asce_alloc()
745 if (!table) in base_asce_alloc()
747 rc = base_region2_walk(table, addr, end, 1); in base_asce_alloc()
748 asce = __pa(table) | _ASCE_TYPE_REGION2 | _ASCE_TABLE_LENGTH; in base_asce_alloc()
750 table = base_crst_alloc(_REGION1_ENTRY_EMPTY); in base_asce_alloc()
751 if (!table) in base_asce_alloc()
753 rc = base_region1_walk(table, addr, end, 1); in base_asce_alloc()
754 asce = __pa(table) | _ASCE_TYPE_REGION1 | _ASCE_TABLE_LENGTH; in base_asce_alloc()