Re: [PATCH] powerpc/mm: dump block address translation on book3s/32

2018-12-04 Thread Michael Ellerman
Christophe LEROY  writes:

> Le 16/11/2018 à 11:20, Michael Ellerman a écrit :
>> Christophe LEROY  writes:
>> 
>>> Le 15/11/2018 à 12:46, Michael Ellerman a écrit :
 Christophe Leroy  writes:

> This patch adds a debugfs file to dump block address translation:
>
> ~# cat /sys/kernel/debug/block_address_translation

 My instinct is it should be in /sys/kernel/debug/powerpc. But I guess
 the other page table dump files are not.
>>>
>>> Lol.
>>>
>>> Looks like we have the same instinct ...
>>>
>>> But you rejected my patch https://patchwork.ozlabs.org/patch/750426/ :)
>> 
>> Haha. My argument was that the kernel page table dump is not powerpc
>> specific, but this file *is* powerpc specific. Though I guess it's in
>> the same are as the page table / hash table dump, so it may as well live
>> next to them.
>
> I see you took the first version in next-test. It doesn't handle the 
> case of 64bits phys addresses. v3 does.
>
> I just sent v4 which does to v3 the changes you did (__init and powerpc/ 
> subdir)

Thanks.

cheers


Re: [PATCH] powerpc/mm: dump block address translation on book3s/32

2018-12-04 Thread Michael Ellerman
Christophe LEROY  writes:

> Le 16/11/2018 à 11:20, Michael Ellerman a écrit :
>> Christophe LEROY  writes:
>> 
>>> Le 15/11/2018 à 12:46, Michael Ellerman a écrit :
 Christophe Leroy  writes:

> This patch adds a debugfs file to dump block address translation:
>
> ~# cat /sys/kernel/debug/block_address_translation

 My instinct is it should be in /sys/kernel/debug/powerpc. But I guess
 the other page table dump files are not.
>>>
>>> Lol.
>>>
>>> Looks like we have the same instinct ...
>>>
>>> But you rejected my patch https://patchwork.ozlabs.org/patch/750426/ :)
>> 
>> Haha. My argument was that the kernel page table dump is not powerpc
>> specific, but this file *is* powerpc specific. Though I guess it's in
>> the same are as the page table / hash table dump, so it may as well live
>> next to them.
>
> I see you took the first version in next-test. It doesn't handle the 
> case of 64bits phys addresses. v3 does.
>
> I just sent v4 which does to v3 the changes you did (__init and powerpc/ 
> subdir)

Thanks, have picked up v4.

cheers


Re: [PATCH] powerpc/mm: dump block address translation on book3s/32

2018-12-03 Thread Christophe LEROY




Le 16/11/2018 à 11:20, Michael Ellerman a écrit :

Christophe LEROY  writes:


Le 15/11/2018 à 12:46, Michael Ellerman a écrit :

Christophe Leroy  writes:


This patch adds a debugfs file to dump block address translation:

~# cat /sys/kernel/debug/block_address_translation


My instinct is it should be in /sys/kernel/debug/powerpc. But I guess
the other page table dump files are not.


Lol.

Looks like we have the same instinct ...

But you rejected my patch https://patchwork.ozlabs.org/patch/750426/ :)


Haha. My argument was that the kernel page table dump is not powerpc
specific, but this file *is* powerpc specific. Though I guess it's in
the same are as the page table / hash table dump, so it may as well live
next to them.


I see you took the first version in next-test. It doesn't handle the 
case of 64bits phys addresses. v3 does.


I just sent v4 which does to v3 the changes you did (__init and powerpc/ 
subdir)


Christophe




diff --git a/arch/powerpc/mm/Makefile b/arch/powerpc/mm/Makefile
index ca96e7be4d0e..2adad10b5856 100644
--- a/arch/powerpc/mm/Makefile
+++ b/arch/powerpc/mm/Makefile
@@ -47,7 +47,7 @@ ifdef CONFIG_PPC_PTDUMP
   obj-$(CONFIG_4xx)+= dump_linuxpagetables-generic.o
   obj-$(CONFIG_PPC_8xx)+= dump_linuxpagetables-8xx.o
   obj-$(CONFIG_PPC_BOOK3E_MMU) += dump_linuxpagetables-generic.o
