diff options
author | Sergei Shtylyov <sshtylyov@ru.mvista.com> | 2006-05-27 14:39:39 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2006-06-05 19:15:18 -0400 |
commit | 7cb710c9a617384cd0ed30638f3acc00125690fc (patch) | |
tree | b73e0f3c4c2df044a049e77f4c2146af2b7327b0 /include | |
parent | aa32374aaa2e516a9b0719477efae0782a62a79e (diff) |
[MIPS] Fix non-linear memory mapping on MIPS
Fix the non-linear memory mapping done via remap_file_pages() -- it
didn't work on any MIPS CPU because the page offset clashing with
_PAGE_FILE and some other page protection bits which should have been left
zeros for this kind of pages.
Signed-off-by: Konstantin Baydarov <kbaidarov@ru.mvista.com>
Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-mips/pgtable-32.h | 45 | ||||
-rw-r--r-- | include/asm-mips/pgtable-64.h | 13 |
2 files changed, 31 insertions, 27 deletions
diff --git a/include/asm-mips/pgtable-32.h b/include/asm-mips/pgtable-32.h index a5ce3f17a989..087c20769256 100644 --- a/include/asm-mips/pgtable-32.h +++ b/include/asm-mips/pgtable-32.h | |||
@@ -177,16 +177,18 @@ pfn_pte(unsigned long pfn, pgprot_t prot) | |||
177 | ((swp_entry_t) { ((type) << 10) | ((offset) << 15) }) | 177 | ((swp_entry_t) { ((type) << 10) | ((offset) << 15) }) |
178 | 178 | ||
179 | /* | 179 | /* |
180 | * Bits 0, 1, 2, 9 and 10 are taken, split up the 27 bits of offset | 180 | * Bits 0, 4, 8, and 9 are taken, split up 28 bits of offset into this range: |
181 | * into this range: | ||
182 | */ | 181 | */ |
183 | #define PTE_FILE_MAX_BITS 27 | 182 | #define PTE_FILE_MAX_BITS 28 |
184 | 183 | ||
185 | #define pte_to_pgoff(_pte) \ | 184 | #define pte_to_pgoff(_pte) ((((_pte).pte >> 1 ) & 0x07) | \ |
186 | ((((_pte).pte >> 3) & 0x3f ) + (((_pte).pte >> 11) << 8 )) | 185 | (((_pte).pte >> 2 ) & 0x38) | \ |
186 | (((_pte).pte >> 10) << 6 )) | ||
187 | 187 | ||
188 | #define pgoff_to_pte(off) \ | 188 | #define pgoff_to_pte(off) ((pte_t) { (((off) & 0x07) << 1 ) | \ |
189 | ((pte_t) { (((off) & 0x3f) << 3) + (((off) >> 8) << 11) + _PAGE_FILE }) | 189 | (((off) & 0x38) << 2 ) | \ |
190 | (((off) >> 6 ) << 10) | \ | ||
191 | _PAGE_FILE }) | ||
190 | 192 | ||
191 | #else | 193 | #else |
192 | 194 | ||
@@ -203,24 +205,29 @@ pfn_pte(unsigned long pfn, pgprot_t prot) | |||
203 | ((swp_entry_t) { ((type) << 8) | ((offset) << 13) }) | 205 | ((swp_entry_t) { ((type) << 8) | ((offset) << 13) }) |
204 | #endif /* defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32) */ | 206 | #endif /* defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32) */ |
205 | 207 | ||
208 | #if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32) | ||
206 | /* | 209 | /* |
207 | * Bits 0, 1, 2, 7 and 8 are taken, split up the 27 bits of offset | 210 | * Bits 0 and 1 of pte_high are taken, use the rest for the page offset... |
208 | * into this range: | ||
209 | */ | 211 | */ |
210 | #define PTE_FILE_MAX_BITS 27 | 212 | #define PTE_FILE_MAX_BITS 30 |
211 | 213 | ||
212 | #if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32_R1) | 214 | #define pte_to_pgoff(_pte) ((_pte).pte_high >> 2) |
213 | /* fixme */ | 215 | #define pgoff_to_pte(off) ((pte_t) { _PAGE_FILE, (off) << 2 }) |
214 | #define pte_to_pgoff(_pte) (((_pte).pte_high >> 6) + ((_pte).pte_high & 0x3f)) | ||
215 | #define pgoff_to_pte(off) \ | ||
216 | ((pte_t){(((off) & 0x3f) + ((off) << 6) + _PAGE_FILE)}) | ||
217 | 216 | ||
218 | #else | 217 | #else |
219 | #define pte_to_pgoff(_pte) \ | 218 | /* |
220 | ((((_pte).pte >> 3) & 0x1f ) + (((_pte).pte >> 9) << 6 )) | 219 | * Bits 0, 4, 6, and 7 are taken, split up 28 bits of offset into this range: |
220 | */ | ||
221 | #define PTE_FILE_MAX_BITS 28 | ||
222 | |||
223 | #define pte_to_pgoff(_pte) ((((_pte).pte >> 1) & 0x7) | \ | ||
224 | (((_pte).pte >> 2) & 0x8) | \ | ||
225 | (((_pte).pte >> 8) << 4)) | ||
221 | 226 | ||
222 | #define pgoff_to_pte(off) \ | 227 | #define pgoff_to_pte(off) ((pte_t) { (((off) & 0x7) << 1) | \ |
223 | ((pte_t) { (((off) & 0x1f) << 3) + (((off) >> 6) << 9) + _PAGE_FILE }) | 228 | (((off) & 0x8) << 2) | \ |
229 | (((off) >> 4) << 8) | \ | ||
230 | _PAGE_FILE }) | ||
224 | #endif | 231 | #endif |
225 | 232 | ||
226 | #endif | 233 | #endif |
diff --git a/include/asm-mips/pgtable-64.h b/include/asm-mips/pgtable-64.h index 82166b254b27..2faf5c9ff127 100644 --- a/include/asm-mips/pgtable-64.h +++ b/include/asm-mips/pgtable-64.h | |||
@@ -224,15 +224,12 @@ static inline pte_t mk_swap_pte(unsigned long type, unsigned long offset) | |||
224 | #define __swp_entry_to_pte(x) ((pte_t) { (x).val }) | 224 | #define __swp_entry_to_pte(x) ((pte_t) { (x).val }) |
225 | 225 | ||
226 | /* | 226 | /* |
227 | * Bits 0, 1, 2, 7 and 8 are taken, split up the 32 bits of offset | 227 | * Bits 0, 4, 6, and 7 are taken. Let's leave bits 1, 2, 3, and 5 alone to |
228 | * into this range: | 228 | * make things easier, and only use the upper 56 bits for the page offset... |
229 | */ | 229 | */ |
230 | #define PTE_FILE_MAX_BITS 32 | 230 | #define PTE_FILE_MAX_BITS 56 |
231 | 231 | ||
232 | #define pte_to_pgoff(_pte) \ | 232 | #define pte_to_pgoff(_pte) ((_pte).pte >> 8) |
233 | ((((_pte).pte >> 3) & 0x1f ) + (((_pte).pte >> 9) << 6 )) | 233 | #define pgoff_to_pte(off) ((pte_t) { ((off) << 8) | _PAGE_FILE }) |
234 | |||
235 | #define pgoff_to_pte(off) \ | ||
236 | ((pte_t) { (((off) & 0x1f) << 3) + (((off) >> 6) << 9) + _PAGE_FILE }) | ||
237 | 234 | ||
238 | #endif /* _ASM_PGTABLE_64_H */ | 235 | #endif /* _ASM_PGTABLE_64_H */ |