1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #ifndef _ASM_POWERPC_PGTABLE_H 3 #define _ASM_POWERPC_PGTABLE_H 4 5 #ifndef __ASSEMBLY__ 6 #include <linux/mmdebug.h> 7 #include <linux/mmzone.h> 8 #include <asm/processor.h> /* For TASK_SIZE */ 9 #include <asm/mmu.h> 10 #include <asm/page.h> 11 12 struct mm_struct; 13 14 #endif /* !__ASSEMBLY__ */ 15 16 #ifdef CONFIG_PPC_BOOK3S 17 #include <asm/book3s/pgtable.h> 18 #else 19 #include <asm/nohash/pgtable.h> 20 #endif /* !CONFIG_PPC_BOOK3S */ 21 22 #ifndef __ASSEMBLY__ 23 24 #include <asm/tlbflush.h> 25 26 /* Keep these as a macros to avoid include dependency mess */ 27 #define pte_page(x) pfn_to_page(pte_pfn(x)) 28 #define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), (pgprot)) 29 30 /* 31 * ZERO_PAGE is a global shared page that is always zero: used 32 * for zero-mapped memory areas etc.. 33 */ 34 extern unsigned long empty_zero_page[]; 35 #define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page)) 36 37 extern pgd_t swapper_pg_dir[]; 38 39 void limit_zone_pfn(enum zone_type zone, unsigned long max_pfn); 40 int dma_pfn_limit_to_zone(u64 pfn_limit); 41 extern void paging_init(void); 42 43 /* 44 * kern_addr_valid is intended to indicate whether an address is a valid 45 * kernel address. Most 32-bit archs define it as always true (like this) 46 * but most 64-bit archs actually perform a test. What should we do here? 47 */ 48 #define kern_addr_valid(addr) (1) 49 50 #include <asm-generic/pgtable.h> 51 52 53 /* 54 * This gets called at the end of handling a page fault, when 55 * the kernel has put a new PTE into the page table for the process. 56 * We use it to ensure coherency between the i-cache and d-cache 57 * for the page which has just been mapped in. 58 * On machines which use an MMU hash table, we use this to put a 59 * corresponding HPTE into the hash table ahead of time, instead of 60 * waiting for the inevitable extra hash-table miss exception. 61 */ 62 extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t *); 63 64 extern int gup_hugepte(pte_t *ptep, unsigned long sz, unsigned long addr, 65 unsigned long end, int write, 66 struct page **pages, int *nr); 67 #ifndef CONFIG_TRANSPARENT_HUGEPAGE 68 #define pmd_large(pmd) 0 69 #endif 70 71 /* can we use this in kvm */ 72 unsigned long vmalloc_to_phys(void *vmalloc_addr); 73 74 void pgtable_cache_add(unsigned shift, void (*ctor)(void *)); 75 void pgtable_cache_init(void); 76 77 #if defined(CONFIG_STRICT_KERNEL_RWX) || defined(CONFIG_PPC32) 78 void mark_initmem_nx(void); 79 #else 80 static inline void mark_initmem_nx(void) { } 81 #endif 82 83 #endif /* __ASSEMBLY__ */ 84 85 #endif /* _ASM_POWERPC_PGTABLE_H */ 86