-obj-$(CONFIG_PPC_BOOK3S_32)+= dump_linuxpagetables-generic.o
+obj-$(CONFIG_PPC_BOOK3S_32)+= dump_linuxpagetables-generic.o dump_bats.o


BOOK3S_32 covers quite a lot of CPUs.

But below the only check is that you're on 601 or 603.

So is the 603 code going to work on all other BOOK3S_32 CPUs?


If I understand function setbat() correctly, it should.

See
https://elixir.bootlin.com/linux/v4.20-rc1/source/arch/powerpc/mm/ppc_mmu_32.c#L115
Tell me if you see something I missed.


I don't know those 32-bit CPUs at all, so as long as you've thought
about it that's good enough for me. We can catch bugs in testing anyway.

cheers



Re: [PATCH] powerpc/mm: dump block address translation on book3s/32

2018-11-16 Thread Michael Ellerman
Christophe LEROY  writes:

> Le 15/11/2018 à 12:46, Michael Ellerman a écrit :
>> Christophe Leroy  writes:
>> 
>>> This patch adds a debugfs file to dump block address translation:
>>>
>>> ~# cat /sys/kernel/debug/block_address_translation
>> 
>> My instinct is it should be in /sys/kernel/debug/powerpc. But I guess
>> the other page table dump files are not.
>
> Lol.
>
> Looks like we have the same instinct ...
>
> But you rejected my patch https://patchwork.ozlabs.org/patch/750426/ :)

Haha. My argument was that the kernel page table dump is not powerpc
specific, but this file *is* powerpc specific. Though I guess it's in
the same are as the page table / hash table dump, so it may as well live
next to them.

>>> diff --git a/arch/powerpc/mm/Makefile b/arch/powerpc/mm/Makefile
>>> index ca96e7be4d0e..2adad10b5856 100644
>>> --- a/arch/powerpc/mm/Makefile
>>> +++ b/arch/powerpc/mm/Makefile
>>> @@ -47,7 +47,7 @@ ifdef CONFIG_PPC_PTDUMP
>>>   obj-$(CONFIG_4xx) += dump_linuxpagetables-generic.o
>>>   obj-$(CONFIG_PPC_8xx) += dump_linuxpagetables-8xx.o
>>>   obj-$(CONFIG_PPC_BOOK3E_MMU)  += dump_linuxpagetables-generic.o
>>> -obj-$(CONFIG_PPC_BOOK3S_32)+= dump_linuxpagetables-generic.o
>>> +obj-$(CONFIG_PPC_BOOK3S_32)+= dump_linuxpagetables-generic.o 
>>> dump_bats.o
>> 
>> BOOK3S_32 covers quite a lot of CPUs.
>> 
>> But below the only check is that you're on 601 or 603.
>> 
>> So is the 603 code going to work on all other BOOK3S_32 CPUs?
>
> If I understand function setbat() correctly, it should.
>
> See 
> https://elixir.bootlin.com/linux/v4.20-rc1/source/arch/powerpc/mm/ppc_mmu_32.c#L115
>  
> Tell me if you see something I missed.

I don't know those 32-bit CPUs at all, so as long as you've thought
about it that's good enough for me. We can catch bugs in testing anyway.

cheers


Re: [PATCH] powerpc/mm: dump block address translation on book3s/32

2018-11-15 Thread Christophe LEROY




Le 15/11/2018 à 12:46, Michael Ellerman a écrit :

Christophe Leroy  writes:


This patch adds a debugfs file to dump block address translation:

~# cat /sys/kernel/debug/block_address_translation


My instinct is it should be in /sys/kernel/debug/powerpc. But I guess
the other page table dump files are not.


Lol.

Looks like we have the same instinct ...

But you rejected my patch https://patchwork.ozlabs.org/patch/750426/ :)





Instruction Block Address Translations:
0: -
1: -
2: 0xc000-0xcfff 0x Kernel EXEC coherent
3: 0xd000-0xdfff 0x1000 Kernel EXEC coherent
4: -
5: -
6: -
7: -

