License cleanup: add SPDX GPL-2.0 license identifier to files with no license
[linux-block.git] / arch / powerpc / include / asm / pgtable.h
CommitLineData
b2441318 1/* SPDX-License-Identifier: GPL-2.0 */
047ea784
PM
2#ifndef _ASM_POWERPC_PGTABLE_H
3#define _ASM_POWERPC_PGTABLE_H
4
9c709f3b 5#ifndef __ASSEMBLY__
c34a51ce 6#include <linux/mmdebug.h>
1c98025c 7#include <linux/mmzone.h>
9c709f3b
DG
8#include <asm/processor.h> /* For TASK_SIZE */
9#include <asm/mmu.h>
10#include <asm/page.h>
8d30c14c 11
9c709f3b 12struct mm_struct;
8d30c14c 13
9c709f3b
DG
14#endif /* !__ASSEMBLY__ */
15
3dfcb315
AK
16#ifdef CONFIG_PPC_BOOK3S
17#include <asm/book3s/pgtable.h>
18#else
17ed9e31 19#include <asm/nohash/pgtable.h>
3dfcb315 20#endif /* !CONFIG_PPC_BOOK3S */
1da177e4 21
1da177e4 22#ifndef __ASSEMBLY__
64b3d0e8 23
78f1dbde
AK
24#include <asm/tlbflush.h>
25
71087002
BH
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
9c709f3b
DG
30/*
31 * ZERO_PAGE is a global shared page that is always zero: used
32 * for zero-mapped memory areas etc..
33 */
34extern unsigned long empty_zero_page[];
35#define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page))
36
37extern pgd_t swapper_pg_dir[];
38
1c98025c
SW
39void limit_zone_pfn(enum zone_type zone, unsigned long max_pfn);
40int dma_pfn_limit_to_zone(u64 pfn_limit);
9c709f3b
DG
41extern 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
1da177e4 50#include <asm-generic/pgtable.h>
1e3519f8
BH
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 */
4b3073e1 62extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t *);
1e3519f8 63
e2b3d202 64extern int gup_hugepte(pte_t *ptep, unsigned long sz, unsigned long addr,
b30e7590
AK
65 unsigned long end, int write,
66 struct page **pages, int *nr);
074c2eae
AK
67#ifndef CONFIG_TRANSPARENT_HUGEPAGE
68#define pmd_large(pmd) 0
074c2eae 69#endif
e9ab1a1c 70
94171b19 71/* can we use this in kvm */
e9ab1a1c
AK
72unsigned long vmalloc_to_phys(void *vmalloc_addr);
73
9b081e10
CL
74void pgtable_cache_add(unsigned shift, void (*ctor)(void *));
75void pgtable_cache_init(void);
029d9252 76
3184cc4b 77#if defined(CONFIG_STRICT_KERNEL_RWX) || defined(CONFIG_PPC32)
029d9252
ME
78void mark_initmem_nx(void);
79#else
80static inline void mark_initmem_nx(void) { }
81#endif
82
1da177e4
LT
83#endif /* __ASSEMBLY__ */
84
047ea784 85#endif /* _ASM_POWERPC_PGTABLE_H */