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