diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2012-09-28 10:29:55 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2012-09-28 10:29:55 -0400 |
commit | cb418b34caddc970c1513e515aaa535246a4bba3 (patch) | |
tree | b89720b74d6a85a9407f03bb064248c7235b9dea /arch/mips/mm | |
parent | 77a0d763c461da81c2a3fc9a7e58162a40854a1a (diff) | |
parent | ff401e52100dcdc85e572d1ad376d3307b3fe28e (diff) |
Merge branch 'ralf-3.7' of git://git.linux-mips.org/pub/scm/sjhill/linux-sjhill into mips-for-linux-next
Diffstat (limited to 'arch/mips/mm')
-rw-r--r-- | arch/mips/mm/c-r4k.c | 21 | ||||
-rw-r--r-- | arch/mips/mm/tlbex.c | 30 | ||||
-rw-r--r-- | arch/mips/mm/uasm.c | 23 |
3 files changed, 68 insertions, 6 deletions
diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c index f092c265dc63..4c32ede464b5 100644 --- a/arch/mips/mm/c-r4k.c +++ b/arch/mips/mm/c-r4k.c | |||
@@ -786,6 +786,25 @@ static inline void rm7k_erratum31(void) | |||
786 | } | 786 | } |
787 | } | 787 | } |
788 | 788 | ||
789 | static inline void alias_74k_erratum(struct cpuinfo_mips *c) | ||
790 | { | ||
791 | /* | ||
792 | * Early versions of the 74K do not update the cache tags on a | ||
793 | * vtag miss/ptag hit which can occur in the case of KSEG0/KUSEG | ||
794 | * aliases. In this case it is better to treat the cache as always | ||
795 | * having aliases. | ||
796 | */ | ||
797 | if ((c->processor_id & 0xff) <= PRID_REV_ENCODE_332(2, 4, 0)) | ||
798 | c->dcache.flags |= MIPS_CACHE_VTAG; | ||
799 | if ((c->processor_id & 0xff) == PRID_REV_ENCODE_332(2, 4, 0)) | ||
800 | write_c0_config6(read_c0_config6() | MIPS_CONF6_SYND); | ||
801 | if (((c->processor_id & 0xff00) == PRID_IMP_1074K) && | ||
802 | ((c->processor_id & 0xff) <= PRID_REV_ENCODE_332(1, 1, 0))) { | ||
803 | c->dcache.flags |= MIPS_CACHE_VTAG; | ||
804 | write_c0_config6(read_c0_config6() | MIPS_CONF6_SYND); | ||
805 | } | ||
806 | } | ||
807 | |||
789 | static char *way_string[] __cpuinitdata = { NULL, "direct mapped", "2-way", | 808 | static char *way_string[] __cpuinitdata = { NULL, "direct mapped", "2-way", |
790 | "3-way", "4-way", "5-way", "6-way", "7-way", "8-way" | 809 | "3-way", "4-way", "5-way", "6-way", "7-way", "8-way" |
791 | }; | 810 | }; |
@@ -1056,6 +1075,8 @@ static void __cpuinit probe_pcache(void) | |||
1056 | case CPU_34K: | 1075 | case CPU_34K: |
1057 | case CPU_74K: | 1076 | case CPU_74K: |
1058 | case CPU_1004K: | 1077 | case CPU_1004K: |
1078 | if (c->cputype == CPU_74K) | ||
1079 | alias_74k_erratum(c); | ||
1059 | if ((read_c0_config7() & (1 << 16))) { | 1080 | if ((read_c0_config7() & (1 << 16))) { |
1060 | /* effectively physically indexed dcache, | 1081 | /* effectively physically indexed dcache, |
1061 | thus no virtual aliases. */ | 1082 | thus no virtual aliases. */ |
diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c index 1832f17e6be4..e09d49256908 100644 --- a/arch/mips/mm/tlbex.c +++ b/arch/mips/mm/tlbex.c | |||
@@ -449,8 +449,20 @@ static void __cpuinit build_tlb_write_entry(u32 **p, struct uasm_label **l, | |||
449 | } | 449 | } |
450 | 450 | ||
451 | if (cpu_has_mips_r2) { | 451 | if (cpu_has_mips_r2) { |
452 | if (cpu_has_mips_r2_exec_hazard) | 452 | /* |
453 | * The architecture spec says an ehb is required here, | ||
454 | * but a number of cores do not have the hazard and | ||
455 | * using an ehb causes an expensive pipeline stall. | ||
456 | */ | ||
457 | switch (current_cpu_type()) { | ||
458 | case CPU_M14KC: | ||
459 | case CPU_74K: | ||
460 | break; | ||
461 | |||
462 | default: | ||
453 | uasm_i_ehb(p); | 463 | uasm_i_ehb(p); |
464 | break; | ||
465 | } | ||
454 | tlbw(p); | 466 | tlbw(p); |
455 | return; | 467 | return; |
456 | } | 468 | } |
@@ -921,6 +933,13 @@ build_get_pgde32(u32 **p, unsigned int tmp, unsigned int ptr) | |||
921 | #endif | 933 | #endif |
922 | uasm_i_mfc0(p, tmp, C0_BADVADDR); /* get faulting address */ | 934 | uasm_i_mfc0(p, tmp, C0_BADVADDR); /* get faulting address */ |
923 | uasm_i_lw(p, ptr, uasm_rel_lo(pgdc), ptr); | 935 | uasm_i_lw(p, ptr, uasm_rel_lo(pgdc), ptr); |
936 | |||
937 | if (cpu_has_mips_r2) { | ||
938 | uasm_i_ext(p, tmp, tmp, PGDIR_SHIFT, (32 - PGDIR_SHIFT)); | ||
939 | uasm_i_ins(p, ptr, tmp, PGD_T_LOG2, (32 - PGDIR_SHIFT)); | ||
940 | return; | ||
941 | } | ||
942 | |||
924 | uasm_i_srl(p, tmp, tmp, PGDIR_SHIFT); /* get pgd only bits */ | 943 | uasm_i_srl(p, tmp, tmp, PGDIR_SHIFT); /* get pgd only bits */ |
925 | uasm_i_sll(p, tmp, tmp, PGD_T_LOG2); | 944 | uasm_i_sll(p, tmp, tmp, PGD_T_LOG2); |
926 | uasm_i_addu(p, ptr, ptr, tmp); /* add in pgd offset */ | 945 | uasm_i_addu(p, ptr, ptr, tmp); /* add in pgd offset */ |
@@ -956,6 +975,15 @@ static void __cpuinit build_adjust_context(u32 **p, unsigned int ctx) | |||
956 | 975 | ||
957 | static void __cpuinit build_get_ptep(u32 **p, unsigned int tmp, unsigned int ptr) | 976 | static void __cpuinit build_get_ptep(u32 **p, unsigned int tmp, unsigned int ptr) |
958 | { | 977 | { |
978 | if (cpu_has_mips_r2) { | ||
979 | /* PTE ptr offset is obtained from BadVAddr */ | ||
980 | UASM_i_MFC0(p, tmp, C0_BADVADDR); | ||
981 | UASM_i_LW(p, ptr, 0, ptr); | ||
982 | uasm_i_ext(p, tmp, tmp, PAGE_SHIFT+1, PGDIR_SHIFT-PAGE_SHIFT-1); | ||
983 | uasm_i_ins(p, ptr, tmp, PTE_T_LOG2+1, PGDIR_SHIFT-PAGE_SHIFT-1); | ||
984 | return; | ||
985 | } | ||
986 | |||
959 | /* | 987 | /* |
960 | * Bug workaround for the Nevada. It seems as if under certain | 988 | * Bug workaround for the Nevada. It seems as if under certain |
961 | * circumstances the move from cp0_context might produce a | 989 | * circumstances the move from cp0_context might produce a |
diff --git a/arch/mips/mm/uasm.c b/arch/mips/mm/uasm.c index 64a28e819064..39b891056227 100644 --- a/arch/mips/mm/uasm.c +++ b/arch/mips/mm/uasm.c | |||
@@ -63,11 +63,12 @@ enum opcode { | |||
63 | insn_bne, insn_cache, insn_daddiu, insn_daddu, insn_dins, insn_dinsm, | 63 | insn_bne, insn_cache, insn_daddiu, insn_daddu, insn_dins, insn_dinsm, |
64 | insn_dmfc0, insn_dmtc0, insn_drotr, insn_drotr32, insn_dsll, | 64 | insn_dmfc0, insn_dmtc0, insn_drotr, insn_drotr32, insn_dsll, |
65 | insn_dsll32, insn_dsra, insn_dsrl, insn_dsrl32, insn_dsubu, insn_eret, | 65 | insn_dsll32, insn_dsra, insn_dsrl, insn_dsrl32, insn_dsubu, insn_eret, |
66 | insn_j, insn_jal, insn_jr, insn_ld, insn_ldx, insn_ll, insn_lld, | 66 | insn_ext, insn_ins, insn_j, insn_jal, insn_jr, insn_ld, insn_ldx, |
67 | insn_lui, insn_lw, insn_lwx, insn_mfc0, insn_mtc0, insn_or, insn_ori, | 67 | insn_ll, insn_lld, insn_lui, insn_lw, insn_lwx, insn_mfc0, insn_mtc0, |
68 | insn_pref, insn_rfe, insn_rotr, insn_sc, insn_scd, insn_sd, insn_sll, | 68 | insn_or, insn_ori, insn_pref, insn_rfe, insn_rotr, insn_sc, insn_scd, |
69 | insn_sra, insn_srl, insn_subu, insn_sw, insn_syscall, insn_tlbp, | 69 | insn_sd, insn_sll, insn_sra, insn_srl, insn_subu, insn_sw, |
70 | insn_tlbr, insn_tlbwi, insn_tlbwr, insn_xor, insn_xori, | 70 | insn_syscall, insn_tlbp, insn_tlbr, insn_tlbwi, insn_tlbwr, insn_xor, |
71 | insn_xori, | ||
71 | }; | 72 | }; |
72 | 73 | ||
73 | struct insn { | 74 | struct insn { |
@@ -115,6 +116,9 @@ static struct insn insn_table[] __uasminitdata = { | |||
115 | { insn_dsrl, M(spec_op, 0, 0, 0, 0, dsrl_op), RT | RD | RE }, | 116 | { insn_dsrl, M(spec_op, 0, 0, 0, 0, dsrl_op), RT | RD | RE }, |
116 | { insn_dsubu, M(spec_op, 0, 0, 0, 0, dsubu_op), RS | RT | RD }, | 117 | { insn_dsubu, M(spec_op, 0, 0, 0, 0, dsubu_op), RS | RT | RD }, |
117 | { insn_eret, M(cop0_op, cop_op, 0, 0, 0, eret_op), 0 }, | 118 | { insn_eret, M(cop0_op, cop_op, 0, 0, 0, eret_op), 0 }, |
119 | { insn_ext, M(spec3_op, 0, 0, 0, 0, ext_op), RS | RT | RD | RE }, | ||
120 | { insn_ins, M(spec3_op, 0, 0, 0, 0, ins_op), RS | RT | RD | RE }, | ||
121 | { insn_j, M(j_op, 0, 0, 0, 0, 0), JIMM }, | ||
118 | { insn_jal, M(jal_op, 0, 0, 0, 0, 0), JIMM }, | 122 | { insn_jal, M(jal_op, 0, 0, 0, 0, 0), JIMM }, |
119 | { insn_j, M(j_op, 0, 0, 0, 0, 0), JIMM }, | 123 | { insn_j, M(j_op, 0, 0, 0, 0, 0), JIMM }, |
120 | { insn_jr, M(spec_op, 0, 0, 0, 0, jr_op), RS }, | 124 | { insn_jr, M(spec_op, 0, 0, 0, 0, jr_op), RS }, |
@@ -341,6 +345,13 @@ Ip_u2u1msbu3(op) \ | |||
341 | } \ | 345 | } \ |
342 | UASM_EXPORT_SYMBOL(uasm_i##op); | 346 | UASM_EXPORT_SYMBOL(uasm_i##op); |
343 | 347 | ||
348 | #define I_u2u1msbdu3(op) \ | ||
349 | Ip_u2u1msbu3(op) \ | ||
350 | { \ | ||
351 | build_insn(buf, insn##op, b, a, d-1, c); \ | ||
352 | } \ | ||
353 | UASM_EXPORT_SYMBOL(uasm_i##op); | ||
354 | |||
344 | #define I_u1u2(op) \ | 355 | #define I_u1u2(op) \ |
345 | Ip_u1u2(op) \ | 356 | Ip_u1u2(op) \ |
346 | { \ | 357 | { \ |
@@ -394,6 +405,8 @@ I_u2u1u3(_drotr) | |||
394 | I_u2u1u3(_drotr32) | 405 | I_u2u1u3(_drotr32) |
395 | I_u3u1u2(_dsubu) | 406 | I_u3u1u2(_dsubu) |
396 | I_0(_eret) | 407 | I_0(_eret) |
408 | I_u2u1msbdu3(_ext) | ||
409 | I_u2u1msbu3(_ins) | ||
397 | I_u1(_j) | 410 | I_u1(_j) |
398 | I_u1(_jal) | 411 | I_u1(_jal) |
399 | I_u1(_jr) | 412 | I_u1(_jr) |