diff options
Diffstat (limited to 'arch/mips/mm/page.c')
| -rw-r--r-- | arch/mips/mm/page.c | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/arch/mips/mm/page.c b/arch/mips/mm/page.c index b611102e23b5..3f85f921801b 100644 --- a/arch/mips/mm/page.c +++ b/arch/mips/mm/page.c | |||
| @@ -72,6 +72,20 @@ static struct uasm_reloc relocs[5]; | |||
| 72 | #define cpu_is_r4600_v1_x() ((read_c0_prid() & 0xfffffff0) == 0x00002010) | 72 | #define cpu_is_r4600_v1_x() ((read_c0_prid() & 0xfffffff0) == 0x00002010) |
| 73 | #define cpu_is_r4600_v2_x() ((read_c0_prid() & 0xfffffff0) == 0x00002020) | 73 | #define cpu_is_r4600_v2_x() ((read_c0_prid() & 0xfffffff0) == 0x00002020) |
| 74 | 74 | ||
| 75 | /* | ||
| 76 | * R6 has a limited offset of the pref instruction. | ||
| 77 | * Skip it if the offset is more than 9 bits. | ||
| 78 | */ | ||
| 79 | #define _uasm_i_pref(a, b, c, d) \ | ||
| 80 | do { \ | ||
| 81 | if (cpu_has_mips_r6) { \ | ||
| 82 | if (c <= 0xff && c >= -0x100) \ | ||
| 83 | uasm_i_pref(a, b, c, d);\ | ||
| 84 | } else { \ | ||
| 85 | uasm_i_pref(a, b, c, d); \ | ||
| 86 | } \ | ||
| 87 | } while(0) | ||
| 88 | |||
| 75 | static int pref_bias_clear_store; | 89 | static int pref_bias_clear_store; |
| 76 | static int pref_bias_copy_load; | 90 | static int pref_bias_copy_load; |
| 77 | static int pref_bias_copy_store; | 91 | static int pref_bias_copy_store; |
| @@ -178,7 +192,15 @@ static void set_prefetch_parameters(void) | |||
| 178 | pref_bias_copy_load = 256; | 192 | pref_bias_copy_load = 256; |
| 179 | pref_bias_copy_store = 128; | 193 | pref_bias_copy_store = 128; |
| 180 | pref_src_mode = Pref_LoadStreamed; | 194 | pref_src_mode = Pref_LoadStreamed; |
| 181 | pref_dst_mode = Pref_PrepareForStore; | 195 | if (cpu_has_mips_r6) |
| 196 | /* | ||
| 197 | * Bit 30 (Pref_PrepareForStore) has been | ||
| 198 | * removed from MIPS R6. Use bit 5 | ||
| 199 | * (Pref_StoreStreamed). | ||
| 200 | */ | ||
| 201 | pref_dst_mode = Pref_StoreStreamed; | ||
| 202 | else | ||
| 203 | pref_dst_mode = Pref_PrepareForStore; | ||
| 182 | break; | 204 | break; |
| 183 | } | 205 | } |
| 184 | } else { | 206 | } else { |
| @@ -214,7 +236,7 @@ static inline void build_clear_pref(u32 **buf, int off) | |||
| 214 | return; | 236 | return; |
| 215 | 237 | ||
| 216 | if (pref_bias_clear_store) { | 238 | if (pref_bias_clear_store) { |
| 217 | uasm_i_pref(buf, pref_dst_mode, pref_bias_clear_store + off, | 239 | _uasm_i_pref(buf, pref_dst_mode, pref_bias_clear_store + off, |
| 218 | A0); | 240 | A0); |
| 219 | } else if (cache_line_size == (half_clear_loop_size << 1)) { | 241 | } else if (cache_line_size == (half_clear_loop_size << 1)) { |
| 220 | if (cpu_has_cache_cdex_s) { | 242 | if (cpu_has_cache_cdex_s) { |
| @@ -357,7 +379,7 @@ static inline void build_copy_load_pref(u32 **buf, int off) | |||
| 357 | return; | 379 | return; |
| 358 | 380 | ||
| 359 | if (pref_bias_copy_load) | 381 | if (pref_bias_copy_load) |
| 360 | uasm_i_pref(buf, pref_src_mode, pref_bias_copy_load + off, A1); | 382 | _uasm_i_pref(buf, pref_src_mode, pref_bias_copy_load + off, A1); |
| 361 | } | 383 | } |
| 362 | 384 | ||
| 363 | static inline void build_copy_store_pref(u32 **buf, int off) | 385 | static inline void build_copy_store_pref(u32 **buf, int off) |
| @@ -366,7 +388,7 @@ static inline void build_copy_store_pref(u32 **buf, int off) | |||
| 366 | return; | 388 | return; |
| 367 | 389 | ||
| 368 | if (pref_bias_copy_store) { | 390 | if (pref_bias_copy_store) { |
| 369 | uasm_i_pref(buf, pref_dst_mode, pref_bias_copy_store + off, | 391 | _uasm_i_pref(buf, pref_dst_mode, pref_bias_copy_store + off, |
| 370 | A0); | 392 | A0); |
| 371 | } else if (cache_line_size == (half_copy_loop_size << 1)) { | 393 | } else if (cache_line_size == (half_copy_loop_size << 1)) { |
| 372 | if (cpu_has_cache_cdex_s) { | 394 | if (cpu_has_cache_cdex_s) { |
