* [PATCH] powerpc/64s: Fix boot failure with 4K Radix
@ 2021-06-24 12:34 Michael Ellerman
2021-06-25 6:21 ` Michael Ellerman
0 siblings, 1 reply; 2+ messages in thread
From: Michael Ellerman @ 2021-06-24 12:34 UTC (permalink / raw)
To: linuxppc-dev; +Cc: dja
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: e72421a085a8 ("powerpc: Define swapper_pg_dir[] in C")
Reported-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
arch/powerpc/mm/pgtable.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/mm/pgtable.c b/arch/powerpc/mm/pgtable.c
index 1707ab580ee2..cd16b407f47e 100644
--- a/arch/powerpc/mm/pgtable.c
+++ b/arch/powerpc/mm/pgtable.c
@@ -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)
{
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] powerpc/64s: Fix boot failure with 4K Radix
2021-06-24 12:34 [PATCH] powerpc/64s: Fix boot failure with 4K Radix Michael Ellerman
@ 2021-06-25 6:21 ` Michael Ellerman
0 siblings, 0 replies; 2+ messages in thread
From: Michael Ellerman @ 2021-06-25 6:21 UTC (permalink / raw)
To: linuxppc-dev, Michael Ellerman; +Cc: dja
On Thu, 24 Jun 2021 22:34:20 +1000, Michael Ellerman wrote:
> 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.
Applied to powerpc/next.
[1/1] powerpc/64s: Fix boot failure with 4K Radix
https://git.kernel.org/powerpc/c/3018fbc63632e6d30abde228f29aaeaf78b782bf
cheers
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-06-25 6:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-24 12:34 [PATCH] powerpc/64s: Fix boot failure with 4K Radix Michael Ellerman
2021-06-25 6:21 ` Michael Ellerman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).