From: James Hogan Date: Tue, 19 May 2015 08:50:35 +0000 (+0100) Subject: MIPS: dump_tlb: Take global bit into account X-Git-Tag: v4.2-rc1~78^2~116 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=48269c78fb04a84b4d190cac8e1fbf24ded53505;p=karo-tx-linux.git MIPS: dump_tlb: Take global bit into account The TLB only matches the ASID when the global bit isn't set, so dump_tlb() shouldn't really be skipping global entries just because the ASID doesn't match. Fix the condition to read the TLB entry's global bit from EntryLo0. Note that after a TLB read the global bits in both EntryLo registers reflect the same global bit in the TLB entry. Signed-off-by: James Hogan Cc: Maciej W. Rozycki Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/10079/ Signed-off-by: Ralf Baechle --- diff --git a/arch/mips/lib/dump_tlb.c b/arch/mips/lib/dump_tlb.c index f02cc554d720..995c393e3342 100644 --- a/arch/mips/lib/dump_tlb.c +++ b/arch/mips/lib/dump_tlb.c @@ -73,7 +73,15 @@ static void dump_tlb(int first, int last) */ if ((entryhi & ~0x1ffffUL) == CKSEG0) continue; - if ((entryhi & 0xff) != asid) + /* + * ASID takes effect in absence of G (global) bit. + * We check both G bits, even though architecturally they should + * match one another, because some revisions of the SB1 core may + * leave only a single G bit set after a machine check exception + * due to duplicate TLB entry. + */ + if (!((entrylo0 | entrylo1) & MIPS_ENTRYLO_G) && + (entryhi & 0xff) != asid) continue; /* diff --git a/arch/mips/lib/r3k_dump_tlb.c b/arch/mips/lib/r3k_dump_tlb.c index e210f04b2bc3..1335e4394e33 100644 --- a/arch/mips/lib/r3k_dump_tlb.c +++ b/arch/mips/lib/r3k_dump_tlb.c @@ -35,8 +35,9 @@ static void dump_tlb(int first, int last) entrylo0 = read_c0_entrylo0(); /* Unused entries have a virtual address of KSEG0. */ - if ((entryhi & PAGE_MASK) != KSEG0 - && (entryhi & ASID_MASK) == asid) { + if ((entryhi & PAGE_MASK) != KSEG0 && + (entrylo0 & R3K_ENTRYLO_G || + (entryhi & ASID_MASK) == asid)) { /* * Only print entries in use */