]> git.karo-electronics.de Git - karo-tx-linux.git/commit
MIPS: Mask out limit field when calculating wired entry count
authorPaul Burton <paul.burton@imgtec.com>
Sat, 12 Nov 2016 01:26:07 +0000 (01:26 +0000)
committerRalf Baechle <ralf@linux-mips.org>
Thu, 24 Nov 2016 15:44:16 +0000 (16:44 +0100)
commit1031398035a25e5c90c66befb6ff41fa4746df98
tree656c7fb80b4078a25691d349a95df3496482265b
parent9c763584b7c8911106bb77af7e648bef09af9d80
MIPS: Mask out limit field when calculating wired entry count

Since MIPSr6 the Wired register is split into 2 fields, with the upper
16 bits of the register indicating a limit on the value that the wired
entry count in the bottom 16 bits of the register can take. This means
that simply reading the wired register doesn't get us a valid TLB entry
index any longer, and we instead need to retrieve only the lower 16 bits
of the register. Introduce a new num_wired_entries() function which does
this on MIPSr6 or higher and simply returns the value of the wired
register on older architecture revisions, and make use of it when
reading the number of wired entries.

Since commit e710d6668309 ("MIPS: tlb-r4k: If there are wired entries,
don't use TLBINVF") we have been using a non-zero number of wired
entries to determine whether we should avoid use of the tlbinvf
instruction (which would invalidate wired entries) and instead loop over
TLB entries in local_flush_tlb_all(). This loop begins with the number
of wired entries, or before this patch some large bogus TLB index on
MIPSr6 systems. Thus since the aforementioned commit some MIPSr6 systems
with FTLBs have been prone to leaving stale address translations in the
FTLB & crashing in various weird & wonderful ways when we later observe
the wrong memory.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Matt Redfearn <matt.redfearn@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/14557/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/include/asm/mipsregs.h
arch/mips/include/asm/tlb.h
arch/mips/mm/init.c
arch/mips/mm/tlb-r4k.c