Data Block Address Translations:
0: -
1: -
2: 0xc000-0xcfff 0x Kernel RW coherent
3: 0xd000-0xdfff 0x1000 Kernel RW coherent
4: -
5: -
6: -
7: -

Signed-off-by: Christophe Leroy 
---
  Tested on mpc8321 aka 603
  Please review/test the 601 part

  arch/powerpc/mm/Makefile|   2 +-
  arch/powerpc/mm/dump_bats.c | 176 
  2 files changed, 177 insertions(+), 1 deletion(-)
  create mode 100644 arch/powerpc/mm/dump_bats.c

diff --git a/arch/powerpc/mm/Makefile b/arch/powerpc/mm/Makefile
index ca96e7be4d0e..2adad10b5856 100644
--- a/arch/powerpc/mm/Makefile
+++ b/arch/powerpc/mm/Makefile
@@ -47,7 +47,7 @@ ifdef CONFIG_PPC_PTDUMP
  obj-$(CONFIG_4xx) += dump_linuxpagetables-generic.o
  obj-$(CONFIG_PPC_8xx) += dump_linuxpagetables-8xx.o
  obj-$(CONFIG_PPC_BOOK3E_MMU)  += dump_linuxpagetables-generic.o
-obj-$(CONFIG_PPC_BOOK3S_32)+= dump_linuxpagetables-generic.o
+obj-$(CONFIG_PPC_BOOK3S_32)+= dump_linuxpagetables-generic.o dump_bats.o


BOOK3S_32 covers quite a lot of CPUs.

But below the only check is that you're on 601 or 603.

So is the 603 code going to work on all other BOOK3S_32 CPUs?


If I understand function setbat() correctly, it should.

See 
https://elixir.bootlin.com/linux/v4.20-rc1/source/arch/powerpc/mm/ppc_mmu_32.c#L115 
Tell me if you see something I missed.


Christophe



cheers


