{"id":2218969,"url":"http://patchwork.ozlabs.org/api/patches/2218969/?format=json","web_url":"http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20260402072701.628293-16-ruanjinjie@huawei.com/","project":{"id":2,"url":"http://patchwork.ozlabs.org/api/projects/2/?format=json","name":"Linux PPC development","link_name":"linuxppc-dev","list_id":"linuxppc-dev.lists.ozlabs.org","list_email":"linuxppc-dev@lists.ozlabs.org","web_url":"https://github.com/linuxppc/wiki/wiki","scm_url":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git","webscm_url":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/","list_archive_url":"https://lore.kernel.org/linuxppc-dev/","list_archive_url_format":"https://lore.kernel.org/linuxppc-dev/{}/","commit_url_format":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/commit/?id={}"},"msgid":"<20260402072701.628293-16-ruanjinjie@huawei.com>","list_archive_url":"https://lore.kernel.org/linuxppc-dev/20260402072701.628293-16-ruanjinjie@huawei.com/","date":"2026-04-02T07:27:01","name":"[v12,15/15] riscv: kexec: Add support for crashkernel CMA reservation","commit_ref":null,"pull_url":null,"state":"handled-elsewhere","archived":false,"hash":"580a0db999d4bd6203e02638e6b190e88616273c","submitter":{"id":84791,"url":"http://patchwork.ozlabs.org/api/people/84791/?format=json","name":"Jinjie Ruan","email":"ruanjinjie@huawei.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20260402072701.628293-16-ruanjinjie@huawei.com/mbox/","series":[{"id":498443,"url":"http://patchwork.ozlabs.org/api/series/498443/?format=json","web_url":"http://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=498443","date":"2026-04-02T07:26:46","name":"arm64/riscv: Add support for crashkernel CMA reservation","version":12,"mbox":"http://patchwork.ozlabs.org/series/498443/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2218969/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2218969/checks/","tags":{},"related":[],"headers":{"Return-Path":"\n <linuxppc-dev+bounces-19206-incoming=patchwork.ozlabs.org@lists.ozlabs.org>","X-Original-To":["incoming@patchwork.ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=huawei.com header.i=@huawei.com header.a=rsa-sha256\n header.s=dkim header.b=XG5yIWzK;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org\n (client-ip=112.213.38.117; helo=lists.ozlabs.org;\n envelope-from=linuxppc-dev+bounces-19206-incoming=patchwork.ozlabs.org@lists.ozlabs.org;\n receiver=patchwork.ozlabs.org)","lists.ozlabs.org;\n arc=none smtp.remote-ip=113.46.200.223","lists.ozlabs.org;\n dmarc=pass (p=quarantine dis=none) header.from=huawei.com","lists.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=huawei.com header.i=@huawei.com header.a=rsa-sha256\n header.s=dkim header.b=XG5yIWzK;\n\tdkim-atps=neutral","lists.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=huawei.com\n (client-ip=113.46.200.223; helo=canpmsgout08.his.huawei.com;\n envelope-from=ruanjinjie@huawei.com; receiver=lists.ozlabs.org)"],"Received":["from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fmYNK2QnPz1yCs\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 02 Apr 2026 18:27:44 +1100 (AEDT)","from boromir.ozlabs.org (localhost [127.0.0.1])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 4fmYLy6GxCz30fh;\n\tThu, 02 Apr 2026 18:26:34 +1100 (AEDT)","from canpmsgout08.his.huawei.com (canpmsgout08.his.huawei.com\n [113.46.200.223])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 4fmYLx70vfz30dt\n\tfor <linuxppc-dev@lists.ozlabs.org>; Thu, 02 Apr 2026 18:26:33 +1100 (AEDT)","from mail.maildlp.com (unknown [172.19.163.200])\n\tby canpmsgout08.his.huawei.com (SkyGuard) with ESMTPS id 4fmYCl5YhYzmVWr;\n\tThu,  2 Apr 2026 15:20:19 +0800 (CST)","from dggpemf500011.china.huawei.com (unknown [7.185.36.131])\n\tby mail.maildlp.com (Postfix) with ESMTPS id 906E84056D;\n\tThu,  2 Apr 2026 15:26:31 +0800 (CST)","from huawei.com (10.90.53.73) by dggpemf500011.china.huawei.com\n (7.185.36.131) with Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 2 Apr\n 2026 15:26:28 +0800"],"ARC-Seal":"i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1775114794;\n\tcv=none;\n b=NBeS1fKNPqVUMhseG9FE/+NGcXkHREa2xJX0BSgQI4NsG9HCKG+vcqCZvbiyAK2349nBApcxQCsbgDw2JoW0VRuUZzBF9ovRY8Z9DhveKCHx6dRoirrUJj+TpEzhzh+qlU2cb+q6K3A8oV+XNMT313kDK6OshHQ0pxQk2QS6YXYiNOdrgokymlWi2lKqRJK6IrcS6hUU1uBfbNUPcse8F61kXrcjdxVJ6jHH0h299iufTlEGrsho6CH4UFAiKdheetU7mVrks1AV60uRyZEGcTbBeaKzXwslG2XZMgFqquA4uLIEQBMcZeGT/Rg+e6J1eMZpCZqPhbRkTuyCvIEgZQ==","ARC-Message-Signature":"i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707;\n\tt=1775114794; c=relaxed/relaxed;\n\tbh=HnOZBoE7o/6/IAIFfJRvYly50aiP5r33Q2nsL/6jnAk=;\n\th=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version:Content-Type;\n b=KyNqpxlNQbVUClGCqWT+6Qf0GhDPVABkFTaqZuQPG3kda+/gHbeAxZXwlZKrTWuINYIkoI0vpE5VjTx0zLK37CYyrgVtuVSxHXrdof51ybAPVrnPwTseoQIO05rRTDmCl7CH1ebGsAXdHzMSxFH4dwOoKYC57HJrIJxqQOeBusxZmtYzfm5lx3M4XGQI3BWa+uKZ/JPcst7pvaImgG9ShOpN1KDfCyl6DK0xRG21/nexBJ92h7zY6SJlnYpTX4MF8BuE+m532SzXFxtIIX6QpizvjrBLpUTSBH063FI7BwBZPh9Kx3qw5536xzio9yrzhhglvR3ydky/+ec+V6qZ3w==","ARC-Authentication-Results":"i=1; lists.ozlabs.org;\n dmarc=pass (p=quarantine dis=none) header.from=huawei.com;\n dkim=pass (1024-bit key;\n unprotected) header.d=huawei.com header.i=@huawei.com header.a=rsa-sha256\n header.s=dkim header.b=XG5yIWzK; dkim-atps=neutral;\n spf=pass (client-ip=113.46.200.223; helo=canpmsgout08.his.huawei.com;\n envelope-from=ruanjinjie@huawei.com;\n receiver=lists.ozlabs.org) smtp.mailfrom=huawei.com","dkim-signature":"v=1; a=rsa-sha256; d=huawei.com; s=dkim;\n\tc=relaxed/relaxed; q=dns/txt;\n\th=From;\n\tbh=HnOZBoE7o/6/IAIFfJRvYly50aiP5r33Q2nsL/6jnAk=;\n\tb=XG5yIWzKdNW6ZIUY1IeNuIEmda+qjNe0mzM2RASvpMLKA0VQyQ/lc6+rvBeGvBX+PHLq0rmN8\n\t6maPKZC3t1oDwPlnVH2scDHAWSypKM/eoZXO8x2x3aPMSOnuwmoXvUB0FMtVLUEM+QRz81W/Ad+\n\tTQceOxVP8w3Sk+4wK8jsbiM=","From":"Jinjie Ruan <ruanjinjie@huawei.com>","To":"<corbet@lwn.net>, <skhan@linuxfoundation.org>, <catalin.marinas@arm.com>,\n\t<will@kernel.org>, <chenhuacai@kernel.org>, <kernel@xen0n.name>,\n\t<maddy@linux.ibm.com>, <mpe@ellerman.id.au>, <npiggin@gmail.com>,\n\t<chleroy@kernel.org>, <pjw@kernel.org>, <palmer@dabbelt.com>,\n\t<aou@eecs.berkeley.edu>, <alex@ghiti.fr>, <tglx@kernel.org>,\n\t<mingo@redhat.com>, <bp@alien8.de>, <dave.hansen@linux.intel.com>,\n\t<hpa@zytor.com>, <robh@kernel.org>, <saravanak@kernel.org>,\n\t<akpm@linux-foundation.org>, <bhe@redhat.com>, <vgoyal@redhat.com>,\n\t<dyoung@redhat.com>, <rdunlap@infradead.org>, <peterz@infradead.org>,\n\t<pawan.kumar.gupta@linux.intel.com>, <feng.tang@linux.alibaba.com>,\n\t<dapeng1.mi@linux.intel.com>, <kees@kernel.org>, <elver@google.com>,\n\t<paulmck@kernel.org>, <lirongqing@baidu.com>, <rppt@kernel.org>,\n\t<leitao@debian.org>, <ardb@kernel.org>, <jbohac@suse.cz>,\n\t<cfsworks@gmail.com>, <tangyouling@kylinos.cn>, <sourabhjain@linux.ibm.com>,\n\t<ritesh.list@gmail.com>, <hbathini@linux.ibm.com>, <eajames@linux.ibm.com>,\n\t<guoren@kernel.org>, <songshuaishuai@tinylab.org>, <kevin.brodsky@arm.com>,\n\t<vishal.moola@gmail.com>, <junhui.liu@pigmoral.tech>, <coxu@redhat.com>,\n\t<fuqiang.wang@easystack.cn>, <liaoyuanhong@vivo.com>,\n\t<takahiro.akashi@linaro.org>, <james.morse@arm.com>, <lizhengyu3@huawei.com>,\n\t<x86@kernel.org>, <linux-doc@vger.kernel.org>,\n\t<linux-kernel@vger.kernel.org>, <linux-arm-kernel@lists.infradead.org>,\n\t<loongarch@lists.linux.dev>, <linuxppc-dev@lists.ozlabs.org>,\n\t<linux-riscv@lists.infradead.org>, <devicetree@vger.kernel.org>,\n\t<kexec@lists.infradead.org>","CC":"<ruanjinjie@huawei.com>","Subject":"[PATCH v12 15/15] riscv: kexec: Add support for crashkernel CMA\n reservation","Date":"Thu, 2 Apr 2026 15:27:01 +0800","Message-ID":"<20260402072701.628293-16-ruanjinjie@huawei.com>","X-Mailer":"git-send-email 2.34.1","In-Reply-To":"<20260402072701.628293-1-ruanjinjie@huawei.com>","References":"<20260402072701.628293-1-ruanjinjie@huawei.com>","X-Mailing-List":"linuxppc-dev@lists.ozlabs.org","List-Id":"<linuxppc-dev.lists.ozlabs.org>","List-Help":"<mailto:linuxppc-dev+help@lists.ozlabs.org>","List-Owner":"<mailto:linuxppc-dev+owner@lists.ozlabs.org>","List-Post":"<mailto:linuxppc-dev@lists.ozlabs.org>","List-Archive":"<https://lore.kernel.org/linuxppc-dev/>,\n  <https://lists.ozlabs.org/pipermail/linuxppc-dev/>","List-Subscribe":"<mailto:linuxppc-dev+subscribe@lists.ozlabs.org>,\n  <mailto:linuxppc-dev+subscribe-digest@lists.ozlabs.org>,\n  <mailto:linuxppc-dev+subscribe-nomail@lists.ozlabs.org>","List-Unsubscribe":"<mailto:linuxppc-dev+unsubscribe@lists.ozlabs.org>","Precedence":"list","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Content-Type":"text/plain","X-Originating-IP":"[10.90.53.73]","X-ClientProxiedBy":"kwepems100002.china.huawei.com (7.221.188.206) To\n dggpemf500011.china.huawei.com (7.185.36.131)","X-Spam-Status":"No, score=-0.2 required=3.0 tests=DKIM_SIGNED,DKIM_VALID,\n\tDKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=disabled\n\tversion=4.0.1 OzLabs 8","X-Spam-Checker-Version":"SpamAssassin 4.0.1 (2024-03-25) on lists.ozlabs.org"},"content":"Commit 35c18f2933c5 (\"Add a new optional \",cma\" suffix to the\ncrashkernel= command line option\") and commit ab475510e042 (\"kdump:\nimplement reserve_crashkernel_cma\") added CMA support for kdump\ncrashkernel reservation. This allows the kernel to dynamically allocate\ncontiguous memory for crash dumping when needed, rather than permanently\nreserving a fixed region at boot time.\n\nSo extend crashkernel CMA reservation support to riscv. The following\nchanges are made to enable CMA reservation:\n\n- Parse and obtain the CMA reservation size along with other crashkernel\n  parameters.\n- Call reserve_crashkernel_cma() to allocate the CMA region for kdump.\n- Include the CMA-reserved ranges for kdump kernel to use, which was\n  already done in of_kexec_alloc_and_setup_fdt().\n- Exclude the CMA-reserved ranges from the crash kernel memory to\n  prevent them from being exported through /proc/vmcore, which was\n  already done in the crash core.\n\nUpdate kernel-parameters.txt to document CMA support for crashkernel on\nriscv architecture.\n\nCc: Paul Walmsley <pjw@kernel.org>\nCc: Palmer Dabbelt <palmer@dabbelt.com>\nCc: Albert Ou <aou@eecs.berkeley.edu>\nCc: Alexandre Ghiti <alex@ghiti.fr>\nAcked-by: Baoquan He <bhe@redhat.com>\nAcked-by: Mike Rapoport (Microsoft) <rppt@kernel.org>\nAcked-by: Paul Walmsley <pjw@kernel.org> # arch/riscv\nSigned-off-by: Jinjie Ruan <ruanjinjie@huawei.com>\n---\n Documentation/admin-guide/kernel-parameters.txt | 16 ++++++++--------\n arch/riscv/kernel/machine_kexec_file.c          |  2 +-\n arch/riscv/mm/init.c                            |  5 +++--\n 3 files changed, 12 insertions(+), 11 deletions(-)","diff":"diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt\nindex a7055cead40f..13ced9ea42f4 100644\n--- a/Documentation/admin-guide/kernel-parameters.txt\n+++ b/Documentation/admin-guide/kernel-parameters.txt\n@@ -1122,14 +1122,14 @@ Kernel parameters\n \t\t\tIt will be ignored when crashkernel=X,high is not used\n \t\t\tor memory reserved is below 4G.\n \tcrashkernel=size[KMG],cma\n-\t\t\t[KNL, X86, ARM64, PPC] Reserve additional crash kernel memory from\n-\t\t\tCMA. This reservation is usable by the first system's\n-\t\t\tuserspace memory and kernel movable allocations (memory\n-\t\t\tballoon, zswap). Pages allocated from this memory range\n-\t\t\twill not be included in the vmcore so this should not\n-\t\t\tbe used if dumping of userspace memory is intended and\n-\t\t\tit has to be expected that some movable kernel pages\n-\t\t\tmay be missing from the dump.\n+\t\t\t[KNL, X86, ARM64, RISCV, PPC] Reserve additional crash\n+\t\t\tkernel memory from CMA. This reservation is usable by\n+\t\t\tthe first system's userspace memory and kernel movable\n+\t\t\tallocations (memory balloon, zswap). Pages allocated\n+\t\t\tfrom this memory range will not be included in the vmcore\n+\t\t\tso this should not be used if dumping of userspace memory\n+\t\t\tis intended and it has to be expected that some movable\n+\t\t\tkernel pages may be missing from the dump.\n \n \t\t\tA standard crashkernel reservation, as described above,\n \t\t\tis still needed to hold the crash kernel and initrd.\ndiff --git a/arch/riscv/kernel/machine_kexec_file.c b/arch/riscv/kernel/machine_kexec_file.c\nindex bea818f75dd6..c79cd86d5713 100644\n--- a/arch/riscv/kernel/machine_kexec_file.c\n+++ b/arch/riscv/kernel/machine_kexec_file.c\n@@ -46,7 +46,7 @@ static int get_nr_ram_ranges_callback(struct resource *res, void *arg)\n \n unsigned int arch_get_system_nr_ranges(void)\n {\n-\tunsigned int nr_ranges = 2; /* For exclusion of crashkernel region */\n+\tunsigned int nr_ranges = 2 + crashk_cma_cnt; /* For exclusion of crashkernel region */\n \n \twalk_system_ram_res(0, -1, &nr_ranges, get_nr_ram_ranges_callback);\n \ndiff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c\nindex 811e03786c56..4cd49afa9077 100644\n--- a/arch/riscv/mm/init.c\n+++ b/arch/riscv/mm/init.c\n@@ -1398,7 +1398,7 @@ static inline void setup_vm_final(void)\n  */\n static void __init arch_reserve_crashkernel(void)\n {\n-\tunsigned long long low_size = 0;\n+\tunsigned long long low_size = 0, cma_size = 0;\n \tunsigned long long crash_base, crash_size;\n \tbool high = false;\n \tint ret;\n@@ -1408,11 +1408,12 @@ static void __init arch_reserve_crashkernel(void)\n \n \tret = parse_crashkernel(boot_command_line, memblock_phys_mem_size(),\n \t\t\t\t&crash_size, &crash_base,\n-\t\t\t\t&low_size, NULL, &high);\n+\t\t\t\t&low_size, &cma_size, &high);\n \tif (ret)\n \t\treturn;\n \n \treserve_crashkernel_generic(crash_size, crash_base, low_size, high);\n+\treserve_crashkernel_cma(cma_size);\n }\n \n void __init paging_init(void)\n","prefixes":["v12","15/15"]}