[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250612021417.44929-1-feng.tang@linux.alibaba.com>
Date: Thu, 12 Jun 2025 10:14:17 +0800
From: Feng Tang <feng.tang@...ux.alibaba.com>
To: Marek Szyprowski <m.szyprowski@...sung.com>,
Robin Murphy <robin.murphy@....com>,
Catalin Marinas <catalin.marinas@....com>,
Andrew Morton <akpm@...ux-foundation.org>,
Christoph Hellwig <hch@....de>,
iommu@...ts.linux.dev,
linux-kernel@...r.kernel.org
Cc: Feng Tang <feng.tang@...ux.alibaba.com>
Subject: [PATCH] dma-contiguous: hornor the cma address limit setup by user
When porting a cma related usage from x86_64 server to arm64 server,
the "cma=4G@4G" setup failed on arm64. The reason is arm64 and some
other architectures have specific physical address limit for reserved
cma area, like 4GB due to the device's need for 32 bit dma. Actually
lots of platforms of those architectures don't have this device dma
limit, but still have to obey it, and are not able to reserve a huge
cma pool.
This situation could be improved by honoring the user input cma
physical address than the arch limit. As when users specify it, they
already knows what the default is which probably can't suit them.
Suggested-by: Robin Murphy <robin.murphy@....com>
Signed-off-by: Feng Tang <feng.tang@...ux.alibaba.com>
---
kernel/dma/contiguous.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/kernel/dma/contiguous.c b/kernel/dma/contiguous.c
index 8df0dfaaca18..67af8a55185d 100644
--- a/kernel/dma/contiguous.c
+++ b/kernel/dma/contiguous.c
@@ -222,7 +222,10 @@ void __init dma_contiguous_reserve(phys_addr_t limit)
if (size_cmdline != -1) {
selected_size = size_cmdline;
selected_base = base_cmdline;
- selected_limit = min_not_zero(limit_cmdline, limit);
+
+ /* Hornor the user setup dma address limit */
+ selected_limit = limit_cmdline ?: limit;
+
if (base_cmdline + size_cmdline == limit_cmdline)
fixed = true;
} else {
--
2.43.5
Powered by blists - more mailing lists