Commit c2bc435e authored by James Hogan's avatar James Hogan Committed by Ralf Baechle

MIPS: dump_tlb: Take RI/XI bits into account

The RI/XI bits when present are above the PFN field in the EntryLo
registers, at bits 63,62 when read with dmfc0, and bits 31,30 when read
with mfc0. This makes them appear as part of the physical address, since
the other bits are masked with PAGE_MASK, for example:

Index: 253 pgmask=16kb va=77b18000 asid=75
        [pa=1000744000 c=5 d=1 v=1 g=0] [pa=100134c000 c=5 d=1 v=1 g=0]

The physical addresses have bit 36 set, which corresponds to bit 30 of
EntryLo1, the XI bit.

Explicitly mask off the RI and XI bits from the printed physical
address, and print the RI and XI bits separately if they exist, giving
output more like this:

Index: 226 pgmask=16kb va=77be0000 asid=79
        [ri=0 xi=1 pa=01288000 c=5 d=1 v=1 g=0] [ri=0 xi=0 pa=010e4000 c=5 d=0 v=1 g=0]

Cc: linux-mips@linux-mips.org
Cc: James Hogan <james.hogan@imgtec.com>
Cc: David Daney <ddaney@caviumnetworks.com>
Patchwork: https://patchwork.linux-mips.org/patch/10080/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent decebccd
...@@ -44,7 +44,7 @@ static inline const char *msk2str(unsigned int mask) ...@@ -44,7 +44,7 @@ static inline const char *msk2str(unsigned int mask)
static void dump_tlb(int first, int last) static void dump_tlb(int first, int last)
{ {
unsigned long s_entryhi, entryhi, asid; unsigned long s_entryhi, entryhi, asid;
unsigned long long entrylo0, entrylo1; unsigned long long entrylo0, entrylo1, pa;
unsigned int s_index, s_pagemask, pagemask, c0, c1, i; unsigned int s_index, s_pagemask, pagemask, c0, c1, i;
#ifdef CONFIG_32BIT #ifdef CONFIG_32BIT
int width = 8; int width = 8;
...@@ -98,15 +98,28 @@ static void dump_tlb(int first, int last) ...@@ -98,15 +98,28 @@ static void dump_tlb(int first, int last)
printk("va=%0*lx asid=%02lx\n", printk("va=%0*lx asid=%02lx\n",
width, (entryhi & ~0x1fffUL), width, (entryhi & ~0x1fffUL),
entryhi & 0xff); entryhi & 0xff);
printk("\t[pa=%0*llx c=%d d=%d v=%d g=%d] ", /* RI/XI are in awkward places, so mask them off separately */
width, pa = entrylo0 & ~(MIPS_ENTRYLO_RI | MIPS_ENTRYLO_XI);
(entrylo0 << 6) & PAGE_MASK, c0, pa = (pa << 6) & PAGE_MASK;
printk("\t[");
if (cpu_has_rixi)
printk("ri=%d xi=%d ",
(entrylo0 & MIPS_ENTRYLO_RI) ? 1 : 0,
(entrylo0 & MIPS_ENTRYLO_XI) ? 1 : 0);
printk("pa=%0*llx c=%d d=%d v=%d g=%d] [",
width, pa, c0,
(entrylo0 & MIPS_ENTRYLO_D) ? 1 : 0, (entrylo0 & MIPS_ENTRYLO_D) ? 1 : 0,
(entrylo0 & MIPS_ENTRYLO_V) ? 1 : 0, (entrylo0 & MIPS_ENTRYLO_V) ? 1 : 0,
(entrylo0 & MIPS_ENTRYLO_G) ? 1 : 0); (entrylo0 & MIPS_ENTRYLO_G) ? 1 : 0);
printk("[pa=%0*llx c=%d d=%d v=%d g=%d]\n", /* RI/XI are in awkward places, so mask them off separately */
width, pa = entrylo1 & ~(MIPS_ENTRYLO_RI | MIPS_ENTRYLO_XI);
(entrylo1 << 6) & PAGE_MASK, c1, pa = (pa << 6) & PAGE_MASK;
if (cpu_has_rixi)
printk("ri=%d xi=%d ",
(entrylo1 & MIPS_ENTRYLO_RI) ? 1 : 0,
(entrylo1 & MIPS_ENTRYLO_XI) ? 1 : 0);
printk("pa=%0*llx c=%d d=%d v=%d g=%d]\n",
width, pa, c1,
(entrylo1 & MIPS_ENTRYLO_D) ? 1 : 0, (entrylo1 & MIPS_ENTRYLO_D) ? 1 : 0,
(entrylo1 & MIPS_ENTRYLO_V) ? 1 : 0, (entrylo1 & MIPS_ENTRYLO_V) ? 1 : 0,
(entrylo1 & MIPS_ENTRYLO_G) ? 1 : 0); (entrylo1 & MIPS_ENTRYLO_G) ? 1 : 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment