diff options
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/include/asm/pgtable.h | 57 | ||||
-rw-r--r-- | arch/powerpc/include/asm/pte-common.h | 5 |
2 files changed, 17 insertions, 45 deletions
diff --git a/arch/powerpc/include/asm/pgtable.h b/arch/powerpc/include/asm/pgtable.h index d98c1ecc3266..f60d4ea8b50c 100644 --- a/arch/powerpc/include/asm/pgtable.h +++ b/arch/powerpc/include/asm/pgtable.h | |||
@@ -38,10 +38,9 @@ static inline int pte_none(pte_t pte) { return (pte_val(pte) & ~_PTE_NONE_MASK) | |||
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 | 40 | #ifdef CONFIG_NUMA_BALANCING |
41 | |||
42 | static inline int pte_present(pte_t pte) | 41 | static inline int pte_present(pte_t pte) |
43 | { | 42 | { |
44 | return pte_val(pte) & (_PAGE_PRESENT | _PAGE_NUMA); | 43 | return pte_val(pte) & _PAGE_NUMA_MASK; |
45 | } | 44 | } |
46 | 45 | ||
47 | #define pte_present_nonuma pte_present_nonuma | 46 | #define pte_present_nonuma pte_present_nonuma |
@@ -50,37 +49,6 @@ static inline int pte_present_nonuma(pte_t pte) | |||
50 | return pte_val(pte) & (_PAGE_PRESENT); | 49 | return pte_val(pte) & (_PAGE_PRESENT); |
51 | } | 50 | } |
52 | 51 | ||
53 | #define pte_numa pte_numa | ||
54 | static inline int pte_numa(pte_t pte) | ||
55 | { | ||
56 | return (pte_val(pte) & | ||
57 | (_PAGE_NUMA|_PAGE_PRESENT)) == _PAGE_NUMA; | ||
58 | } | ||
59 | |||
60 | #define pte_mknonnuma pte_mknonnuma | ||
61 | static inline pte_t pte_mknonnuma(pte_t pte) | ||
62 | { | ||
63 | pte_val(pte) &= ~_PAGE_NUMA; | ||
64 | pte_val(pte) |= _PAGE_PRESENT | _PAGE_ACCESSED; | ||
65 | return pte; | ||
66 | } | ||
67 | |||
68 | #define pte_mknuma pte_mknuma | ||
69 | static inline pte_t pte_mknuma(pte_t pte) | ||
70 | { | ||
71 | /* | ||
72 | * We should not set _PAGE_NUMA on non present ptes. Also clear the | ||
73 | * present bit so that hash_page will return 1 and we collect this | ||
74 | * as numa fault. | ||
75 | */ | ||
76 | if (pte_present(pte)) { | ||
77 | pte_val(pte) |= _PAGE_NUMA; | ||
78 | pte_val(pte) &= ~_PAGE_PRESENT; | ||
79 | } else | ||
80 | VM_BUG_ON(1); | ||
81 | return pte; | ||
82 | } | ||
83 | |||
84 | #define ptep_set_numa ptep_set_numa | 52 | #define ptep_set_numa ptep_set_numa |
85 | static inline void ptep_set_numa(struct mm_struct *mm, unsigned long addr, | 53 | static inline void ptep_set_numa(struct mm_struct *mm, unsigned long addr, |
86 | pte_t *ptep) | 54 | pte_t *ptep) |
@@ -92,12 +60,6 @@ static inline void ptep_set_numa(struct mm_struct *mm, unsigned long addr, | |||
92 | return; | 60 | return; |
93 | } | 61 | } |
94 | 62 | ||
95 | #define pmd_numa pmd_numa | ||
96 | static inline int pmd_numa(pmd_t pmd) | ||
97 | { | ||
98 | return pte_numa(pmd_pte(pmd)); | ||
99 | } | ||
100 | |||
101 | #define pmdp_set_numa pmdp_set_numa | 63 | #define pmdp_set_numa pmdp_set_numa |
102 | static inline void pmdp_set_numa(struct mm_struct *mm, unsigned long addr, | 64 | static inline void pmdp_set_numa(struct mm_struct *mm, unsigned long addr, |
103 | pmd_t *pmdp) | 65 | pmd_t *pmdp) |
@@ -109,16 +71,21 @@ static inline void pmdp_set_numa(struct mm_struct *mm, unsigned long addr, | |||
109 | return; | 71 | return; |
110 | } | 72 | } |
111 | 73 | ||
112 | #define pmd_mknonnuma pmd_mknonnuma | 74 | /* |
113 | static inline pmd_t pmd_mknonnuma(pmd_t pmd) | 75 | * Generic NUMA pte helpers expect pteval_t and pmdval_t types to exist |
76 | * which was inherited from x86. For the purposes of powerpc pte_basic_t and | ||
77 | * pmd_t are equivalent | ||
78 | */ | ||
79 | #define pteval_t pte_basic_t | ||
80 | #define pmdval_t pmd_t | ||
81 | static inline pteval_t ptenuma_flags(pte_t pte) | ||
114 | { | 82 | { |
115 | return pte_pmd(pte_mknonnuma(pmd_pte(pmd))); | 83 | return pte_val(pte) & _PAGE_NUMA_MASK; |
116 | } | 84 | } |
117 | 85 | ||
118 | #define pmd_mknuma pmd_mknuma | 86 | static inline pmdval_t pmdnuma_flags(pmd_t pmd) |
119 | static inline pmd_t pmd_mknuma(pmd_t pmd) | ||
120 | { | 87 | { |
121 | return pte_pmd(pte_mknuma(pmd_pte(pmd))); | 88 | return pmd_val(pmd) & _PAGE_NUMA_MASK; |
122 | } | 89 | } |
123 | 90 | ||
124 | # else | 91 | # else |
diff --git a/arch/powerpc/include/asm/pte-common.h b/arch/powerpc/include/asm/pte-common.h index 8d1569c29042..e040c3595129 100644 --- a/arch/powerpc/include/asm/pte-common.h +++ b/arch/powerpc/include/asm/pte-common.h | |||
@@ -98,6 +98,11 @@ extern unsigned long bad_call_to_PMD_PAGE_SIZE(void); | |||
98 | _PAGE_USER | _PAGE_ACCESSED | \ | 98 | _PAGE_USER | _PAGE_ACCESSED | \ |
99 | _PAGE_RW | _PAGE_HWWRITE | _PAGE_DIRTY | _PAGE_EXEC) | 99 | _PAGE_RW | _PAGE_HWWRITE | _PAGE_DIRTY | _PAGE_EXEC) |
100 | 100 | ||
101 | #ifdef CONFIG_NUMA_BALANCING | ||
102 | /* Mask of bits that distinguish present and numa ptes */ | ||
103 | #define _PAGE_NUMA_MASK (_PAGE_NUMA|_PAGE_PRESENT) | ||
104 | #endif | ||
105 | |||
101 | /* | 106 | /* |
102 | * We define 2 sets of base prot bits, one for basic pages (ie, | 107 | * We define 2 sets of base prot bits, one for basic pages (ie, |
103 | * cacheable kernel and user pages) and one for non cacheable | 108 | * cacheable kernel and user pages) and one for non cacheable |