pgtable.h 2.5 KB
Newer Older
1 2 3
#ifndef _ASM_POWERPC_PGTABLE_H
#define _ASM_POWERPC_PGTABLE_H

4
#ifndef __ASSEMBLY__
5
#include <linux/mmdebug.h>
S
Scott Wood 已提交
6
#include <linux/mmzone.h>
7 8 9
#include <asm/processor.h>		/* For TASK_SIZE */
#include <asm/mmu.h>
#include <asm/page.h>
10

11
struct mm_struct;
12

13 14
#endif /* !__ASSEMBLY__ */

15 16 17
#ifdef CONFIG_PPC_BOOK3S
#include <asm/book3s/pgtable.h>
#else
18
#include <asm/nohash/pgtable.h>
19
#endif /* !CONFIG_PPC_BOOK3S */
L
Linus Torvalds 已提交
20 21

#ifndef __ASSEMBLY__
22

23 24
#include <asm/tlbflush.h>

25 26 27 28
/* 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))

29 30 31 32 33 34 35 36 37
/*
 * 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[];

S
Scott Wood 已提交
38 39
void limit_zone_pfn(enum zone_type zone, unsigned long max_pfn);
int dma_pfn_limit_to_zone(u64 pfn_limit);
40 41 42 43 44 45 46 47 48
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)

L
Linus Torvalds 已提交
49
#include <asm-generic/pgtable.h>
50 51 52 53 54 55 56 57 58 59 60


/*
 * This gets called at the end of handling a page fault, when
 * the kernel has put a new PTE into the page table for the process.
 * We use it to ensure coherency between the i-cache and d-cache
 * for the page which has just been mapped in.
 * On machines which use an MMU hash table, we use this to put a
 * corresponding HPTE into the hash table ahead of time, instead of
 * waiting for the inevitable extra hash-table miss exception.
 */
61
extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t *);
62

63
extern int gup_hugepte(pte_t *ptep, unsigned long sz, unsigned long addr,
64 65
		       unsigned long end, int write,
		       struct page **pages, int *nr);
66 67 68
#ifndef CONFIG_TRANSPARENT_HUGEPAGE
#define pmd_large(pmd)		0
#endif
69
pte_t *__find_linux_pte_or_hugepte(pgd_t *pgdir, unsigned long ea,
70
				   bool *is_thp, unsigned *shift);
71
static inline pte_t *find_linux_pte_or_hugepte(pgd_t *pgdir, unsigned long ea,
72
					       bool *is_thp, unsigned *shift)
73
{
74 75
	VM_WARN(!arch_irqs_disabled(),
		"%s called with irq enabled\n", __func__);
76
	return __find_linux_pte_or_hugepte(pgdir, ea, is_thp, shift);
77
}
78 79 80

unsigned long vmalloc_to_phys(void *vmalloc_addr);

L
Linus Torvalds 已提交
81 82
#endif /* __ASSEMBLY__ */

83
#endif /* _ASM_POWERPC_PGTABLE_H */