Commit 287deb22 authored by Michael Ellerman's avatar Michael Ellerman Committed by Greg Kroah-Hartman

powerpc/mm: Fix page table dump to work on Radix

[ Upstream commit 0d923962 ]

When we're running on Book3S with the Radix MMU enabled the page table
dump currently prints the wrong addresses because it uses the wrong
start address.

Fix it to use PAGE_OFFSET rather than KERN_VIRT_START.
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 63880b2f
...@@ -418,12 +418,13 @@ static void walk_pagetables(struct pg_state *st) ...@@ -418,12 +418,13 @@ static void walk_pagetables(struct pg_state *st)
unsigned int i; unsigned int i;
unsigned long addr; unsigned long addr;
addr = st->start_address;
/* /*
* Traverse the linux pagetable structure and dump pages that are in * Traverse the linux pagetable structure and dump pages that are in
* the hash pagetable. * the hash pagetable.
*/ */
for (i = 0; i < PTRS_PER_PGD; i++, pgd++) { for (i = 0; i < PTRS_PER_PGD; i++, pgd++, addr += PGDIR_SIZE) {
addr = KERN_VIRT_START + i * PGDIR_SIZE;
if (!pgd_none(*pgd) && !pgd_huge(*pgd)) if (!pgd_none(*pgd) && !pgd_huge(*pgd))
/* pgd exists */ /* pgd exists */
walk_pud(st, pgd, addr); walk_pud(st, pgd, addr);
...@@ -472,9 +473,14 @@ static int ptdump_show(struct seq_file *m, void *v) ...@@ -472,9 +473,14 @@ static int ptdump_show(struct seq_file *m, void *v)
{ {
struct pg_state st = { struct pg_state st = {
.seq = m, .seq = m,
.start_address = KERN_VIRT_START,
.marker = address_markers, .marker = address_markers,
}; };
if (radix_enabled())
st.start_address = PAGE_OFFSET;
else
st.start_address = KERN_VIRT_START;
/* Traverse kernel page tables */ /* Traverse kernel page tables */
walk_pagetables(&st); walk_pagetables(&st);
note_page(&st, 0, 0, 0); note_page(&st, 0, 0, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment