[PATCH v2] dma-pool: don't allocate DMA32 pool if no 32-bit memory

Vladimir Kondratiev vladimir.kondratiev at mobileye.com
Sun Jan 11 22:58:56 PST 2026


If system have no 32-bit memory, GFP_DMA32 pool allocation will
obviously fail, so skip it.

Changes in v2: use arch-independent "memblock_start_of_DRAM" to get
DRAM base address

Signed-off-by: Vladimir Kondratiev <vladimir.kondratiev at mobileye.com>
---
 kernel/dma/pool.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/dma/pool.c b/kernel/dma/pool.c
index ee45dee33d49..ecd77a0272f2 100644
--- a/kernel/dma/pool.c
+++ b/kernel/dma/pool.c
@@ -209,7 +209,7 @@ static int __init dma_atomic_pool_init(void)
 		if (!atomic_pool_dma)
 			ret = -ENOMEM;
 	}
-	if (IS_ENABLED(CONFIG_ZONE_DMA32)) {
+	if (IS_ENABLED(CONFIG_ZONE_DMA32) && memblock_start_of_DRAM() < BIT_ULL(32)) {
 		atomic_pool_dma32 = __dma_atomic_pool_init(atomic_pool_size,
 						GFP_KERNEL | GFP_DMA32);
 		if (!atomic_pool_dma32)

base-commit: 7d0a66e4bb9081d75c82ec4957c50034cb0ea449
-- 
2.43.0




More information about the linux-riscv mailing list