]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
nios2: flush_tlb_all use TLBMISC way auto-increment feature
authorNicholas Piggin <npiggin@gmail.com>
Wed, 7 Nov 2018 02:21:02 +0000 (10:21 +0800)
committerLey Foon Tan <ley.foon.tan@intel.com>
Wed, 6 Mar 2019 21:29:35 +0000 (05:29 +0800)
Writes to TLBACC cause TLBMISC way to be incremented, which can be
used to iterate over ways in a set, then wrap back to zero ready for
the next set. This reduces register writes significantly.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
arch/nios2/mm/tlb.c

index 58c16d35f501f2d3b594e9ee6d77990536a741c2..2469f88ef7f3e7f8583bbf259d98ee932857f9c3 100644 (file)
@@ -242,21 +242,20 @@ void flush_tlb_all(void)
        unsigned long addr = 0;
        unsigned int line;
        unsigned int way;
-       unsigned long org_misc, pid_misc, tlbmisc;
+       unsigned long org_misc, pid_misc;
 
        /* remember pid/way until we return */
        get_misc_and_pid(&org_misc, &pid_misc);
 
+       /* Start at way 0, way is auto-incremented after each TLBACC write */
+       WRCTL(CTL_TLBMISC, TLBMISC_WE);
+
        /* Map each TLB entry to physcal address 0 with no-access and a
           bad ptbase */
        for (line = 0; line < cpuinfo.tlb_num_lines; line++) {
                WRCTL(CTL_PTEADDR, pteaddr_invalid(addr));
-
-               for (way = 0; way < cpuinfo.tlb_num_ways; way++) {
-                       tlbmisc = TLBMISC_WE | (way << TLBMISC_WAY_SHIFT);
-                       WRCTL(CTL_TLBMISC, tlbmisc);
+               for (way = 0; way < cpuinfo.tlb_num_ways; way++)
                        WRCTL(CTL_TLBACC, 0);
-               }
 
                addr += PAGE_SIZE;
        }