From: Feng Tang <feng.tang@linux.alibaba.com>
To: Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Yang Shi <yang@os.amperecomputing.com>,
Ryan Roberts <ryan.roberts@arm.com>,
Baruch Siach <baruch@tkos.co.il>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Cc: Feng Tang <feng.tang@linux.alibaba.com>
Subject: [PATCH RFC] arm64/mm: Lift the cma address limit when CONFIG_DMA_NUMA_CMA=y
Date: Wed, 21 May 2025 09:47:01 +0800 [thread overview]
Message-ID: <20250521014701.73046-1-feng.tang@linux.alibaba.com> (raw)
When porting an cma related usage from x86_64 server to arm64 server,
the "cma=4G" setup failed on arm64, and the reason is arm64 has 4G (32bit)
address limit for cma reservation.
The limit is reasonable due to device DMA requirement, but for NUMA
servers which have CONFIG_DMA_NUMA_CMA enabled, the limit is not required
as that config already allows cma area to be reserved on different NUMA
nodes whose memory very likely goes beyond 4G limit.
Lift the cma limit for platform with such configuration.
Signed-off-by: Feng Tang <feng.tang@linux.alibaba.com>
---
arch/arm64/mm/init.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index b99bf3980fc6..661758678cc4 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -312,6 +312,7 @@ void __init arm64_memblock_init(void)
void __init bootmem_init(void)
{
unsigned long min, max;
+ phys_addr_t cma_limit;
min = PFN_UP(memblock_start_of_DRAM());
max = PFN_DOWN(memblock_end_of_DRAM());
@@ -343,8 +344,14 @@ void __init bootmem_init(void)
/*
* Reserve the CMA area after arm64_dma_phys_limit was initialised.
+ *
+ * When CONFIG_DMA_NUMA_CMA is enabled, system may have CMA reserved
+ * area in different NUMA nodes, which likely goes beyond the 32bit
+ * limit, thus use (PHYS_MASK+1) as cma limit.
*/
- dma_contiguous_reserve(arm64_dma_phys_limit);
+ cma_limit = IS_ENABLED(CONFIG_DMA_NUMA_CMA) ?
+ (PHYS_MASK + 1) : arm64_dma_phys_limit;
+ dma_contiguous_reserve(cma_limit);
/*
* request_standard_resources() depends on crashkernel's memory being
--
2.39.5 (Apple Git-154)
next reply other threads:[~2025-05-21 1:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-21 1:47 Feng Tang [this message]
2025-06-10 17:10 ` Catalin Marinas
2025-06-10 19:46 ` Robin Murphy
2025-06-11 4:08 ` Feng Tang
2025-06-11 11:52 ` Robin Murphy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250521014701.73046-1-feng.tang@linux.alibaba.com \
--to=feng.tang@linux.alibaba.com \
--cc=akpm@linux-foundation.org \
--cc=baruch@tkos.co.il \
--cc=catalin.marinas@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ryan.roberts@arm.com \
--cc=will@kernel.org \
--cc=yang@os.amperecomputing.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®