diff --git a/arch/powerpc/mm/dump_bats.c b/arch/powerpc/mm/dump_bats.c
new file mode 100644
index ..824a94ee9051
--- /dev/null
+++ b/arch/powerpc/mm/dump_bats.c
@@ -0,0 +1,176 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2018, Christophe Leroy CS S.I.
+ * 
+ *
+ * This dumps the content of BATS
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+static char *pp_601(int k, int pp)
+{
+   if (pp == 0)
+   return k ? "NA" : "RWX";
+   if (pp == 1)
+   return k ? "ROX" : "RWX";
+   if (pp == 2)
+   return k ? "RWX" : "RWX";
+   return k ? "ROX" : "ROX";
+}
+
+static void bat_show_601(struct seq_file *m, int idx, u32 lower, u32 upper)
+{
+   u32 blpi = upper & 0xfffe;
+   u32 k = (upper >> 2) & 3;
+   u32 pp = upper & 3;
+   u32 pbn = lower & 0xfffe;
+   u32 bsm = lower & 0x3ff;
+   u32 size = (bsm + 1) << 17;
+
+   seq_printf(m, "%d: ", idx);
+   if (!(lower & 0x40)) {
+   seq_puts(m, "-\n");
+   return;
+   }
+
+   seq_printf(m, "0x%08x-0x%08x ", blpi, blpi + size - 1);
+   seq_printf(m, "0x%08x ", pbn);
+
+   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, "\n");
+}
+
+#define BAT_SHOW_601(_m, _n, _l, _u) bat_show_601(_m, _n, mfspr(_l), mfspr(_u))
+
+static int bats_show_601(struct seq_file *m, void *v)
+{
+   seq_puts(m, "Block Address Translation:\n");
+
+   BAT_SHOW_601(m, 0, SPRN_IBAT0L, SPRN_IBAT0U);
+   BAT_SHOW_601(m, 1, SPRN_IBAT1L, SPRN_IBAT1U);
+   BAT_SHOW_601(m, 2, SPRN_IBAT2L, SPRN_IBAT2U);
+   BAT_SHOW_601(m, 3, SPRN_IBAT3L, SPRN_IBAT3U);
+
+   return 0;
+}
+
+static void bat_show_603(struct seq_file *m, int idx, u32 lower, u32 upper, 
bool is_d)
+{
+   u32 bepi = upper & 0xfffe;
+   u32 bl = (upper >> 2) & 0x7ff;
+   u32 k = upper & 3;
+   u32 brpn = lower & 0xfffe;
+   u32 size = (bl + 1) << 17;
+
+   seq_printf(m, "%d: ", idx);
+   if (k == 0) {
+   seq_puts(m, "-\n");
+   return;
+   }
+
+   seq_printf(m, "0x%08x-0x%08x ", bepi, bepi + size - 1);
+   seq_printf(m, "0x%08x ", brpn);
+
+   if (k == 1)
+   seq_puts(m, "User ");
+   else if (k == 2)
+   seq_puts(m, "Kernel ");
+   else
+   seq_puts(m, "Kernel/User ");
+
+   if (lower & BPP_RX)
+   seq_puts(m, is_d ? "RO " : "EXEC ");
+  

Re: [PATCH] powerpc/mm: dump block address translation on book3s/32

2018-11-15 Thread Michael Ellerman
Christophe Leroy  writes:

> This patch adds a debugfs file to dump block address translation:
>
> ~# cat /sys/kernel/debug/block_address_translation

My instinct is it should be in /sys/kernel/debug/powerpc. But I guess
the other page table dump files are not.

> Instruction Block Address Translations:
> 0: -
> 1: -
> 2: 0xc000-0xcfff 0x Kernel EXEC coherent
> 3: 0xd000-0xdfff 0x1000 Kernel EXEC coherent
> 4: -
> 5: -
> 6: -
> 7: -
>
> Data Block Address Translations:
> 0: -
> 1: -
> 2: 0xc000-0xcfff 0x Kernel RW coherent
> 3: 0xd000-0xdfff 0x1000 Kernel RW coherent
> 4: -
> 5: -
> 6: -
> 7: -
>
> Signed-off-by: Christophe Leroy 
> ---
>  Tested on mpc8321 aka 603
>  Please review/test the 601 part
>
>  arch/powerpc/mm/Makefile|   2 +-
>  arch/powerpc/mm/dump_bats.c | 176 
> 
>  2 files changed, 177 insertions(+), 1 deletion(-)
>  create mode 100644 arch/powerpc/mm/dump_bats.c
>
> diff --git a/arch/powerpc/mm/Makefile b/arch/powerpc/mm/Makefile
> index ca96e7be4d0e..2adad10b5856 100644
> --- a/arch/powerpc/mm/Makefile
> +++ b/arch/powerpc/mm/Makefile
> @@ -47,7 +47,7 @@ ifdef CONFIG_PPC_PTDUMP
>  obj-$(CONFIG_4xx)+= dump_linuxpagetables-generic.o
>  obj-$(CONFIG_PPC_8xx)+= dump_linuxpagetables-8xx.o
>  obj-$(CONFIG_PPC_BOOK3E_MMU) += dump_linuxpagetables-generic.o
> -obj-$(CONFIG_PPC_BOOK3S_32)  += dump_linuxpagetables-generic.o
> +obj-$(CONFIG_PPC_BOOK3S_32)  += dump_linuxpagetables-generic.o dump_bats.o

BOOK3S_32 covers quite a lot of CPUs.

But below the only check is that you're on 601 or 603.

So is the 603 code going to work on all other BOOK3S_32 CPUs?

cheers

> diff --git a/arch/powerpc/mm/dump_bats.c b/arch/powerpc/mm/dump_bats.c
> new file mode 100644
> index ..824a94ee9051
> --- /dev/null
> +++ b/arch/powerpc/mm/dump_bats.c
> @@ -0,0 +1,176 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * Copyright 2018, Christophe Leroy CS S.I.
> + * 
> + *
> + * This dumps the content of BATS
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +
> +static char *pp_601(int k, int pp)
> +{
> + if (pp == 0)
> + return k ? "NA" : "RWX";
> + if (pp == 1)
> + return k ? "ROX" : "RWX";
> + if (pp == 2)
> + return k ? "RWX" : "RWX";
> + return k ? "ROX" : "ROX";
> +}
> +
> +static void bat_show_601(struct seq_file *m, int idx, u32 lower, u32 upper)
> +{
> + u32 blpi = upper & 0xfffe;
> + u32 k = (upper >> 2) & 3;
> + u32 pp = upper & 3;
> + u32 pbn = lower & 0xfffe;
> + u32 bsm = lower & 0x3ff;
> + u32 size = (bsm + 1) << 17;
> +
> + seq_printf(m, "%d: ", idx);
> + if (!(lower & 0x40)) {
> + seq_puts(m, "-\n");
> + return;
> + }
> +
> + seq_printf(m, "0x%08x-0x%08x ", blpi, blpi + size - 1);
> + seq_printf(m, "0x%08x ", pbn);
> +
> + 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, "\n");
> +}
> +
> +#define BAT_SHOW_601(_m, _n, _l, _u) bat_show_601(_m, _n, mfspr(_l), 
> mfspr(_u))
> +
> +static int bats_show_601(struct seq_file *m, void *v)
> +{
> + seq_puts(m, "Block Address Translation:\n");
> +
> + BAT_SHOW_601(m, 0, SPRN_IBAT0L, SPRN_IBAT0U);
> + BAT_SHOW_601(m, 1, SPRN_IBAT1L, SPRN_IBAT1U);
> + BAT_SHOW_601(m, 2, SPRN_IBAT2L, SPRN_IBAT2U);
> + BAT_SHOW_601(m, 3, SPRN_IBAT3L, SPRN_IBAT3U);
> +
> + return 0;
> +}
> +
> +static void bat_show_603(struct seq_file *m, int idx, u32 lower, u32 upper, 
> bool is_d)
> +{
> + u32 bepi = upper & 0xfffe;
> + u32 bl = (upper >> 2) & 0x7ff;
> + u32 k = upper & 3;
> + u32 brpn = lower & 0xfffe;
> + u32 size = (bl + 1) << 17;
> +
> + seq_printf(m, "%d: ", idx);
> + if (k == 0) {
> + seq_puts(m, "-\n");
> + return;
> + }
> +
> + seq_printf(m, "0x%08x-0x%08x ", bepi, bepi + size - 1);
> + seq_printf(m, "0x%08x ", brpn);
> +
> + if (k == 1)
> + seq_puts(m, "User ");
> + else if (k == 2)
> + seq_puts(m, "Kernel ");
> + else
> + seq_puts(m, "Kernel/User ");
> +
> + if (lower & BPP_RX)
> + seq_puts(m, is_d ? "RO " : "EXEC ");
> + else if (lower & BPP_RW)
> + seq_puts(m, is_d ? "RW " : "EXEC ");
> + else
> + seq_puts(m, is_d ? "NA " : "NX   ");
> +
> + if (lower & _PAGE_WRITETHRU)
> +  

[PATCH] powerpc/mm: dump block address translation on book3s/32

2018-11-14 Thread Christophe Leroy
This patch adds a debugfs file to dump block address translation:

~# cat /sys/kernel/debug/block_address_translation
Instruction Block Address Translations:
0: -
1: -
2: 0xc000-0xcfff 0x Kernel EXEC coherent
3: 0xd000-0xdfff 0x1000 Kernel EXEC coherent
4: -
5: -
6: -
7: -

Data Block Address Translations:
0: -
1: -
2: 0xc000-0xcfff 0x Kernel RW coherent
3: 0xd000-0xdfff 0x1000 Kernel RW coherent
4: -
5: -
6: -
7: -

Signed-off-by: Christophe Leroy 
---
 Tested on mpc8321 aka 603
 Please review/test the 601 part

 arch/powerpc/mm/Makefile|   2 +-
 arch/powerpc/mm/dump_bats.c | 176 
 2 files changed, 177 insertions(+), 1 deletion(-)
 create mode 100644 arch/powerpc/mm/dump_bats.c

diff --git a/arch/powerpc/mm/Makefile b/arch/powerpc/mm/Makefile
index ca96e7be4d0e..2adad10b5856 100644
--- a/arch/powerpc/mm/Makefile
+++ b/arch/powerpc/mm/Makefile
@@ -47,7 +47,7 @@ ifdef CONFIG_PPC_PTDUMP
 obj-$(CONFIG_4xx)  += dump_linuxpagetables-generic.o
 obj-$(CONFIG_PPC_8xx)  += dump_linuxpagetables-8xx.o
 obj-$(CONFIG_PPC_BOOK3E_MMU)   += dump_linuxpagetables-generic.o
-obj-$(CONFIG_PPC_BOOK3S_32)+= dump_linuxpagetables-generic.o
+obj-$(CONFIG_PPC_BOOK3S_32)+= dump_linuxpagetables-generic.o dump_bats.o
 obj-$(CONFIG_PPC_BOOK3S_64)+= dump_linuxpagetables-book3s64.o
 endif
 obj-$(CONFIG_PPC_HTDUMP)   += dump_hashpagetable.o
diff --git a/arch/powerpc/mm/dump_bats.c b/arch/powerpc/mm/dump_bats.c
new file mode 100644
index ..824a94ee9051
--- /dev/null
+++ b/arch/powerpc/mm/dump_bats.c
@@ -0,0 +1,176 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2018, Christophe Leroy CS S.I.
+ * 
+ *
+ * This dumps the content of BATS
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+static char *pp_601(int k, int pp)
+{
+   if (pp == 0)
+   return k ? "NA" : "RWX";
+   if (pp == 1)
+   return k ? "ROX" : "RWX";
+   if (pp == 2)
+   return k ? "RWX" : "RWX";
+   return k ? "ROX" : "ROX";
+}
+
+static void bat_show_601(struct seq_file *m, int idx, u32 lower, u32 upper)
+{
+   u32 blpi = upper & 0xfffe;
+   u32 k = (upper >> 2) & 3;
+   u32 pp = upper & 3;
+   u32 pbn = lower & 0xfffe;
+   u32 bsm = lower & 0x3ff;
+   u32 size = (bsm + 1) << 17;
+
+   seq_printf(m, "%d: ", idx);
+   if (!(lower & 0x40)) {
+   seq_puts(m, "-\n");
+   return;
+   }
+
+   seq_printf(m, "0x%08x-0x%08x ", blpi, blpi + size - 1);
+   seq_printf(m, "0x%08x ", pbn);
+
+   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, "\n");
+}
+
+#define BAT_SHOW_601(_m, _n, _l, _u) bat_show_601(_m, _n, mfspr(_l), mfspr(_u))
+
+static int bats_show_601(struct seq_file *m, void *v)
+{
+   seq_puts(m, "Block Address Translation:\n");
+
+   BAT_SHOW_601(m, 0, SPRN_IBAT0L, SPRN_IBAT0U);
+   BAT_SHOW_601(m, 1, SPRN_IBAT1L, SPRN_IBAT1U);
+   BAT_SHOW_601(m, 2, SPRN_IBAT2L, SPRN_IBAT2U);
+   BAT_SHOW_601(m, 3, SPRN_IBAT3L, SPRN_IBAT3U);
+
+   return 0;
+}
+
+static void bat_show_603(struct seq_file *m, int idx, u32 lower, u32 upper, 
bool is_d)
+{
+   u32 bepi = upper & 0xfffe;
+   u32 bl = (upper >> 2) & 0x7ff;
+   u32 k = upper & 3;
+   u32 brpn = lower & 0xfffe;
+   u32 size = (bl + 1) << 17;
+
+   seq_printf(m, "%d: ", idx);
+   if (k == 0) {
+   seq_puts(m, "-\n");
+   return;
+   }
+
+   seq_printf(m, "0x%08x-0x%08x ", bepi, bepi + size - 1);
+   seq_printf(m, "0x%08x ", brpn);
+
+   if (k == 1)
+   seq_puts(m, "User ");
+   else if (k == 2)
+   seq_puts(m, "Kernel ");
+   else
+   seq_puts(m, "Kernel/User ");
+
+   if (lower & BPP_RX)
+   seq_puts(m, is_d ? "RO " : "EXEC ");
+   else if (lower & BPP_RW)
+   seq_puts(m, is_d ? "RW " : "EXEC ");
+   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, "\n");
+}
+
+#define BAT_SHOW_603(_m, _n, _l, _u, _d) bat_show_603(_m, _n,