public inbox for linux-riscv@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] riscv: Don't use hugepage mappings for vmemmap if it's not supported
@ 2024-05-08 17:31 Nam Cao
  2024-05-08 18:22 ` Alexandre Ghiti
  0 siblings, 1 reply; 5+ messages in thread
From: Nam Cao @ 2024-05-08 17:31 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
	linux-riscv, linux-kernel

Commit ff172d4818ad ("riscv: Use hugepage mappings for vmemmap") broke XIP
kernel, because huge pages are not supported on XIP kernel.

Only use hugepage mapping if it is supported.

Fixes: ff172d4818ad ("riscv: Use hugepage mappings for vmemmap")
Signed-off-by: Nam Cao <namcao@linutronix.de>
Cc: Alexandre Ghiti <alexghiti@rivosinc.com>
Cc: <stable@vger.kernel.org>
---
 arch/riscv/mm/init.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
index 968761843203..c081e7d349b1 100644
--- a/arch/riscv/mm/init.c
+++ b/arch/riscv/mm/init.c
@@ -1414,6 +1414,8 @@ int __meminit vmemmap_check_pmd(pmd_t *pmdp, int node,
 int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node,
 			       struct vmem_altmap *altmap)
 {
+	if (!IS_ENABLED(CONFIG_HAVE_ARCH_HUGE_VMAP))
+		return vmemmap_populate_basepages(start, end, node, NULL);
 	/*
 	 * Note that SPARSEMEM_VMEMMAP is only selected for rv64 and that we
 	 * can't use hugepage mappings for 2-level page table because in case of
-- 
2.39.2


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

end of thread, other threads:[~2024-05-24 20:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-08 17:31 [PATCH] riscv: Don't use hugepage mappings for vmemmap if it's not supported Nam Cao
2024-05-08 18:22 ` Alexandre Ghiti
2024-05-08 18:46   ` Nam Cao
2024-05-24 20:07     ` Alexandre Ghiti
2024-05-24 20:51       ` Nam Cao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox