* [PATCH] riscv: mm: Move dma_contiguous_reserve() after NUMA initialization
@ 2026-07-14 18:56 Eder Zulian
2026-07-21 23:00 ` Paul Walmsley
2026-07-21 23:50 ` patchwork-bot+linux-riscv
0 siblings, 2 replies; 3+ messages in thread
From: Eder Zulian @ 2026-07-14 18:56 UTC (permalink / raw)
To: pjw, palmer, aou, alex, linux-riscv, linux-kernel; +Cc: Eder Zulian
Move the dma_contiguous_reserve() call from setup_bootmem() to
misc_mem_init(), placing it after arch_numa_init(). This ensures that
NUMA topology is initialized when reserving contiguous memory for DMA.
Tested with CMA_SIZE_PERNUMA enabled and two NUMA nodes on QEMU:
qemu-system-riscv64 \
-machine virt \
-nographic \
-smp 2 -m 512M \
-numa node,nodeid=0,cpus=0,memdev=m0 \
-numa node,nodeid=1,cpus=1,memdev=m1 \
-object memory-backend-ram,id=m0,size=256M \
-object memory-backend-ram,id=m1,size=256M \
-kernel arch/riscv/boot/Image \
-append "console=ttyS0 earlycon loglevel=7 cma=16M"
Unpatched kernel's log (one global CMA pool and no per-nodepools, 16 MiB
cma-reserved):
[ 0.000000] cma: Reserved 16 MiB at 0x000000009ee00000
...
[ 0.000000] Initmem setup node 0 [mem 0x0000000080000000-0x000000008fffffff]
[ 0.000000] Initmem setup node 1 [mem 0x0000000090000000-0x000000009fffffff]
...
[ 0.056397] smp: Brought up 2 nodes, 2 CPUs
[ 0.066135] Memory: 449288K/524288K available (12279K kernel code, 5980K rwdata, 6144K rodata, 2467K init, 482K bss, 54504K reserved, 16384K cma-reserved)
Patched kernel's log (three CMA pools are created, 48 MiB total),
[ 0.000000] cma: Reserved 16 MiB at 0x000000009ee00000
[ 0.000000] cma: Reserved 16 MiB at 0x000000008ee00000
[ 0.000000] cma: Reserved 16 MiB at 0x000000009de00000
...
[ 0.054251] smp: Brought up 2 nodes, 2 CPUs
[ 0.064082] Memory: 416520K/524288K available (12279K kernel code, 5980K rwdata, 6144K rodata, 2467K init, 482K bss, 54504K reserved, 49152K cma-reserved)
Signed-off-by: Eder Zulian <ezulian@redhat.com>
---
arch/riscv/mm/init.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
index 85bdcce63a3e..79a658ebe74d 100644
--- a/arch/riscv/mm/init.c
+++ b/arch/riscv/mm/init.c
@@ -295,8 +295,6 @@ static void __init setup_bootmem(void)
*/
if (!IS_ENABLED(CONFIG_BUILTIN_DTB))
memblock_reserve(dtb_early_pa, fdt_totalsize(dtb_early_va));
-
- dma_contiguous_reserve(dma32_phys_limit);
}
#ifdef CONFIG_RELOCATABLE
@@ -1349,6 +1347,7 @@ void __init misc_mem_init(void)
{
early_memtest(min_low_pfn << PAGE_SHIFT, max_low_pfn << PAGE_SHIFT);
arch_numa_init();
+ dma_contiguous_reserve(dma32_phys_limit);
#ifdef CONFIG_SPARSEMEM_VMEMMAP
/* The entire VMEMMAP region has been populated. Flush TLB for this region */
local_flush_tlb_kernel_range(VMEMMAP_START, VMEMMAP_END);
--
2.55.0
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] riscv: mm: Move dma_contiguous_reserve() after NUMA initialization
2026-07-14 18:56 [PATCH] riscv: mm: Move dma_contiguous_reserve() after NUMA initialization Eder Zulian
@ 2026-07-21 23:00 ` Paul Walmsley
2026-07-21 23:50 ` patchwork-bot+linux-riscv
1 sibling, 0 replies; 3+ messages in thread
From: Paul Walmsley @ 2026-07-21 23:00 UTC (permalink / raw)
To: Eder Zulian; +Cc: pjw, palmer, aou, alex, linux-riscv, linux-kernel
Hi,
On Tue, 14 Jul 2026, Eder Zulian wrote:
> Move the dma_contiguous_reserve() call from setup_bootmem() to
> misc_mem_init(), placing it after arch_numa_init(). This ensures that
> NUMA topology is initialized when reserving contiguous memory for DMA.
>
> Tested with CMA_SIZE_PERNUMA enabled and two NUMA nodes on QEMU:
>
> qemu-system-riscv64 \
> -machine virt \
> -nographic \
> -smp 2 -m 512M \
> -numa node,nodeid=0,cpus=0,memdev=m0 \
> -numa node,nodeid=1,cpus=1,memdev=m1 \
> -object memory-backend-ram,id=m0,size=256M \
> -object memory-backend-ram,id=m1,size=256M \
> -kernel arch/riscv/boot/Image \
> -append "console=ttyS0 earlycon loglevel=7 cma=16M"
>
> Unpatched kernel's log (one global CMA pool and no per-nodepools, 16 MiB
> cma-reserved):
>
> [ 0.000000] cma: Reserved 16 MiB at 0x000000009ee00000
> ...
> [ 0.000000] Initmem setup node 0 [mem 0x0000000080000000-0x000000008fffffff]
> [ 0.000000] Initmem setup node 1 [mem 0x0000000090000000-0x000000009fffffff]
> ...
> [ 0.056397] smp: Brought up 2 nodes, 2 CPUs
> [ 0.066135] Memory: 449288K/524288K available (12279K kernel code, 5980K rwdata, 6144K rodata, 2467K init, 482K bss, 54504K reserved, 16384K cma-reserved)
>
> Patched kernel's log (three CMA pools are created, 48 MiB total),
>
> [ 0.000000] cma: Reserved 16 MiB at 0x000000009ee00000
> [ 0.000000] cma: Reserved 16 MiB at 0x000000008ee00000
> [ 0.000000] cma: Reserved 16 MiB at 0x000000009de00000
> ...
> [ 0.054251] smp: Brought up 2 nodes, 2 CPUs
> [ 0.064082] Memory: 416520K/524288K available (12279K kernel code, 5980K rwdata, 6144K rodata, 2467K init, 482K bss, 54504K reserved, 49152K cma-reserved)
>
> Signed-off-by: Eder Zulian <ezulian@redhat.com>
Thanks, queued for v7.3.
- Paul
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] riscv: mm: Move dma_contiguous_reserve() after NUMA initialization
2026-07-14 18:56 [PATCH] riscv: mm: Move dma_contiguous_reserve() after NUMA initialization Eder Zulian
2026-07-21 23:00 ` Paul Walmsley
@ 2026-07-21 23:50 ` patchwork-bot+linux-riscv
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+linux-riscv @ 2026-07-21 23:50 UTC (permalink / raw)
To: Eder Zulian; +Cc: linux-riscv, pjw, palmer, aou, alex, linux-kernel
Hello:
This patch was applied to riscv/linux.git (for-next)
by Paul Walmsley <pjw@kernel.org>:
On Tue, 14 Jul 2026 20:56:48 +0200 you wrote:
> Move the dma_contiguous_reserve() call from setup_bootmem() to
> misc_mem_init(), placing it after arch_numa_init(). This ensures that
> NUMA topology is initialized when reserving contiguous memory for DMA.
>
> Tested with CMA_SIZE_PERNUMA enabled and two NUMA nodes on QEMU:
>
> qemu-system-riscv64 \
> -machine virt \
> -nographic \
> -smp 2 -m 512M \
> -numa node,nodeid=0,cpus=0,memdev=m0 \
> -numa node,nodeid=1,cpus=1,memdev=m1 \
> -object memory-backend-ram,id=m0,size=256M \
> -object memory-backend-ram,id=m1,size=256M \
> -kernel arch/riscv/boot/Image \
> -append "console=ttyS0 earlycon loglevel=7 cma=16M"
>
> [...]
Here is the summary with links:
- riscv: mm: Move dma_contiguous_reserve() after NUMA initialization
https://git.kernel.org/riscv/c/76e885f2b89d
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-07-21 23:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-14 18:56 [PATCH] riscv: mm: Move dma_contiguous_reserve() after NUMA initialization Eder Zulian
2026-07-21 23:00 ` Paul Walmsley
2026-07-21 23:50 ` patchwork-bot+linux-riscv
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®