]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - arch/mips/mm/tlbex.c
Merge branch 'ralf-3.7' of git://git.linux-mips.org/pub/scm/sjhill/linux-sjhill into...
[mirror_ubuntu-bionic-kernel.git] / arch / mips / mm / tlbex.c
index 1832f17e6be49fc79ab35b8ff70a904a7df111ae..e09d49256908968edf6d3b018edea0f2a857b84d 100644 (file)
@@ -449,8 +449,20 @@ static void __cpuinit build_tlb_write_entry(u32 **p, struct uasm_label **l,
        }
 
        if (cpu_has_mips_r2) {
-               if (cpu_has_mips_r2_exec_hazard)
+               /*
+                * The architecture spec says an ehb is required here,
+                * but a number of cores do not have the hazard and
+                * using an ehb causes an expensive pipeline stall.
+                */
+               switch (current_cpu_type()) {
+               case CPU_M14KC:
+               case CPU_74K:
+                       break;
+
+               default:
                        uasm_i_ehb(p);
+                       break;
+               }
                tlbw(p);
                return;
        }
@@ -921,6 +933,13 @@ build_get_pgde32(u32 **p, unsigned int tmp, unsigned int ptr)
 #endif
        uasm_i_mfc0(p, tmp, C0_BADVADDR); /* get faulting address */
        uasm_i_lw(p, ptr, uasm_rel_lo(pgdc), ptr);
+
+       if (cpu_has_mips_r2) {
+               uasm_i_ext(p, tmp, tmp, PGDIR_SHIFT, (32 - PGDIR_SHIFT));
+               uasm_i_ins(p, ptr, tmp, PGD_T_LOG2, (32 - PGDIR_SHIFT));
+               return;
+       }
+
        uasm_i_srl(p, tmp, tmp, PGDIR_SHIFT); /* get pgd only bits */
        uasm_i_sll(p, tmp, tmp, PGD_T_LOG2);
        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)
 
 static void __cpuinit build_get_ptep(u32 **p, unsigned int tmp, unsigned int ptr)
 {
+       if (cpu_has_mips_r2) {
+               /* PTE ptr offset is obtained from BadVAddr */
+               UASM_i_MFC0(p, tmp, C0_BADVADDR);
+               UASM_i_LW(p, ptr, 0, ptr);
+               uasm_i_ext(p, tmp, tmp, PAGE_SHIFT+1, PGDIR_SHIFT-PAGE_SHIFT-1);
+               uasm_i_ins(p, ptr, tmp, PTE_T_LOG2+1, PGDIR_SHIFT-PAGE_SHIFT-1);
+               return;
+       }
+
        /*
         * Bug workaround for the Nevada. It seems as if under certain
         * circumstances the move from cp0_context might produce a