1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16#ifndef _ASM_TILE_PGTABLE_32_H
17#define _ASM_TILE_PGTABLE_32_H
18
19
20
21
22
23#define PGDIR_SHIFT HV_LOG2_PAGE_SIZE_LARGE
24#define PGDIR_SIZE HV_PAGE_SIZE_LARGE
25#define PGDIR_MASK (~(PGDIR_SIZE-1))
26#define PTRS_PER_PGD (1 << (32 - PGDIR_SHIFT))
27#define SIZEOF_PGD (PTRS_PER_PGD * sizeof(pgd_t))
28
29
30
31
32
33
34
35
36#define PTRS_PER_PTE (1 << (HV_LOG2_PAGE_SIZE_LARGE - HV_LOG2_PAGE_SIZE_SMALL))
37#define SIZEOF_PTE (PTRS_PER_PTE * sizeof(pte_t))
38
39#ifndef __ASSEMBLY__
40
41
42
43
44
45
46
47
48
49
50
51#define LAST_PKMAP PTRS_PER_PTE
52
53#define PKMAP_BASE ((FIXADDR_BOOT_START - PAGE_SIZE*LAST_PKMAP) & PGDIR_MASK)
54
55#ifdef CONFIG_HIGHMEM
56# define __VMAPPING_END (PKMAP_BASE & ~(HPAGE_SIZE-1))
57#else
58# define __VMAPPING_END (FIXADDR_START & ~(HPAGE_SIZE-1))
59#endif
60
61#ifdef CONFIG_HUGEVMAP
62#define HUGE_VMAP_END __VMAPPING_END
63#define HUGE_VMAP_BASE (HUGE_VMAP_END - CONFIG_NR_HUGE_VMAPS * HPAGE_SIZE)
64#define _VMALLOC_END HUGE_VMAP_BASE
65#else
66#define _VMALLOC_END __VMAPPING_END
67#endif
68
69
70
71
72
73
74#define VMALLOC_END (_VMALLOC_END - PAGE_SIZE)
75extern unsigned long VMALLOC_RESERVE ;
76#define _VMALLOC_START (_VMALLOC_END - VMALLOC_RESERVE)
77#define VMALLOC_START (_VMALLOC_START + PAGE_SIZE)
78
79
80#define MAXMEM (_VMALLOC_START - PAGE_OFFSET)
81
82
83#include <asm-generic/pgtable-nopmd.h>
84
85
86static inline int pgd_addr_invalid(unsigned long addr)
87{
88 return addr >= MEM_HV_INTRPT;
89}
90
91
92
93
94
95
96
97#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
98#define __HAVE_ARCH_PTEP_SET_WRPROTECT
99
100extern int ptep_test_and_clear_young(struct vm_area_struct *,
101 unsigned long addr, pte_t *);
102extern void ptep_set_wrprotect(struct mm_struct *,
103 unsigned long addr, pte_t *);
104
105#define __HAVE_ARCH_PTEP_GET_AND_CLEAR
106static inline pte_t ptep_get_and_clear(struct mm_struct *mm,
107 unsigned long addr, pte_t *ptep)
108{
109 pte_t pte = *ptep;
110 pte_clear(_mm, addr, ptep);
111 return pte;
112}
113
114static inline void __set_pmd(pmd_t *pmdp, pmd_t pmdval)
115{
116 set_pte(&pmdp->pud.pgd, pmdval.pud.pgd);
117}
118
119
120static inline pmd_t ptfn_pmd(unsigned long ptfn, pgprot_t prot)
121{
122 return (pmd_t){ { hv_pte_set_ptfn(prot, ptfn) } };
123}
124
125
126#define pmd_ptfn(pmd) hv_pte_get_ptfn((pmd).pud.pgd)
127
128static inline void pmd_clear(pmd_t *pmdp)
129{
130 __pte_clear(&pmdp->pud.pgd);
131}
132
133#endif
134
135#endif
136