* [PATCH] MIPS: R3000: Fix debug output for Virtual page number
@ 2014-09-09 16:00 Isamu Mogi
2014-09-29 0:53 ` Maciej W. Rozycki
2014-10-30 13:07 ` [PATCH v2 0/3] " Isamu Mogi
0 siblings, 2 replies; 7+ messages in thread
From: Isamu Mogi @ 2014-09-09 16:00 UTC (permalink / raw)
To: ralf; +Cc: linux-mips, linux-kernel, Isamu Mogi
Virtual page number of R3000 in entryhi is 20 bit from MSB. But in
dump_tlb(), the bit mask to read it from entryhi is 19 bit (0xffffe000).
The patch fixes that to 0xfffff000.
Signed-off-by: Isamu Mogi <isamu@leafytree.jp>
---
arch/mips/lib/r3k_dump_tlb.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/mips/lib/r3k_dump_tlb.c b/arch/mips/lib/r3k_dump_tlb.c
index 91615c2..1ef365a 100644
--- a/arch/mips/lib/r3k_dump_tlb.c
+++ b/arch/mips/lib/r3k_dump_tlb.c
@@ -34,7 +34,7 @@ static void dump_tlb(int first, int last)
entrylo0 = read_c0_entrylo0();
/* Unused entries have a virtual address of KSEG0. */
- if ((entryhi & 0xffffe000) != 0x80000000
+ if ((entryhi & 0xfffff000) != 0x80000000
&& (entryhi & 0xfc0) == asid) {
/*
* Only print entries in use
@@ -43,7 +43,7 @@ static void dump_tlb(int first, int last)
printk("va=%08lx asid=%08lx"
" [pa=%06lx n=%d d=%d v=%d g=%d]",
- (entryhi & 0xffffe000),
+ (entryhi & 0xfffff000),
entryhi & 0xfc0,
entrylo0 & PAGE_MASK,
(entrylo0 & (1 << 11)) ? 1 : 0,
--
1.8.4.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] MIPS: R3000: Fix debug output for Virtual page number
2014-09-09 16:00 [PATCH] MIPS: R3000: Fix debug output for Virtual page number Isamu Mogi
@ 2014-09-29 0:53 ` Maciej W. Rozycki
2014-10-30 13:07 ` [PATCH v2 0/3] " Isamu Mogi
1 sibling, 0 replies; 7+ messages in thread
From: Maciej W. Rozycki @ 2014-09-29 0:53 UTC (permalink / raw)
To: Isamu Mogi; +Cc: Ralf Baechle, linux-mips, linux-kernel
On Wed, 10 Sep 2014, Isamu Mogi wrote:
> Virtual page number of R3000 in entryhi is 20 bit from MSB. But in
> dump_tlb(), the bit mask to read it from entryhi is 19 bit (0xffffe000).
> The patch fixes that to 0xfffff000.
>
> Signed-off-by: Isamu Mogi <isamu@leafytree.jp>
Acked-by: Maciej W. Rozycki <macro@linux-mips.org>
It would be good to add appropriate macros to <asm/mipsregs.h> too, to
avoid magic numbers and decrease the likelihood of issues like this. As a
separate change, that is, of course, and not a prerequisite.
Maciej
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 0/3] MIPS: R3000: Fix debug output for Virtual page number
2014-09-09 16:00 [PATCH] MIPS: R3000: Fix debug output for Virtual page number Isamu Mogi
2014-09-29 0:53 ` Maciej W. Rozycki
@ 2014-10-30 13:07 ` Isamu Mogi
2014-10-30 13:07 ` [PATCH v2 1/3] " Isamu Mogi
` (2 more replies)
1 sibling, 3 replies; 7+ messages in thread
From: Isamu Mogi @ 2014-10-30 13:07 UTC (permalink / raw)
To: ralf; +Cc: linux-mips, linux-kernel, isamu
This patch set fixes the bit mask for MIPS R3000's virtual page number in
debug output. Also replace magic numbers with macros to decrease the
likelihood of issues like this.
Changes in v2:
- Replace magic numbers with macros
- Remove redundant parentheses
Isamu Mogi (3):
MIPS: R3000: Fix debug output for Virtual page number
MIPS: R3000: Replace magic numbers with macros
MIPS: R3000: Remove redundant parentheses
arch/mips/lib/r3k_dump_tlb.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
--
1.9.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 1/3] MIPS: R3000: Fix debug output for Virtual page number
2014-10-30 13:07 ` [PATCH v2 0/3] " Isamu Mogi
@ 2014-10-30 13:07 ` Isamu Mogi
2014-10-30 16:10 ` Ralf Baechle
2014-10-30 13:07 ` [PATCH v2 2/3] MIPS: R3000: Replace magic numbers with macros Isamu Mogi
2014-10-30 13:07 ` [PATCH v2 3/3] MIPS: R3000: Remove redundant parentheses Isamu Mogi
2 siblings, 1 reply; 7+ messages in thread
From: Isamu Mogi @ 2014-10-30 13:07 UTC (permalink / raw)
To: ralf; +Cc: linux-mips, linux-kernel, isamu
Virtual page number of R3000 in entryhi is 20 bit from MSB. But in
dump_tlb(), the bit mask to read it from entryhi is 19 bit (0xffffe000).
The patch fixes that to 0xfffff000.
Signed-off-by: Isamu Mogi <isamu@leafytree.jp>
---
arch/mips/lib/r3k_dump_tlb.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/mips/lib/r3k_dump_tlb.c b/arch/mips/lib/r3k_dump_tlb.c
index 91615c2..1ef365a 100644
--- a/arch/mips/lib/r3k_dump_tlb.c
+++ b/arch/mips/lib/r3k_dump_tlb.c
@@ -34,7 +34,7 @@ static void dump_tlb(int first, int last)
entrylo0 = read_c0_entrylo0();
/* Unused entries have a virtual address of KSEG0. */
- if ((entryhi & 0xffffe000) != 0x80000000
+ if ((entryhi & 0xfffff000) != 0x80000000
&& (entryhi & 0xfc0) == asid) {
/*
* Only print entries in use
@@ -43,7 +43,7 @@ static void dump_tlb(int first, int last)
printk("va=%08lx asid=%08lx"
" [pa=%06lx n=%d d=%d v=%d g=%d]",
- (entryhi & 0xffffe000),
+ (entryhi & 0xfffff000),
entryhi & 0xfc0,
entrylo0 & PAGE_MASK,
(entrylo0 & (1 << 11)) ? 1 : 0,
--
1.9.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 2/3] MIPS: R3000: Replace magic numbers with macros
2014-10-30 13:07 ` [PATCH v2 0/3] " Isamu Mogi
2014-10-30 13:07 ` [PATCH v2 1/3] " Isamu Mogi
@ 2014-10-30 13:07 ` Isamu Mogi
2014-10-30 13:07 ` [PATCH v2 3/3] MIPS: R3000: Remove redundant parentheses Isamu Mogi
2 siblings, 0 replies; 7+ messages in thread
From: Isamu Mogi @ 2014-10-30 13:07 UTC (permalink / raw)
To: ralf; +Cc: linux-mips, linux-kernel, isamu
Also include asm/mmu_context.h for ASID_MASK.
Signed-off-by: Isamu Mogi <isamu@leafytree.jp>
---
arch/mips/lib/r3k_dump_tlb.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/arch/mips/lib/r3k_dump_tlb.c b/arch/mips/lib/r3k_dump_tlb.c
index 1ef365a..c97bb70 100644
--- a/arch/mips/lib/r3k_dump_tlb.c
+++ b/arch/mips/lib/r3k_dump_tlb.c
@@ -9,6 +9,7 @@
#include <linux/mm.h>
#include <asm/mipsregs.h>
+#include <asm/mmu_context.h>
#include <asm/page.h>
#include <asm/pgtable.h>
#include <asm/tlbdebug.h>
@@ -21,7 +22,7 @@ static void dump_tlb(int first, int last)
unsigned int asid;
unsigned long entryhi, entrylo0;
- asid = read_c0_entryhi() & 0xfc0;
+ asid = read_c0_entryhi() & ASID_MASK;
for (i = first; i <= last; i++) {
write_c0_index(i<<8);
@@ -34,8 +35,8 @@ static void dump_tlb(int first, int last)
entrylo0 = read_c0_entrylo0();
/* Unused entries have a virtual address of KSEG0. */
- if ((entryhi & 0xfffff000) != 0x80000000
- && (entryhi & 0xfc0) == asid) {
+ if ((entryhi & PAGE_MASK) != KSEG0
+ && (entryhi & ASID_MASK) == asid) {
/*
* Only print entries in use
*/
@@ -43,8 +44,8 @@ static void dump_tlb(int first, int last)
printk("va=%08lx asid=%08lx"
" [pa=%06lx n=%d d=%d v=%d g=%d]",
- (entryhi & 0xfffff000),
- entryhi & 0xfc0,
+ (entryhi & PAGE_MASK),
+ entryhi & ASID_MASK,
entrylo0 & PAGE_MASK,
(entrylo0 & (1 << 11)) ? 1 : 0,
(entrylo0 & (1 << 10)) ? 1 : 0,
--
1.9.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 3/3] MIPS: R3000: Remove redundant parentheses
2014-10-30 13:07 ` [PATCH v2 0/3] " Isamu Mogi
2014-10-30 13:07 ` [PATCH v2 1/3] " Isamu Mogi
2014-10-30 13:07 ` [PATCH v2 2/3] MIPS: R3000: Replace magic numbers with macros Isamu Mogi
@ 2014-10-30 13:07 ` Isamu Mogi
2 siblings, 0 replies; 7+ messages in thread
From: Isamu Mogi @ 2014-10-30 13:07 UTC (permalink / raw)
To: ralf; +Cc: linux-mips, linux-kernel, isamu
Signed-off-by: Isamu Mogi <isamu@leafytree.jp>
---
arch/mips/lib/r3k_dump_tlb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/mips/lib/r3k_dump_tlb.c b/arch/mips/lib/r3k_dump_tlb.c
index c97bb70..975a138 100644
--- a/arch/mips/lib/r3k_dump_tlb.c
+++ b/arch/mips/lib/r3k_dump_tlb.c
@@ -44,7 +44,7 @@ static void dump_tlb(int first, int last)
printk("va=%08lx asid=%08lx"
" [pa=%06lx n=%d d=%d v=%d g=%d]",
- (entryhi & PAGE_MASK),
+ entryhi & PAGE_MASK,
entryhi & ASID_MASK,
entrylo0 & PAGE_MASK,
(entrylo0 & (1 << 11)) ? 1 : 0,
--
1.9.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2 1/3] MIPS: R3000: Fix debug output for Virtual page number
2014-10-30 13:07 ` [PATCH v2 1/3] " Isamu Mogi
@ 2014-10-30 16:10 ` Ralf Baechle
0 siblings, 0 replies; 7+ messages in thread
From: Ralf Baechle @ 2014-10-30 16:10 UTC (permalink / raw)
To: Isamu Mogi; +Cc: linux-mips, linux-kernel
On Thu, Oct 30, 2014 at 10:07:36PM +0900, Isamu Mogi wrote:
> Virtual page number of R3000 in entryhi is 20 bit from MSB. But in
> dump_tlb(), the bit mask to read it from entryhi is 19 bit (0xffffe000).
> The patch fixes that to 0xfffff000.
Looks like a cut and paste issue from the R4000 code.
Will apply,
Ralf
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-10-30 16:10 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-09 16:00 [PATCH] MIPS: R3000: Fix debug output for Virtual page number Isamu Mogi
2014-09-29 0:53 ` Maciej W. Rozycki
2014-10-30 13:07 ` [PATCH v2 0/3] " Isamu Mogi
2014-10-30 13:07 ` [PATCH v2 1/3] " Isamu Mogi
2014-10-30 16:10 ` Ralf Baechle
2014-10-30 13:07 ` [PATCH v2 2/3] MIPS: R3000: Replace magic numbers with macros Isamu Mogi
2014-10-30 13:07 ` [PATCH v2 3/3] MIPS: R3000: Remove redundant parentheses Isamu Mogi
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.