OSDN Git Service

powerpc/ptdump: Standardise display of BAT flags
authorChristophe Leroy <christophe.leroy@csgroup.eu>
Tue, 19 May 2020 05:48:53 +0000 (05:48 +0000)
committerMichael Ellerman <mpe@ellerman.id.au>
Tue, 26 May 2020 12:22:19 +0000 (22:22 +1000)
Display BAT flags the same way as page flags: rwx and wimg

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/a07585f353c167b8db9597d83f992a5cb4fbf4c4.1589866984.git.christophe.leroy@csgroup.eu
arch/powerpc/mm/ptdump/bats.c

index d6c660f..cebb58c 100644 (file)
 static char *pp_601(int k, int pp)
 {
        if (pp == 0)
-               return k ? "NA" : "RWX";
+               return k ? "   " : "rwx";
        if (pp == 1)
-               return k ? "ROX" : "RWX";
+               return k ? "r x" : "rwx";
        if (pp == 2)
-               return k ? "RWX" : "RWX";
-       return k ? "ROX" : "ROX";
+               return "rwx";
+       return "r x";
 }
 
 static void bat_show_601(struct seq_file *m, int idx, u32 lower, u32 upper)
@@ -48,12 +48,9 @@ static void bat_show_601(struct seq_file *m, int idx, u32 lower, u32 upper)
 
        seq_printf(m, "Kernel %s User %s", pp_601(k & 2, pp), pp_601(k & 1, pp));
 
-       if (lower & _PAGE_WRITETHRU)
-               seq_puts(m, "write through ");
-       if (lower & _PAGE_NO_CACHE)
-               seq_puts(m, "no cache ");
-       if (lower & _PAGE_COHERENT)
-               seq_puts(m, "coherent ");
+       seq_puts(m, lower & _PAGE_WRITETHRU ? "w " : "  ");
+       seq_puts(m, lower & _PAGE_NO_CACHE ? "i " : "  ");
+       seq_puts(m, lower & _PAGE_COHERENT ? "m " : "  ");
        seq_puts(m, "\n");
 }
 
@@ -101,20 +98,16 @@ static void bat_show_603(struct seq_file *m, int idx, u32 lower, u32 upper, bool
                seq_puts(m, "Kernel/User ");
 
        if (lower & BPP_RX)
-               seq_puts(m, is_d ? "RO " : "EXEC ");
+               seq_puts(m, is_d ? "r   " : "  x ");
        else if (lower & BPP_RW)
-               seq_puts(m, is_d ? "RW " : "EXEC ");
+               seq_puts(m, is_d ? "rw  " : "  x ");
        else
-               seq_puts(m, is_d ? "NA " : "NX   ");
-
-       if (lower & _PAGE_WRITETHRU)
-               seq_puts(m, "write through ");
-       if (lower & _PAGE_NO_CACHE)
-               seq_puts(m, "no cache ");
-       if (lower & _PAGE_COHERENT)
-               seq_puts(m, "coherent ");
-       if (lower & _PAGE_GUARDED)
-               seq_puts(m, "guarded ");
+               seq_puts(m, is_d ? "    " : "    ");
+
+       seq_puts(m, lower & _PAGE_WRITETHRU ? "w " : "  ");
+       seq_puts(m, lower & _PAGE_NO_CACHE ? "i " : "  ");
+       seq_puts(m, lower & _PAGE_COHERENT ? "m " : "  ");
+       seq_puts(m, lower & _PAGE_GUARDED ? "g " : "  ");
        seq_puts(m, "\n");
 }