summaryrefslogtreecommitdiff
path: root/arch/riscv
diff options
context:
space:
mode:
authorKefeng Wang <wangkefeng.wang@huawei.com>2021-07-30 20:48:41 +0800
committerPalmer Dabbelt <palmerdabbelt@google.com>2021-08-13 21:33:54 -0700
commit8ba1a8b77ba1eb3aef441ed2caf28ab2b1261f5f (patch)
tree5a6d9c34e704f2af9542ad72f0292b2ded901859 /arch/riscv
parentfb31f0a499332a053477ed57312b214e42476e6d (diff)
riscv: Support allocating gigantic hugepages using CMA
This patch adds support to allocate gigantic hugepages using CMA by specifying the hugetlb_cma= kernel parameter. This is only supported on RV64. Reviewed-by: Alexandre Ghiti <alex@ghiti.fr> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com> Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
Diffstat (limited to 'arch/riscv')
-rw-r--r--arch/riscv/mm/init.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
index 888dff9530b8..248f9ec393c1 100644
--- a/arch/riscv/mm/init.c
+++ b/arch/riscv/mm/init.c
@@ -19,6 +19,7 @@
#include <linux/set_memory.h>
#include <linux/dma-map-ops.h>
#include <linux/crash_dump.h>
+#include <linux/hugetlb.h>
#include <asm/fixmap.h>
#include <asm/tlbflush.h>
@@ -202,6 +203,8 @@ static void __init setup_bootmem(void)
early_init_fdt_scan_reserved_mem();
dma_contiguous_reserve(dma32_phys_limit);
+ if (IS_ENABLED(CONFIG_64BIT))
+ hugetlb_cma_reserve(PUD_SHIFT - PAGE_SHIFT);
memblock_allow_resize();
}