diff options
author | James Hogan <james.hogan@imgtec.com> | 2015-05-19 04:50:33 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2015-06-21 15:52:33 -0400 |
commit | d1ce483e45ba86bc3b59ba46cca9ad044b09051e (patch) | |
tree | ae230618cc91f316dcb89dd319c22c2042248555 /arch/mips/lib/dump_tlb.c | |
parent | 137877e4327075d839f15776cb6865ee171f2175 (diff) |
MIPS: dump_tlb: Refactor TLB matching
Refactor the TLB matching code in dump_tlb() slightly so that the
conditions which can cause a TLB entry to be skipped can be more easily
extended. This should prevent the match condition getting unwieldy once
it is updated to take further conditions into account.
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/10081/
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 | 65 |
1 files changed, 35 insertions, 30 deletions
diff --git a/arch/mips/lib/dump_tlb.c b/arch/mips/lib/dump_tlb.c index a62dfacb60f7..17d05caa776d 100644 --- a/arch/mips/lib/dump_tlb.c +++ b/arch/mips/lib/dump_tlb.c | |||
@@ -46,6 +46,11 @@ static void dump_tlb(int first, int last) | |||
46 | unsigned long s_entryhi, entryhi, asid; | 46 | unsigned long s_entryhi, entryhi, asid; |
47 | unsigned long long entrylo0, entrylo1; | 47 | unsigned long long entrylo0, entrylo1; |
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 | ||
50 | int width = 8; | ||
51 | #else | ||
52 | int width = 11; | ||
53 | #endif | ||
49 | 54 | ||
50 | s_pagemask = read_c0_pagemask(); | 55 | s_pagemask = read_c0_pagemask(); |
51 | s_entryhi = read_c0_entryhi(); | 56 | s_entryhi = read_c0_entryhi(); |
@@ -62,38 +67,38 @@ static void dump_tlb(int first, int last) | |||
62 | entrylo0 = read_c0_entrylo0(); | 67 | entrylo0 = read_c0_entrylo0(); |
63 | entrylo1 = read_c0_entrylo1(); | 68 | entrylo1 = read_c0_entrylo1(); |
64 | 69 | ||
65 | /* Unused entries have a virtual address of CKSEG0. */ | 70 | /* |
66 | if ((entryhi & ~0x1ffffUL) != CKSEG0 | 71 | * Prior to tlbinv, unused entries have a virtual address of |
67 | && (entryhi & 0xff) == asid) { | 72 | * CKSEG0. |
68 | #ifdef CONFIG_32BIT | 73 | */ |
69 | int width = 8; | 74 | if ((entryhi & ~0x1ffffUL) == CKSEG0) |
70 | #else | 75 | continue; |
71 | int width = 11; | 76 | if ((entryhi & 0xff) != asid) |
72 | #endif | 77 | continue; |
73 | /* | 78 | |
74 | * Only print entries in use | 79 | /* |
75 | */ | 80 | * Only print entries in use |
76 | printk("Index: %2d pgmask=%s ", i, msk2str(pagemask)); | 81 | */ |
82 | printk("Index: %2d pgmask=%s ", i, msk2str(pagemask)); | ||
77 | 83 | ||
78 | c0 = (entrylo0 >> 3) & 7; | 84 | c0 = (entrylo0 >> 3) & 7; |
79 | c1 = (entrylo1 >> 3) & 7; | 85 | c1 = (entrylo1 >> 3) & 7; |
80 | 86 | ||
81 | printk("va=%0*lx asid=%02lx\n", | 87 | printk("va=%0*lx asid=%02lx\n", |
82 | width, (entryhi & ~0x1fffUL), | 88 | width, (entryhi & ~0x1fffUL), |
83 | entryhi & 0xff); | 89 | entryhi & 0xff); |
84 | printk("\t[pa=%0*llx c=%d d=%d v=%d g=%d] ", | 90 | printk("\t[pa=%0*llx c=%d d=%d v=%d g=%d] ", |
85 | width, | 91 | width, |
86 | (entrylo0 << 6) & PAGE_MASK, c0, | 92 | (entrylo0 << 6) & PAGE_MASK, c0, |
87 | (entrylo0 & 4) ? 1 : 0, | 93 | (entrylo0 & 4) ? 1 : 0, |
88 | (entrylo0 & 2) ? 1 : 0, | 94 | (entrylo0 & 2) ? 1 : 0, |
89 | (entrylo0 & 1) ? 1 : 0); | 95 | (entrylo0 & 1) ? 1 : 0); |
90 | printk("[pa=%0*llx c=%d d=%d v=%d g=%d]\n", | 96 | printk("[pa=%0*llx c=%d d=%d v=%d g=%d]\n", |
91 | width, | 97 | width, |
92 | (entrylo1 << 6) & PAGE_MASK, c1, | 98 | (entrylo1 << 6) & PAGE_MASK, c1, |
93 | (entrylo1 & 4) ? 1 : 0, | 99 | (entrylo1 & 4) ? 1 : 0, |
94 | (entrylo1 & 2) ? 1 : 0, | 100 | (entrylo1 & 2) ? 1 : 0, |
95 | (entrylo1 & 1) ? 1 : 0); | 101 | (entrylo1 & 1) ? 1 : 0); |
96 | } | ||
97 | } | 102 | } |
98 | printk("\n"); | 103 | printk("\n"); |
99 | 104 | ||