Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wirel...
[pandora-kernel.git] / arch / mn10300 / mm / mmu-context.c
index 36ba021..a4f7d3d 100644 (file)
 #include <asm/mmu_context.h>
 #include <asm/tlbflush.h>
 
+#ifdef CONFIG_MN10300_TLB_USE_PIDR
 /*
  * list of the MMU contexts last allocated on each CPU
  */
 unsigned long mmu_context_cache[NR_CPUS] = {
-       [0 ... NR_CPUS - 1] = MMU_CONTEXT_FIRST_VERSION * 2 - 1,
+       [0 ... NR_CPUS - 1] =
+       MMU_CONTEXT_FIRST_VERSION * 2 - (1 - MMU_CONTEXT_TLBPID_LOCK_NR),
 };
-
-/*
- * flush the specified TLB entry
- */
-void flush_tlb_page(struct vm_area_struct *vma, unsigned long addr)
-{
-       unsigned long pteu, cnx, flags;
-
-       addr &= PAGE_MASK;
-
-       /* make sure the context doesn't migrate and defend against
-        * interference from vmalloc'd regions */
-       local_irq_save(flags);
-
-       cnx = mm_context(vma->vm_mm);
-
-       if (cnx != MMU_NO_CONTEXT) {
-               pteu = addr | (cnx & 0x000000ffUL);
-               IPTEU = pteu;
-               DPTEU = pteu;
-               if (IPTEL & xPTEL_V)
-                       IPTEL = 0;
-               if (DPTEL & xPTEL_V)
-                       DPTEL = 0;
-       }
-
-       local_irq_restore(flags);
-}
+#endif /* CONFIG_MN10300_TLB_USE_PIDR */
 
 /*
  * preemptively set a TLB entry
@@ -63,10 +38,16 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long addr, pte_t *pte
         * interference from vmalloc'd regions */
        local_irq_save(flags);
 
+       cnx = ~MMU_NO_CONTEXT;
+#ifdef CONFIG_MN10300_TLB_USE_PIDR
        cnx = mm_context(vma->vm_mm);
+#endif
 
        if (cnx != MMU_NO_CONTEXT) {
-               pteu = addr | (cnx & 0x000000ffUL);
+               pteu = addr;
+#ifdef CONFIG_MN10300_TLB_USE_PIDR
+               pteu |= cnx & MMU_CONTEXT_TLBPID_MASK;
+#endif
                if (!(pte_val(pte) & _PAGE_NX)) {
                        IPTEU = pteu;
                        if (IPTEL & xPTEL_V)