diff options
author | James Hogan <james.hogan@imgtec.com> | 2015-05-19 04:50:38 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2015-06-21 15:52:39 -0400 |
commit | 24ca1d9896bb9bbd7625e3596bac4ea2fe74c725 (patch) | |
tree | b5497e24dd199ddc244f7a8d2d439112ef056a26 /arch/mips/lib/dump_tlb.c | |
parent | c2bc435e4f2cd5f010063b49f68e5b2cfaccc84e (diff) |
MIPS: dump_tlb: Take XPA into account
XPA extends the physical addresses on MIPS32, including the EntryLo
registers. Update dump_tlb() to concatenate the PFNX field from the high
end of the EntryLo registers (as read by mfhc0).
The width of physical and virtual addresses are also separated to show
only 8 nibbles of virtual but 11 nibbles of physical with XPA.
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Steven J. Hill <Steven.Hill@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/10077/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/lib/dump_tlb.c')
-rw-r--r-- | arch/mips/lib/dump_tlb.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/arch/mips/lib/dump_tlb.c b/arch/mips/lib/dump_tlb.c index 1fefd38aba08..167f35634709 100644 --- a/arch/mips/lib/dump_tlb.c +++ b/arch/mips/lib/dump_tlb.c | |||
@@ -47,9 +47,13 @@ static void dump_tlb(int first, int last) | |||
47 | unsigned long long entrylo0, entrylo1, pa; | 47 | unsigned long long entrylo0, entrylo1, pa; |
48 | unsigned int s_index, s_pagemask, pagemask, c0, c1, i; | 48 | unsigned int s_index, s_pagemask, pagemask, c0, c1, i; |
49 | #ifdef CONFIG_32BIT | 49 | #ifdef CONFIG_32BIT |
50 | int width = 8; | 50 | bool xpa = cpu_has_xpa && (read_c0_pagegrain() & PG_ELPA); |
51 | int pwidth = xpa ? 11 : 8; | ||
52 | int vwidth = 8; | ||
51 | #else | 53 | #else |
52 | int width = 11; | 54 | bool xpa = false; |
55 | int pwidth = 11; | ||
56 | int vwidth = 11; | ||
53 | #endif | 57 | #endif |
54 | 58 | ||
55 | s_pagemask = read_c0_pagemask(); | 59 | s_pagemask = read_c0_pagemask(); |
@@ -96,10 +100,12 @@ static void dump_tlb(int first, int last) | |||
96 | c1 = (entrylo1 & MIPS_ENTRYLO_C) >> MIPS_ENTRYLO_C_SHIFT; | 100 | c1 = (entrylo1 & MIPS_ENTRYLO_C) >> MIPS_ENTRYLO_C_SHIFT; |
97 | 101 | ||
98 | printk("va=%0*lx asid=%02lx\n", | 102 | printk("va=%0*lx asid=%02lx\n", |
99 | width, (entryhi & ~0x1fffUL), | 103 | vwidth, (entryhi & ~0x1fffUL), |
100 | entryhi & 0xff); | 104 | entryhi & 0xff); |
101 | /* RI/XI are in awkward places, so mask them off separately */ | 105 | /* RI/XI are in awkward places, so mask them off separately */ |
102 | pa = entrylo0 & ~(MIPS_ENTRYLO_RI | MIPS_ENTRYLO_XI); | 106 | pa = entrylo0 & ~(MIPS_ENTRYLO_RI | MIPS_ENTRYLO_XI); |
107 | if (xpa) | ||
108 | pa |= (unsigned long long)readx_c0_entrylo0() << 30; | ||
103 | pa = (pa << 6) & PAGE_MASK; | 109 | pa = (pa << 6) & PAGE_MASK; |
104 | printk("\t["); | 110 | printk("\t["); |
105 | if (cpu_has_rixi) | 111 | if (cpu_has_rixi) |
@@ -107,19 +113,21 @@ static void dump_tlb(int first, int last) | |||
107 | (entrylo0 & MIPS_ENTRYLO_RI) ? 1 : 0, | 113 | (entrylo0 & MIPS_ENTRYLO_RI) ? 1 : 0, |
108 | (entrylo0 & MIPS_ENTRYLO_XI) ? 1 : 0); | 114 | (entrylo0 & MIPS_ENTRYLO_XI) ? 1 : 0); |
109 | printk("pa=%0*llx c=%d d=%d v=%d g=%d] [", | 115 | printk("pa=%0*llx c=%d d=%d v=%d g=%d] [", |
110 | width, pa, c0, | 116 | pwidth, pa, c0, |
111 | (entrylo0 & MIPS_ENTRYLO_D) ? 1 : 0, | 117 | (entrylo0 & MIPS_ENTRYLO_D) ? 1 : 0, |
112 | (entrylo0 & MIPS_ENTRYLO_V) ? 1 : 0, | 118 | (entrylo0 & MIPS_ENTRYLO_V) ? 1 : 0, |
113 | (entrylo0 & MIPS_ENTRYLO_G) ? 1 : 0); | 119 | (entrylo0 & MIPS_ENTRYLO_G) ? 1 : 0); |
114 | /* RI/XI are in awkward places, so mask them off separately */ | 120 | /* RI/XI are in awkward places, so mask them off separately */ |
115 | pa = entrylo1 & ~(MIPS_ENTRYLO_RI | MIPS_ENTRYLO_XI); | 121 | pa = entrylo1 & ~(MIPS_ENTRYLO_RI | MIPS_ENTRYLO_XI); |
122 | if (xpa) | ||
123 | pa |= (unsigned long long)readx_c0_entrylo1() << 30; | ||
116 | pa = (pa << 6) & PAGE_MASK; | 124 | pa = (pa << 6) & PAGE_MASK; |
117 | if (cpu_has_rixi) | 125 | if (cpu_has_rixi) |
118 | printk("ri=%d xi=%d ", | 126 | printk("ri=%d xi=%d ", |
119 | (entrylo1 & MIPS_ENTRYLO_RI) ? 1 : 0, | 127 | (entrylo1 & MIPS_ENTRYLO_RI) ? 1 : 0, |
120 | (entrylo1 & MIPS_ENTRYLO_XI) ? 1 : 0); | 128 | (entrylo1 & MIPS_ENTRYLO_XI) ? 1 : 0); |
121 | printk("pa=%0*llx c=%d d=%d v=%d g=%d]\n", | 129 | printk("pa=%0*llx c=%d d=%d v=%d g=%d]\n", |
122 | width, pa, c1, | 130 | pwidth, pa, c1, |
123 | (entrylo1 & MIPS_ENTRYLO_D) ? 1 : 0, | 131 | (entrylo1 & MIPS_ENTRYLO_D) ? 1 : 0, |
124 | (entrylo1 & MIPS_ENTRYLO_V) ? 1 : 0, | 132 | (entrylo1 & MIPS_ENTRYLO_V) ? 1 : 0, |
125 | (entrylo1 & MIPS_ENTRYLO_G) ? 1 : 0); | 133 | (entrylo1 & MIPS_ENTRYLO_G) ? 1 : 0); |