aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/lib
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/lib')
-rw-r--r--arch/mips/lib/dump_tlb.c10
-rw-r--r--arch/mips/lib/r3k_dump_tlb.c9
2 files changed, 11 insertions, 8 deletions
diff --git a/arch/mips/lib/dump_tlb.c b/arch/mips/lib/dump_tlb.c
index 92a37319efbe..3283aa7423e4 100644
--- a/arch/mips/lib/dump_tlb.c
+++ b/arch/mips/lib/dump_tlb.c
@@ -73,6 +73,8 @@ static void dump_tlb(int first, int last)
73 unsigned long s_entryhi, entryhi, asid; 73 unsigned long s_entryhi, entryhi, asid;
74 unsigned long long entrylo0, entrylo1, pa; 74 unsigned long long entrylo0, entrylo1, pa;
75 unsigned int s_index, s_pagemask, pagemask, c0, c1, i; 75 unsigned int s_index, s_pagemask, pagemask, c0, c1, i;
76 unsigned long asidmask = cpu_asid_mask(&current_cpu_data);
77 int asidwidth = DIV_ROUND_UP(ilog2(asidmask) + 1, 4);
76#ifdef CONFIG_32BIT 78#ifdef CONFIG_32BIT
77 bool xpa = cpu_has_xpa && (read_c0_pagegrain() & PG_ELPA); 79 bool xpa = cpu_has_xpa && (read_c0_pagegrain() & PG_ELPA);
78 int pwidth = xpa ? 11 : 8; 80 int pwidth = xpa ? 11 : 8;
@@ -86,7 +88,7 @@ static void dump_tlb(int first, int last)
86 s_pagemask = read_c0_pagemask(); 88 s_pagemask = read_c0_pagemask();
87 s_entryhi = read_c0_entryhi(); 89 s_entryhi = read_c0_entryhi();
88 s_index = read_c0_index(); 90 s_index = read_c0_index();
89 asid = s_entryhi & 0xff; 91 asid = s_entryhi & asidmask;
90 92
91 for (i = first; i <= last; i++) { 93 for (i = first; i <= last; i++) {
92 write_c0_index(i); 94 write_c0_index(i);
@@ -115,7 +117,7 @@ static void dump_tlb(int first, int last)
115 * due to duplicate TLB entry. 117 * due to duplicate TLB entry.
116 */ 118 */
117 if (!((entrylo0 | entrylo1) & ENTRYLO_G) && 119 if (!((entrylo0 | entrylo1) & ENTRYLO_G) &&
118 (entryhi & 0xff) != asid) 120 (entryhi & asidmask) != asid)
119 continue; 121 continue;
120 122
121 /* 123 /*
@@ -126,9 +128,9 @@ static void dump_tlb(int first, int last)
126 c0 = (entrylo0 & ENTRYLO_C) >> ENTRYLO_C_SHIFT; 128 c0 = (entrylo0 & ENTRYLO_C) >> ENTRYLO_C_SHIFT;
127 c1 = (entrylo1 & ENTRYLO_C) >> ENTRYLO_C_SHIFT; 129 c1 = (entrylo1 & ENTRYLO_C) >> ENTRYLO_C_SHIFT;
128 130
129 printk("va=%0*lx asid=%02lx\n", 131 printk("va=%0*lx asid=%0*lx\n",
130 vwidth, (entryhi & ~0x1fffUL), 132 vwidth, (entryhi & ~0x1fffUL),
131 entryhi & 0xff); 133 asidwidth, entryhi & asidmask);
132 /* RI/XI are in awkward places, so mask them off separately */ 134 /* RI/XI are in awkward places, so mask them off separately */
133 pa = entrylo0 & ~(MIPS_ENTRYLO_RI | MIPS_ENTRYLO_XI); 135 pa = entrylo0 & ~(MIPS_ENTRYLO_RI | MIPS_ENTRYLO_XI);
134 if (xpa) 136 if (xpa)
diff --git a/arch/mips/lib/r3k_dump_tlb.c b/arch/mips/lib/r3k_dump_tlb.c
index cfcbb5218b59..744f4a7bc49d 100644
--- a/arch/mips/lib/r3k_dump_tlb.c
+++ b/arch/mips/lib/r3k_dump_tlb.c
@@ -29,9 +29,10 @@ static void dump_tlb(int first, int last)
29{ 29{
30 int i; 30 int i;
31 unsigned int asid; 31 unsigned int asid;
32 unsigned long entryhi, entrylo0; 32 unsigned long entryhi, entrylo0, asid_mask;
33 33
34 asid = read_c0_entryhi() & ASID_MASK; 34 asid_mask = cpu_asid_mask(&current_cpu_data);
35 asid = read_c0_entryhi() & asid_mask;
35 36
36 for (i = first; i <= last; i++) { 37 for (i = first; i <= last; i++) {
37 write_c0_index(i<<8); 38 write_c0_index(i<<8);
@@ -46,7 +47,7 @@ static void dump_tlb(int first, int last)
46 /* Unused entries have a virtual address of KSEG0. */ 47 /* Unused entries have a virtual address of KSEG0. */
47 if ((entryhi & PAGE_MASK) != KSEG0 && 48 if ((entryhi & PAGE_MASK) != KSEG0 &&
48 (entrylo0 & R3K_ENTRYLO_G || 49 (entrylo0 & R3K_ENTRYLO_G ||
49 (entryhi & ASID_MASK) == asid)) { 50 (entryhi & asid_mask) == asid)) {
50 /* 51 /*
51 * Only print entries in use 52 * Only print entries in use
52 */ 53 */
@@ -55,7 +56,7 @@ static void dump_tlb(int first, int last)
55 printk("va=%08lx asid=%08lx" 56 printk("va=%08lx asid=%08lx"
56 " [pa=%06lx n=%d d=%d v=%d g=%d]", 57 " [pa=%06lx n=%d d=%d v=%d g=%d]",
57 entryhi & PAGE_MASK, 58 entryhi & PAGE_MASK,
58 entryhi & ASID_MASK, 59 entryhi & asid_mask,
59 entrylo0 & PAGE_MASK, 60 entrylo0 & PAGE_MASK,
60 (entrylo0 & R3K_ENTRYLO_N) ? 1 : 0, 61 (entrylo0 & R3K_ENTRYLO_N) ? 1 : 0,
61 (entrylo0 & R3K_ENTRYLO_D) ? 1 : 0, 62 (entrylo0 & R3K_ENTRYLO_D) ? 1 : 0,