blob: 14c79a7dc855062e65ff314b2e28961f47538bbf [file] [log] [blame]
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00001/* 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#include <asm/tlbflush.h>
12
13struct mm_struct;
14
15#endif /* !__ASSEMBLY__ */
16
17#ifdef CONFIG_PPC_BOOK3S
18#include <asm/book3s/pgtable.h>
19#else
20#include <asm/nohash/pgtable.h>
21#endif /* !CONFIG_PPC_BOOK3S */
22
23#ifndef __ASSEMBLY__
24
25#include <asm/tlbflush.h>
26
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))
30
31/*
32 * ZERO_PAGE is a global shared page that is always zero: used
33 * for zero-mapped memory areas etc..
34 */
35extern unsigned long empty_zero_page[];
36#define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page))
37
38extern pgd_t swapper_pg_dir[];
39
40void limit_zone_pfn(enum zone_type zone, unsigned long max_pfn);
41int dma_pfn_limit_to_zone(u64 pfn_limit);
42extern void paging_init(void);
43
44/*
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?
48 */
49#define kern_addr_valid(addr) (1)
50
51#include <asm-generic/pgtable.h>
52
53
54/*
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.
62 */
63extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t *);
64
65extern 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
70#endif
71
72/* can we use this in kvm */
73unsigned long vmalloc_to_phys(void *vmalloc_addr);
74
75void pgtable_cache_add(unsigned shift, void (*ctor)(void *));
76void pgtable_cache_init(void);
77
78#if defined(CONFIG_STRICT_KERNEL_RWX) || defined(CONFIG_PPC32)
79void mark_initmem_nx(void);
80#else
81static inline void mark_initmem_nx(void) { }
82#endif
83
84#endif /* __ASSEMBLY__ */
85
86#endif /* _ASM_POWERPC_PGTABLE_H */