aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/mips/mm/tlbex.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c
index 65b6e85447b1..144ceb0fba88 100644
--- a/arch/mips/mm/tlbex.c
+++ b/arch/mips/mm/tlbex.c
@@ -391,6 +391,7 @@ static struct work_registers build_get_work_registers(u32 **p)
391static void build_restore_work_registers(u32 **p) 391static void build_restore_work_registers(u32 **p)
392{ 392{
393 if (scratch_reg >= 0) { 393 if (scratch_reg >= 0) {
394 uasm_i_ehb(p);
394 UASM_i_MFC0(p, 1, c0_kscratch(), scratch_reg); 395 UASM_i_MFC0(p, 1, c0_kscratch(), scratch_reg);
395 return; 396 return;
396 } 397 }
@@ -668,10 +669,12 @@ static void build_restore_pagemask(u32 **p, struct uasm_reloc **r,
668 uasm_i_mtc0(p, 0, C0_PAGEMASK); 669 uasm_i_mtc0(p, 0, C0_PAGEMASK);
669 uasm_il_b(p, r, lid); 670 uasm_il_b(p, r, lid);
670 } 671 }
671 if (scratch_reg >= 0) 672 if (scratch_reg >= 0) {
673 uasm_i_ehb(p);
672 UASM_i_MFC0(p, 1, c0_kscratch(), scratch_reg); 674 UASM_i_MFC0(p, 1, c0_kscratch(), scratch_reg);
673 else 675 } else {
674 UASM_i_LW(p, 1, scratchpad_offset(0), 0); 676 UASM_i_LW(p, 1, scratchpad_offset(0), 0);
677 }
675 } else { 678 } else {
676 /* Reset default page size */ 679 /* Reset default page size */
677 if (PM_DEFAULT_MASK >> 16) { 680 if (PM_DEFAULT_MASK >> 16) {
@@ -938,10 +941,12 @@ build_get_pgd_vmalloc64(u32 **p, struct uasm_label **l, struct uasm_reloc **r,
938 uasm_i_jr(p, ptr); 941 uasm_i_jr(p, ptr);
939 942
940 if (mode == refill_scratch) { 943 if (mode == refill_scratch) {
941 if (scratch_reg >= 0) 944 if (scratch_reg >= 0) {
945 uasm_i_ehb(p);
942 UASM_i_MFC0(p, 1, c0_kscratch(), scratch_reg); 946 UASM_i_MFC0(p, 1, c0_kscratch(), scratch_reg);
943 else 947 } else {
944 UASM_i_LW(p, 1, scratchpad_offset(0), 0); 948 UASM_i_LW(p, 1, scratchpad_offset(0), 0);
949 }
945 } else { 950 } else {
946 uasm_i_nop(p); 951 uasm_i_nop(p);
947 } 952 }
@@ -1258,6 +1263,7 @@ build_fast_tlb_refill_handler (u32 **p, struct uasm_label **l,
1258 UASM_i_MTC0(p, odd, C0_ENTRYLO1); /* load it */ 1263 UASM_i_MTC0(p, odd, C0_ENTRYLO1); /* load it */
1259 1264
1260 if (c0_scratch_reg >= 0) { 1265 if (c0_scratch_reg >= 0) {
1266 uasm_i_ehb(p);
1261 UASM_i_MFC0(p, scratch, c0_kscratch(), c0_scratch_reg); 1267 UASM_i_MFC0(p, scratch, c0_kscratch(), c0_scratch_reg);
1262 build_tlb_write_entry(p, l, r, tlb_random); 1268 build_tlb_write_entry(p, l, r, tlb_random);
1263 uasm_l_leave(l, *p); 1269 uasm_l_leave(l, *p);
@@ -1603,15 +1609,17 @@ static void build_setup_pgd(void)
1603 uasm_i_dinsm(&p, a0, 0, 29, 64 - 29); 1609 uasm_i_dinsm(&p, a0, 0, 29, 64 - 29);
1604 uasm_l_tlbl_goaround1(&l, p); 1610 uasm_l_tlbl_goaround1(&l, p);
1605 UASM_i_SLL(&p, a0, a0, 11); 1611 UASM_i_SLL(&p, a0, a0, 11);
1606 uasm_i_jr(&p, 31);
1607 UASM_i_MTC0(&p, a0, C0_CONTEXT); 1612 UASM_i_MTC0(&p, a0, C0_CONTEXT);
1613 uasm_i_jr(&p, 31);
1614 uasm_i_ehb(&p);
1608 } else { 1615 } else {
1609 /* PGD in c0_KScratch */ 1616 /* PGD in c0_KScratch */
1610 uasm_i_jr(&p, 31);
1611 if (cpu_has_ldpte) 1617 if (cpu_has_ldpte)
1612 UASM_i_MTC0(&p, a0, C0_PWBASE); 1618 UASM_i_MTC0(&p, a0, C0_PWBASE);
1613 else 1619 else
1614 UASM_i_MTC0(&p, a0, c0_kscratch(), pgd_reg); 1620 UASM_i_MTC0(&p, a0, c0_kscratch(), pgd_reg);
1621 uasm_i_jr(&p, 31);
1622 uasm_i_ehb(&p);
1615 } 1623 }
1616#else 1624#else
1617#ifdef CONFIG_SMP 1625#ifdef CONFIG_SMP
@@ -1625,13 +1633,16 @@ static void build_setup_pgd(void)
1625 UASM_i_LA_mostly(&p, a2, pgdc); 1633 UASM_i_LA_mostly(&p, a2, pgdc);
1626 UASM_i_SW(&p, a0, uasm_rel_lo(pgdc), a2); 1634 UASM_i_SW(&p, a0, uasm_rel_lo(pgdc), a2);
1627#endif /* SMP */ 1635#endif /* SMP */
1628 uasm_i_jr(&p, 31);
1629 1636
1630 /* if pgd_reg is allocated, save PGD also to scratch register */ 1637 /* if pgd_reg is allocated, save PGD also to scratch register */
1631 if (pgd_reg != -1) 1638 if (pgd_reg != -1) {
1632 UASM_i_MTC0(&p, a0, c0_kscratch(), pgd_reg); 1639 UASM_i_MTC0(&p, a0, c0_kscratch(), pgd_reg);
1633 else 1640 uasm_i_jr(&p, 31);
1641 uasm_i_ehb(&p);
1642 } else {
1643 uasm_i_jr(&p, 31);
1634 uasm_i_nop(&p); 1644 uasm_i_nop(&p);
1645 }
1635#endif 1646#endif
1636 if (p >= (u32 *)tlbmiss_handler_setup_pgd_end) 1647 if (p >= (u32 *)tlbmiss_handler_setup_pgd_end)
1637 panic("tlbmiss_handler_setup_pgd space exceeded"); 1648 panic("tlbmiss_handler_setup_pgd space exceeded");