Commit 98648161 authored by Christophe Leroy's avatar Christophe Leroy Committed by Michael Ellerman

powerpc/book3e: Fix PUD allocation size in map_kernel_page()

Commit 2fb47060 ("powerpc: add support for folded p4d page tables")
erroneously changed PUD setup to a mix of PMD and PUD. Fix it.

While at it, use PTE_TABLE_SIZE instead of PAGE_SIZE for PTE tables
in order to avoid any confusion.

Fixes: 2fb47060 ("powerpc: add support for folded p4d page tables")
Cc: stable@vger.kernel.org # v5.8+
Signed-off-by: default avatarChristophe Leroy <christophe.leroy@csgroup.eu>
Acked-by: default avatarMike Rapoport <rppt@linux.ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/95ddfd6176d53e6c85e13bd1c358359daa56775f.1655974558.git.christophe.leroy@csgroup.eu
parent 19fc5bb9
...@@ -96,8 +96,8 @@ int __ref map_kernel_page(unsigned long ea, unsigned long pa, pgprot_t prot) ...@@ -96,8 +96,8 @@ int __ref map_kernel_page(unsigned long ea, unsigned long pa, pgprot_t prot)
pgdp = pgd_offset_k(ea); pgdp = pgd_offset_k(ea);
p4dp = p4d_offset(pgdp, ea); p4dp = p4d_offset(pgdp, ea);
if (p4d_none(*p4dp)) { if (p4d_none(*p4dp)) {
pmdp = early_alloc_pgtable(PMD_TABLE_SIZE); pudp = early_alloc_pgtable(PUD_TABLE_SIZE);
p4d_populate(&init_mm, p4dp, pmdp); p4d_populate(&init_mm, p4dp, pudp);
} }
pudp = pud_offset(p4dp, ea); pudp = pud_offset(p4dp, ea);
if (pud_none(*pudp)) { if (pud_none(*pudp)) {
...@@ -106,7 +106,7 @@ int __ref map_kernel_page(unsigned long ea, unsigned long pa, pgprot_t prot) ...@@ -106,7 +106,7 @@ int __ref map_kernel_page(unsigned long ea, unsigned long pa, pgprot_t prot)
} }
pmdp = pmd_offset(pudp, ea); pmdp = pmd_offset(pudp, ea);
if (!pmd_present(*pmdp)) { if (!pmd_present(*pmdp)) {
ptep = early_alloc_pgtable(PAGE_SIZE); ptep = early_alloc_pgtable(PTE_TABLE_SIZE);
pmd_populate_kernel(&init_mm, pmdp, ptep); pmd_populate_kernel(&init_mm, pmdp, ptep);
} }
ptep = pte_offset_kernel(pmdp, ea); ptep = pte_offset_kernel(pmdp, ea);
......
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