/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _ASM_POWERPC_PGTABLE_H #define _ASM_POWERPC_PGTABLE_H #ifndef __ASSEMBLY__ #include #include #include /* For TASK_SIZE */ #include #include #include struct mm_struct; #endif /* !__ASSEMBLY__ */ #ifdef CONFIG_PPC_BOOK3S #include #else #include #endif /* !CONFIG_PPC_BOOK3S */ #ifndef __ASSEMBLY__ #include /* Keep these as a macros to avoid include dependency mess */ #define pte_page(x) pfn_to_page(pte_pfn(x)) #define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), (pgprot)) /* * ZERO_PAGE is a global shared page that is always zero: used * for zero-mapped memory areas etc.. */ extern unsigned long empty_zero_page[]; #define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page)) extern pgd_t swapper_pg_dir[]; extern void paging_init(void); /* * kern_addr_valid is intended to indicate whether an address is a valid * kernel address. Most 32-bit archs define it as always true (like this) * but most 64-bit archs actually perform a test. What should we do here? */ #define kern_addr_valid(addr) (1) #include #ifndef CONFIG_TRANSPARENT_HUGEPAGE #define pmd_large(pmd) 0 #endif /* can we use this in kvm */ unsigned long vmalloc_to_phys(void *vmalloc_addr); void pgtable_cache_add(unsigned shift, void (*ctor)(void *)); void pgtable_cache_init(void); #if defined(CONFIG_STRICT_KERNEL_RWX) || defined(CONFIG_PPC32) void mark_initmem_nx(void); #else static inline void mark_initmem_nx(void) { } #endif #ifdef CONFIG_PPC64 #define is_ioremap_addr is_ioremap_addr static inline bool is_ioremap_addr(const void *x) { #ifdef CONFIG_MMU unsigned long addr = (unsigned long)x; return addr >= IOREMAP_BASE && addr < IOREMAP_END; #else return false; #endif } #endif /* CONFIG_PPC64 */ #ifndef pmd_is_leaf #define pmd_is_leaf pmd_is_leaf static inline bool pmd_is_leaf(pmd_t pmd) { return false; } #endif #ifndef pud_is_leaf #define pud_is_leaf pud_is_leaf static inline bool pud_is_leaf(pud_t pud) { return false; } #endif #ifndef pgd_is_leaf #define pgd_is_leaf pgd_is_leaf static inline bool pgd_is_leaf(pgd_t pgd) { return false; } #endif #endif /* __ASSEMBLY__ */ #endif /* _ASM_POWERPC_PGTABLE_H */