aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-sh
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-sh')
-rw-r--r--include/asm-sh/page.h2
-rw-r--r--include/asm-sh/pgalloc.h27
2 files changed, 22 insertions, 7 deletions
diff --git a/include/asm-sh/page.h b/include/asm-sh/page.h
index e0fe02950f52..134562dc8c45 100644
--- a/include/asm-sh/page.h
+++ b/include/asm-sh/page.h
@@ -100,6 +100,8 @@ typedef struct { unsigned long pgd; } pgd_t;
100#define __pgd(x) ((pgd_t) { (x) } ) 100#define __pgd(x) ((pgd_t) { (x) } )
101#define __pgprot(x) ((pgprot_t) { (x) } ) 101#define __pgprot(x) ((pgprot_t) { (x) } )
102 102
103typedef struct page *pgtable_t;
104
103#endif /* !__ASSEMBLY__ */ 105#endif /* !__ASSEMBLY__ */
104 106
105/* 107/*
diff --git a/include/asm-sh/pgalloc.h b/include/asm-sh/pgalloc.h
index 59ca16d77a1d..84dd2db7104c 100644
--- a/include/asm-sh/pgalloc.h
+++ b/include/asm-sh/pgalloc.h
@@ -14,10 +14,11 @@ static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd,
14} 14}
15 15
16static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, 16static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd,
17 struct page *pte) 17 pgtable_t pte)
18{ 18{
19 set_pmd(pmd, __pmd((unsigned long)page_address(pte))); 19 set_pmd(pmd, __pmd((unsigned long)page_address(pte)));
20} 20}
21#define pmd_pgtable(pmd) pmd_page(pmd)
21 22
22static inline void pgd_ctor(void *x) 23static inline void pgd_ctor(void *x)
23{ 24{
@@ -47,11 +48,18 @@ static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
47 return quicklist_alloc(QUICK_PT, GFP_KERNEL | __GFP_REPEAT, NULL); 48 return quicklist_alloc(QUICK_PT, GFP_KERNEL | __GFP_REPEAT, NULL);
48} 49}
49 50
50static inline struct page *pte_alloc_one(struct mm_struct *mm, 51static inline pgtable_t pte_alloc_one(struct mm_struct *mm,
51 unsigned long address) 52 unsigned long address)
52{ 53{
53 void *pg = quicklist_alloc(QUICK_PT, GFP_KERNEL | __GFP_REPEAT, NULL); 54 struct page *page;
54 return pg ? virt_to_page(pg) : NULL; 55 void *pg;
56
57 pg = quicklist_alloc(QUICK_PT, GFP_KERNEL | __GFP_REPEAT, NULL);
58 if (!pg)
59 return NULL;
60 page = virt_to_page(pg);
61 pgtable_page_ctor(page);
62 return page;
55} 63}
56 64
57static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte) 65static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
@@ -59,12 +67,17 @@ static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
59 quicklist_free(QUICK_PT, NULL, pte); 67 quicklist_free(QUICK_PT, NULL, pte);
60} 68}
61 69
62static inline void pte_free(struct mm_struct *mm, struct page *pte) 70static inline void pte_free(struct mm_struct *mm, pgtable_t pte)
63{ 71{
72 pgtable_page_dtor(pte);
64 quicklist_free_page(QUICK_PT, NULL, pte); 73 quicklist_free_page(QUICK_PT, NULL, pte);
65} 74}
66 75
67#define __pte_free_tlb(tlb,pte) tlb_remove_page((tlb),(pte)) 76#define __pte_free_tlb(tlb,pte) \
77do { \
78 pgtable_page_dtor(pte); \
79 tlb_remove_page((tlb), (pte)); \
80} while (0)
68 81
69/* 82/*
70 * allocating and freeing a pmd is trivial: the 1-entry pmd is 83 * allocating and freeing a pmd is trivial: the 1-entry pmd is