Skip to content

Commit 8ba1a8b

Browse files
Kefeng Wangpalmer-dabbelt
authored andcommitted
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 <[email protected]> Signed-off-by: Kefeng Wang <[email protected]> Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent fb31f0a commit 8ba1a8b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

arch/riscv/mm/init.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <linux/set_memory.h>
2020
#include <linux/dma-map-ops.h>
2121
#include <linux/crash_dump.h>
22+
#include <linux/hugetlb.h>
2223

2324
#include <asm/fixmap.h>
2425
#include <asm/tlbflush.h>
@@ -202,6 +203,8 @@ static void __init setup_bootmem(void)
202203

203204
early_init_fdt_scan_reserved_mem();
204205
dma_contiguous_reserve(dma32_phys_limit);
206+
if (IS_ENABLED(CONFIG_64BIT))
207+
hugetlb_cma_reserve(PUD_SHIFT - PAGE_SHIFT);
205208
memblock_allow_resize();
206209
}
207210

0 commit comments

Comments
 (0)