diff options
Diffstat (limited to 'arch/powerpc/include/asm/pgtable.h')
-rw-r--r-- | arch/powerpc/include/asm/pgtable.h | 66 |
1 files changed, 65 insertions, 1 deletions
diff --git a/arch/powerpc/include/asm/pgtable.h b/arch/powerpc/include/asm/pgtable.h index 7d6eacf249cf..b999ca318985 100644 --- a/arch/powerpc/include/asm/pgtable.h +++ b/arch/powerpc/include/asm/pgtable.h | |||
@@ -3,6 +3,7 @@ | |||
3 | #ifdef __KERNEL__ | 3 | #ifdef __KERNEL__ |
4 | 4 | ||
5 | #ifndef __ASSEMBLY__ | 5 | #ifndef __ASSEMBLY__ |
6 | #include <linux/mmdebug.h> | ||
6 | #include <asm/processor.h> /* For TASK_SIZE */ | 7 | #include <asm/processor.h> /* For TASK_SIZE */ |
7 | #include <asm/mmu.h> | 8 | #include <asm/mmu.h> |
8 | #include <asm/page.h> | 9 | #include <asm/page.h> |
@@ -33,10 +34,73 @@ static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } | |||
33 | static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } | 34 | static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } |
34 | static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } | 35 | static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } |
35 | static inline int pte_special(pte_t pte) { return pte_val(pte) & _PAGE_SPECIAL; } | 36 | static inline int pte_special(pte_t pte) { return pte_val(pte) & _PAGE_SPECIAL; } |
36 | static inline int pte_present(pte_t pte) { return pte_val(pte) & _PAGE_PRESENT; } | ||
37 | static inline int pte_none(pte_t pte) { return (pte_val(pte) & ~_PTE_NONE_MASK) == 0; } | 37 | static inline int pte_none(pte_t pte) { return (pte_val(pte) & ~_PTE_NONE_MASK) == 0; } |
38 | static inline pgprot_t pte_pgprot(pte_t pte) { return __pgprot(pte_val(pte) & PAGE_PROT_BITS); } | 38 | static inline pgprot_t pte_pgprot(pte_t pte) { return __pgprot(pte_val(pte) & PAGE_PROT_BITS); } |
39 | 39 | ||
40 | #ifdef CONFIG_NUMA_BALANCING | ||
41 | |||
42 | static inline int pte_present(pte_t pte) | ||
43 | { | ||
44 | return pte_val(pte) & (_PAGE_PRESENT | _PAGE_NUMA); | ||
45 | } | ||
46 | |||
47 | #define pte_numa pte_numa | ||
48 | static inline int pte_numa(pte_t pte) | ||
49 | { | ||
50 | return (pte_val(pte) & | ||
51 | (_PAGE_NUMA|_PAGE_PRESENT)) == _PAGE_NUMA; | ||
52 | } | ||
53 | |||
54 | #define pte_mknonnuma pte_mknonnuma | ||
55 | static inline pte_t pte_mknonnuma(pte_t pte) | ||
56 | { | ||
57 | pte_val(pte) &= ~_PAGE_NUMA; | ||
58 | pte_val(pte) |= _PAGE_PRESENT | _PAGE_ACCESSED; | ||
59 | return pte; | ||
60 | } | ||
61 | |||
62 | #define pte_mknuma pte_mknuma | ||
63 | static inline pte_t pte_mknuma(pte_t pte) | ||
64 | { | ||
65 | /* | ||
66 | * We should not set _PAGE_NUMA on non present ptes. Also clear the | ||
67 | * present bit so that hash_page will return 1 and we collect this | ||
68 | * as numa fault. | ||
69 | */ | ||
70 | if (pte_present(pte)) { | ||
71 | pte_val(pte) |= _PAGE_NUMA; | ||
72 | pte_val(pte) &= ~_PAGE_PRESENT; | ||
73 | } else | ||
74 | VM_BUG_ON(1); | ||
75 | return pte; | ||
76 | } | ||
77 | |||
78 | #define pmd_numa pmd_numa | ||
79 | static inline int pmd_numa(pmd_t pmd) | ||
80 | { | ||
81 | return pte_numa(pmd_pte(pmd)); | ||
82 | } | ||
83 | |||
84 | #define pmd_mknonnuma pmd_mknonnuma | ||
85 | static inline pmd_t pmd_mknonnuma(pmd_t pmd) | ||
86 | { | ||
87 | return pte_pmd(pte_mknonnuma(pmd_pte(pmd))); | ||
88 | } | ||
89 | |||
90 | #define pmd_mknuma pmd_mknuma | ||
91 | static inline pmd_t pmd_mknuma(pmd_t pmd) | ||
92 | { | ||
93 | return pte_pmd(pte_mknuma(pmd_pte(pmd))); | ||
94 | } | ||
95 | |||
96 | # else | ||
97 | |||
98 | static inline int pte_present(pte_t pte) | ||
99 | { | ||
100 | return pte_val(pte) & _PAGE_PRESENT; | ||
101 | } | ||
102 | #endif /* CONFIG_NUMA_BALANCING */ | ||
103 | |||
40 | /* Conversion functions: convert a page and protection to a page entry, | 104 | /* Conversion functions: convert a page and protection to a page entry, |
41 | * and a page entry and page directory to the page they refer to. | 105 | * and a page entry and page directory to the page they refer to. |
42 | * | 106 | * |