aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-x86/pgalloc_32.h
diff options
context:
space:
mode:
authorJeremy Fitzhardinge <jeremy@goop.org>2008-01-30 07:33:39 -0500
committerIngo Molnar <mingo@elte.hu>2008-01-30 07:33:39 -0500
commita5a19c63f4e55e32dc0bc3d936d7f94793d8b380 (patch)
tree3aaf621cd79889ed2658de2c30fa2fea42c86cf5 /include/asm-x86/pgalloc_32.h
parent6c435456dc91ace468b4e9d72ad0e13dafa22a45 (diff)
x86: demacro asm-x86/pgalloc_32.h
Convert macros into inline functions, for better type-checking. This patch required a little bit of fiddling with headers in order to make __(pte|pmd)_free_tlb inline rather than macros. asm-generic/tlb.h includes asm/pgalloc.h, though it doesn't directly use any pgalloc definitions. I removed this include to avoid an include cycle, but it may cause secondary compile failures by things depending on the indirect inclusion; arch/x86/mm/hugetlbpage.c was one such place; there may be others. Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'include/asm-x86/pgalloc_32.h')
-rw-r--r--include/asm-x86/pgalloc_32.h61
1 files changed, 39 insertions, 22 deletions
diff --git a/include/asm-x86/pgalloc_32.h b/include/asm-x86/pgalloc_32.h
index fbc6357f5eba..3482c3427897 100644
--- a/include/asm-x86/pgalloc_32.h
+++ b/include/asm-x86/pgalloc_32.h
@@ -3,6 +3,8 @@
3 3
4#include <linux/threads.h> 4#include <linux/threads.h>
5#include <linux/mm.h> /* for struct page */ 5#include <linux/mm.h> /* for struct page */
6#include <asm/tlb.h>
7#include <asm-generic/tlb.h>
6 8
7#ifdef CONFIG_PARAVIRT 9#ifdef CONFIG_PARAVIRT
8#include <asm/paravirt.h> 10#include <asm/paravirt.h>
@@ -14,19 +16,20 @@
14#define paravirt_release_pd(pfn) do { } while (0) 16#define paravirt_release_pd(pfn) do { } while (0)
15#endif 17#endif
16 18
17#define pmd_populate_kernel(mm, pmd, pte) \ 19static inline void pmd_populate_kernel(struct mm_struct *mm,
18do { \ 20 pmd_t *pmd, pte_t *pte)
19 paravirt_alloc_pt(mm, __pa(pte) >> PAGE_SHIFT); \ 21{
20 set_pmd(pmd, __pmd(_PAGE_TABLE + __pa(pte))); \ 22 paravirt_alloc_pt(mm, __pa(pte) >> PAGE_SHIFT);
21} while (0) 23 set_pmd(pmd, __pmd(__pa(pte) | _PAGE_TABLE));
24}
22 25
23#define pmd_populate(mm, pmd, pte) \ 26static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, struct page *pte)
24do { \ 27{
25 paravirt_alloc_pt(mm, page_to_pfn(pte)); \ 28 unsigned long pfn = page_to_pfn(pte);
26 set_pmd(pmd, __pmd(_PAGE_TABLE + \ 29
27 ((unsigned long long)page_to_pfn(pte) << \ 30 paravirt_alloc_pt(mm, pfn);
28 (unsigned long long) PAGE_SHIFT))); \ 31 set_pmd(pmd, __pmd(((pteval_t)pfn << PAGE_SHIFT) | _PAGE_TABLE));
29} while (0) 32}
30 33
31/* 34/*
32 * Allocate and free page tables. 35 * Allocate and free page tables.
@@ -48,20 +51,34 @@ static inline void pte_free(struct page *pte)
48} 51}
49 52
50 53
51#define __pte_free_tlb(tlb,pte) \ 54static inline void __pte_free_tlb(struct mmu_gather *tlb, struct page *pte)
52do { \ 55{
53 paravirt_release_pt(page_to_pfn(pte)); \ 56 paravirt_release_pt(page_to_pfn(pte));
54 tlb_remove_page((tlb),(pte)); \ 57 tlb_remove_page(tlb, pte);
55} while (0) 58}
56 59
57#ifdef CONFIG_X86_PAE 60#ifdef CONFIG_X86_PAE
58/* 61/*
59 * In the PAE case we free the pmds as part of the pgd. 62 * In the PAE case we free the pmds as part of the pgd.
60 */ 63 */
61#define pmd_alloc_one(mm, addr) ({ BUG(); ((pmd_t *)2); }) 64static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr)
62#define pmd_free(x) do { } while (0) 65{
63#define __pmd_free_tlb(tlb,x) do { } while (0) 66 BUG();
64#define pud_populate(mm, pmd, pte) BUG() 67 return (pmd_t *)2;
65#endif 68}
69
70static inline void pmd_free(pmd_t *pmd)
71{
72}
73
74static inline void __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd)
75{
76}
77
78static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd)
79{
80 BUG();
81}
82#endif /* CONFIG_X86_PAE */
66 83
67#endif /* _I386_PGALLOC_H */ 84#endif /* _I386_PGALLOC_H */