Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp8228757ybi; Tue, 9 Jul 2019 11:32:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqz1Sl2TRL51jSfQMIBLD9KadzKNDVYT5v/WwA+HfnHb/skgEjL/e4X3pgbfDclcUpYv3tJ9 X-Received: by 2002:a17:902:b20d:: with SMTP id t13mr32216503plr.229.1562697166581; Tue, 09 Jul 2019 11:32:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562697166; cv=none; d=google.com; s=arc-20160816; b=V+ig2o2ts4XTvVlt+dHsG6eSlSnhdDThmKD2pRxpAc3ZlTuf9WqyQEeEJl6lS8gGxn ijranSdXfbSo4AwJ9FEbnAYPRq1PJzDWgP4HPs3sBnzPR7QeAt//q1qxA70ttvSu5AyO 40pWrdF/m4wpzGV3k6O0u7TvM+ecIiPCT12kjIrPyZC6mEdOknxuS+2um/XycTIM89uv kIMUl/YLmm6a2bSXg6ORbxOaSmBypJWWIzccziebf6LJt9l2i3iicCoaayephBVV5oE3 0giwghHpqiYqajBhrI32/D0coOvOv/ZtKhOz7Y/tMPhjMJzeIRPgKCWNA+n0vQiolwvx AnmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=vxweX2U2+Z856CcsxOG088urab10u3d6VzbrdBwUe6o=; b=Nvs5ghDterJOVD7TlVmKeiOYHZ4zZm5miD5v2EmLLYOpDw32QX16RtQ8Z1m3fVK923 kvhNrYI+w8NHz2Xt8fBWOtuBI3khz1j6gZNz7h7/JUwj1ey1Vt6PgeLvQnuSvZNGffB8 1yUXsUzvcgZxbv9ZX7UgL/1ZeqWfY/zCPzv18s4DAh3GRFsYph8m4jMH4mC7N5jJ3pug tQ2Ljgf2Jc7Za+aBki/jpo/e01ZvHULD5OL2HW4Idmys9X/Ia3NYm6ahj2ZxL62UTkfs lBE3ia7HDgaqtLrpN4NvgmOA6dy3lO2C5b95yGMDGM/3xe9s7vFC81GHdq7BqOFLo/TR kMIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@soleen.com header.s=google header.b=fROPV6xg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h1si23516596pgv.67.2019.07.09.11.32.30; Tue, 09 Jul 2019 11:32:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@soleen.com header.s=google header.b=fROPV6xg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729001AbfGISUX (ORCPT + 99 others); Tue, 9 Jul 2019 14:20:23 -0400 Received: from mail-qt1-f193.google.com ([209.85.160.193]:44499 "EHLO mail-qt1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727796AbfGISUV (ORCPT ); Tue, 9 Jul 2019 14:20:21 -0400 Received: by mail-qt1-f193.google.com with SMTP id 44so18751964qtg.11 for ; Tue, 09 Jul 2019 11:20:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen.com; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=vxweX2U2+Z856CcsxOG088urab10u3d6VzbrdBwUe6o=; b=fROPV6xgBSJhQ01nOcdaPocwDpq/tgqFMzKuQ1aRxe0BdHGYSbE7Mx44Vo+unqXPkG 2iQxFwNOSDAL+6xrRHgsE+5oOTpNUcaTtUnWzBQnoArvLe1SZxJuhHKRqH6oJXqWWaJp mYmJUMNp0hMmxuR5+lUvmF10SjSgGCn+X92RBQXE9trtp4e1hWtwVG70nLYhqgZMEneU 8FmJGF1qVgPlKmCQFFhG0OpQiGa2Sk5FjgCfMZI5LZbu1a0BxKAkQuR29zt1kcT31VdG IC8BDEXiFHBmdYydbK6a2ULNeXX78BJpyz62xQihfh1Y656wUkRhF7ksMuPF83a9UM3a 2t6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vxweX2U2+Z856CcsxOG088urab10u3d6VzbrdBwUe6o=; b=hFhctdaHDtZwywQhgNTr+daKfbr4NzbnA3ejYV/NlmX2me2TJQjJ/WpARGde1i314W ZBn9S/wknNjOb4mQtiQhZLJkBoyRbIZsPSolTbe0iSCXiy+rzXWrX/5miXNV5MGX9dvG ADKPkqKGFNlVx6S74KieqzX1zn30Kqa/Iw5CxnalBrjepTc5c0SBFL/zwE3uzUCJE7DB jjh8RPAV7kwZ+Hf5F6gVsaD1l/rPkHnIG5mKB/ouUmlGPy6eXXJgOmbJdrlw5UsPHYca jegF2WafdxjxWpyiTDt5MOx8mP3mnbuFUSw2ST+goPnYRGtf+GWaeiPMyrIJ6lqIKGbK p3NQ== X-Gm-Message-State: APjAAAVa3QYX9oIEJhn0o0o2UyUEROuFOBTYwTxP3IU/f34Fosa2UUVQ BceUjvkZu2zzzAHxidjyfZBGcA== X-Received: by 2002:ac8:1106:: with SMTP id c6mr18604187qtj.332.1562696420496; Tue, 09 Jul 2019 11:20:20 -0700 (PDT) Received: from localhost.localdomain (c-73-69-118-222.hsd1.nh.comcast.net. [73.69.118.222]) by smtp.gmail.com with ESMTPSA id k123sm9113056qkf.13.2019.07.09.11.20.19 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 09 Jul 2019 11:20:19 -0700 (PDT) From: Pavel Tatashin To: pasha.tatashin@soleen.com, jmorris@namei.org, sashal@kernel.org, ebiederm@xmission.com, kexec@lists.infradead.org, linux-kernel@vger.kernel.org, corbet@lwn.net, catalin.marinas@arm.com, will@kernel.org, linux-doc@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [v2 3/5] kexec: export common crashkernel/kexeckernel parser Date: Tue, 9 Jul 2019 14:20:12 -0400 Message-Id: <20190709182014.16052-4-pasha.tatashin@soleen.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190709182014.16052-1-pasha.tatashin@soleen.com> References: <20190709182014.16052-1-pasha.tatashin@soleen.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org To reserve memory for normal kexec reboot, the new parameter: kexeckernel=size[KMG][@offset[KMG]] is used. Its syntax is the same as craskernel=, therefore they can use the same function to parse parameter settings. Rename: __parse_crashkernel() to parse_crash_or_kexec_kernel(), and make it public. Signed-off-by: Pavel Tatashin --- .../admin-guide/kernel-parameters.txt | 7 +++++ include/linux/crash_core.h | 6 +++++ kernel/crash_core.c | 27 ++++++++++--------- 3 files changed, 28 insertions(+), 12 deletions(-) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index 5c7a0f5b0a2f..0f5ce665c7f5 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -739,6 +739,13 @@ It will be ignored when crashkernel=X,high is not used or memory reserved is below 4G. + kexeckernel=size[KMG][@offset[KMG]] + [KNL] Using kexec, Linux can reboot to a new kernel. + This parameter reserves the physical memory region + [offset, offset + size] for that kernel. If '@offset' is + omitted, then a suitable offset is selected + automatically. + cryptomgr.notests [KNL] Disable crypto self-tests diff --git a/include/linux/crash_core.h b/include/linux/crash_core.h index 525510a9f965..e90789ff0bec 100644 --- a/include/linux/crash_core.h +++ b/include/linux/crash_core.h @@ -74,5 +74,11 @@ int parse_crashkernel_high(char *cmdline, unsigned long long system_ram, unsigned long long *crash_size, unsigned long long *crash_base); int parse_crashkernel_low(char *cmdline, unsigned long long system_ram, unsigned long long *crash_size, unsigned long long *crash_base); +int parse_crash_or_kexec_kernel(char *cmdline, + unsigned long long system_ram, + unsigned long long *crash_size, + unsigned long long *crash_base, + const char *name, + const char *suffix); #endif /* LINUX_CRASH_CORE_H */ diff --git a/kernel/crash_core.c b/kernel/crash_core.c index 9f1557b98468..11e0f9837a32 100644 --- a/kernel/crash_core.c +++ b/kernel/crash_core.c @@ -224,12 +224,12 @@ static __init char *get_last_crashkernel(char *cmdline, return ck_cmdline; } -static int __init __parse_crashkernel(char *cmdline, - unsigned long long system_ram, - unsigned long long *crash_size, - unsigned long long *crash_base, - const char *name, - const char *suffix) +int __init parse_crash_or_kexec_kernel(char *cmdline, + unsigned long long system_ram, + unsigned long long *crash_size, + unsigned long long *crash_base, + const char *name, + const char *suffix) { char *first_colon, *first_space; char *ck_cmdline; @@ -270,8 +270,9 @@ int __init parse_crashkernel(char *cmdline, unsigned long long *crash_size, unsigned long long *crash_base) { - return __parse_crashkernel(cmdline, system_ram, crash_size, crash_base, - "crashkernel=", NULL); + return parse_crash_or_kexec_kernel(cmdline, system_ram, crash_size, + crash_base, "crashkernel=", + NULL); } int __init parse_crashkernel_high(char *cmdline, @@ -279,8 +280,9 @@ int __init parse_crashkernel_high(char *cmdline, unsigned long long *crash_size, unsigned long long *crash_base) { - return __parse_crashkernel(cmdline, system_ram, crash_size, crash_base, - "crashkernel=", suffix_tbl[SUFFIX_HIGH]); + return parse_crash_or_kexec_kernel(cmdline, system_ram, crash_size, + crash_base, "crashkernel=", + suffix_tbl[SUFFIX_HIGH]); } int __init parse_crashkernel_low(char *cmdline, @@ -288,8 +290,9 @@ int __init parse_crashkernel_low(char *cmdline, unsigned long long *crash_size, unsigned long long *crash_base) { - return __parse_crashkernel(cmdline, system_ram, crash_size, crash_base, - "crashkernel=", suffix_tbl[SUFFIX_LOW]); + return parse_crash_or_kexec_kernel(cmdline, system_ram, crash_size, + crash_base, "crashkernel=", + suffix_tbl[SUFFIX_LOW]); } Elf_Word *append_elf_note(Elf_Word *buf, char *name, unsigned int type, -- 2.22.0