Skip to content

Commit

Permalink
powerpc/64s: Fix boot failure with 4K Radix
Browse files Browse the repository at this point in the history
When using the Radix MMU our PGD is always 64K, and must be naturally
aligned.

For a 4K page size kernel that means page alignment of swapper_pg_dir is
not sufficient, leading to failure to boot.

Use the existing MAX_PTRS_PER_PGD which has the correct value, and
avoids us hard-coding 64K here.

Fixes: e72421a ("powerpc: Define swapper_pg_dir[] in C")
Reported-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20210624123420.2784187-1-mpe@ellerman.id.au
  • Loading branch information
Michael Ellerman committed Jun 24, 2021
1 parent a736143 commit 3018fbc
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion arch/powerpc/mm/pgtable.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,13 @@
#include <asm/hugetlb.h>
#include <asm/pte-walk.h>

pgd_t swapper_pg_dir[MAX_PTRS_PER_PGD] __page_aligned_bss;
#ifdef CONFIG_PPC64
#define PGD_ALIGN (sizeof(pgd_t) * MAX_PTRS_PER_PGD)
#else
#define PGD_ALIGN PAGE_SIZE
#endif

pgd_t swapper_pg_dir[MAX_PTRS_PER_PGD] __section(".bss..page_aligned") __aligned(PGD_ALIGN);

static inline int is_exec_fault(void)
{
Expand Down

0 comments on commit 3018fbc

Please sign in to comment.