diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-08-01 13:53:43 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-08-01 13:53:43 -0400 |
commit | 00e9028a95fb8a4d79f2fb695a853f33ea7d3b57 (patch) | |
tree | 2dea2ae498a6ce57de8890e87185aca5e9f3ad2d /arch/sh/include/asm/pgalloc.h | |
parent | 57b1494d2ba544c62673234da6115c21fac27ffc (diff) | |
parent | 7cb93181629c613ee2b8f4ffe3446f8003074842 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6: (28 commits)
mm/hugetlb.c must #include <asm/io.h>
video: Fix up hp6xx driver build regressions.
sh: defconfig updates.
sh: Kill off stray mach-rsk7203 reference.
serial: sh-sci: Fix up SH7760/SH7780/SH7785 early printk regression.
sh: Move out individual boards without mach groups.
sh: Make sure AT_SYSINFO_EHDR is exposed to userspace in asm/auxvec.h.
sh: Allow SH-3 and SH-5 to use common headers.
sh: Provide common CPU headers, prune the SH-2 and SH-2A directories.
sh/maple: clean maple bus code
sh: More header path fixups for mach dir refactoring.
sh: Move out the solution engine headers to arch/sh/include/mach-se/
sh: I2C fix for AP325RXA and Migo-R
sh: Shuffle the board directories in to mach groups.
sh: dma-sh: Fix up dreamcast dma.h mach path.
sh: Switch KBUILD_DEFCONFIG to shx3_defconfig.
sh: Add ARCH_DEFCONFIG entries for sh and sh64.
sh: Fix compile error of Solution Engine
sh: Proper __put_user_asm() size mismatch fix.
sh: Stub in a dummy ENTRY_OFFSET for uImage offset calculation.
...
Diffstat (limited to 'arch/sh/include/asm/pgalloc.h')
-rw-r--r-- | arch/sh/include/asm/pgalloc.h | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/arch/sh/include/asm/pgalloc.h b/arch/sh/include/asm/pgalloc.h new file mode 100644 index 000000000000..84dd2db7104c --- /dev/null +++ b/arch/sh/include/asm/pgalloc.h | |||
@@ -0,0 +1,96 @@ | |||
1 | #ifndef __ASM_SH_PGALLOC_H | ||
2 | #define __ASM_SH_PGALLOC_H | ||
3 | |||
4 | #include <linux/quicklist.h> | ||
5 | #include <asm/page.h> | ||
6 | |||
7 | #define QUICK_PGD 0 /* We preserve special mappings over free */ | ||
8 | #define QUICK_PT 1 /* Other page table pages that are zero on free */ | ||
9 | |||
10 | static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, | ||
11 | pte_t *pte) | ||
12 | { | ||
13 | set_pmd(pmd, __pmd((unsigned long)pte)); | ||
14 | } | ||
15 | |||
16 | static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, | ||
17 | pgtable_t pte) | ||
18 | { | ||
19 | set_pmd(pmd, __pmd((unsigned long)page_address(pte))); | ||
20 | } | ||
21 | #define pmd_pgtable(pmd) pmd_page(pmd) | ||
22 | |||
23 | static inline void pgd_ctor(void *x) | ||
24 | { | ||
25 | pgd_t *pgd = x; | ||
26 | |||
27 | memcpy(pgd + USER_PTRS_PER_PGD, | ||
28 | swapper_pg_dir + USER_PTRS_PER_PGD, | ||
29 | (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t)); | ||
30 | } | ||
31 | |||
32 | /* | ||
33 | * Allocate and free page tables. | ||
34 | */ | ||
35 | static inline pgd_t *pgd_alloc(struct mm_struct *mm) | ||
36 | { | ||
37 | return quicklist_alloc(QUICK_PGD, GFP_KERNEL | __GFP_REPEAT, pgd_ctor); | ||
38 | } | ||
39 | |||
40 | static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd) | ||
41 | { | ||
42 | quicklist_free(QUICK_PGD, NULL, pgd); | ||
43 | } | ||
44 | |||
45 | static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, | ||
46 | unsigned long address) | ||
47 | { | ||
48 | return quicklist_alloc(QUICK_PT, GFP_KERNEL | __GFP_REPEAT, NULL); | ||
49 | } | ||
50 | |||
51 | static inline pgtable_t pte_alloc_one(struct mm_struct *mm, | ||
52 | unsigned long address) | ||
53 | { | ||
54 | struct page *page; | ||
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; | ||
63 | } | ||
64 | |||
65 | static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte) | ||
66 | { | ||
67 | quicklist_free(QUICK_PT, NULL, pte); | ||
68 | } | ||
69 | |||
70 | static inline void pte_free(struct mm_struct *mm, pgtable_t pte) | ||
71 | { | ||
72 | pgtable_page_dtor(pte); | ||
73 | quicklist_free_page(QUICK_PT, NULL, pte); | ||
74 | } | ||
75 | |||
76 | #define __pte_free_tlb(tlb,pte) \ | ||
77 | do { \ | ||
78 | pgtable_page_dtor(pte); \ | ||
79 | tlb_remove_page((tlb), (pte)); \ | ||
80 | } while (0) | ||
81 | |||
82 | /* | ||
83 | * allocating and freeing a pmd is trivial: the 1-entry pmd is | ||
84 | * inside the pgd, so has no extra memory associated with it. | ||
85 | */ | ||
86 | |||
87 | #define pmd_free(mm, x) do { } while (0) | ||
88 | #define __pmd_free_tlb(tlb,x) do { } while (0) | ||
89 | |||
90 | static inline void check_pgt_cache(void) | ||
91 | { | ||
92 | quicklist_trim(QUICK_PGD, NULL, 25, 16); | ||
93 | quicklist_trim(QUICK_PT, NULL, 25, 16); | ||
94 | } | ||
95 | |||
96 | #endif /* __ASM_SH_PGALLOC_H */ | ||