linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc: align memory_limit to 16MB in early_parse_mem
@ 2024-03-01 20:30 Joel Savitz
  2024-03-01 23:23 ` Michael Ellerman
  2024-03-08 10:18 ` Aneesh Kumar K.V
  0 siblings, 2 replies; 11+ messages in thread
From: Joel Savitz @ 2024-03-01 20:30 UTC (permalink / raw)
  To: linux-kernel
  Cc: Joel Savitz, Michael Ellerman, Nicholas Piggin, Christophe Leroy,
	Aneesh Kumar K.V, Naveen N. Rao, Benjamin Gray, Paul Mackerras,
	linuxppc-dev, Gonzalo Siero

On 64-bit powerpc, usage of a non-16MB-aligned value for the mem= kernel
cmdline parameter results in a system hang at boot.

For example, using 'mem=4198400K' will always reproduce this issue.

This patch fixes the problem by aligning any argument to mem= to 16MB
corresponding with the large page size on powerpc.

Fixes: 2babf5c2ec2f ("[PATCH] powerpc: Unify mem= handling")
Co-developed-by: Gonzalo Siero <gsierohu@redhat.com>
Signed-off-by: Gonzalo Siero <gsierohu@redhat.com>
Signed-off-by: Joel Savitz <jsavitz@redhat.com>
---
 arch/powerpc/kernel/prom.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 0b5878c3125b..8cd3e2445d8a 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -82,8 +82,12 @@ static int __init early_parse_mem(char *p)
 {
 	if (!p)
 		return 1;
-
+#ifdef CONFIG_PPC64
+	/* Align to 16 MB == size of ppc64 large page */
+	memory_limit = ALIGN(memparse(p, &p), 0x1000000);
+#else
 	memory_limit = PAGE_ALIGN(memparse(p, &p));
+#endif
 	DBG("memory limit = 0x%llx\n", memory_limit);
 
 	return 0;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2024-04-10 16:53 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-01 20:30 [PATCH] powerpc: align memory_limit to 16MB in early_parse_mem Joel Savitz
2024-03-01 23:23 ` Michael Ellerman
2024-03-02 23:59   ` Joel Savitz
2024-03-08  9:30     ` Michael Ellerman
2024-03-04  6:58   ` Aneesh Kumar K.V
2024-03-08 10:18 ` Aneesh Kumar K.V
2024-03-26  4:45   ` Joel Savitz
2024-04-01 14:17     ` Joel Savitz
2024-04-10 15:22       ` Joel Savitz
2024-04-10 15:31         ` Christophe Leroy
2024-04-10 16:52           ` Joel Savitz

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).