From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 66675C73C53 for ; Tue, 9 Jul 2019 18:20:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3941020665 for ; Tue, 9 Jul 2019 18:20:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=soleen.com header.i=@soleen.com header.b="fROPV6xg" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729027AbfGISUY (ORCPT ); Tue, 9 Jul 2019 14:20:24 -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-Google-Smtp-Source: APXvYqwpag+IBIQrGBDcCLRZVOWUUlgFjtMGgOzroSxhP3WwPBpgsirFrCOkxvY0XxfGhw6CZgULUQ== 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