From patchwork Mon Jul 8 21:15:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pasha Tatashin X-Patchwork-Id: 11035805 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C27AD14DB for ; Mon, 8 Jul 2019 21:17:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B107B28396 for ; Mon, 8 Jul 2019 21:17:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A52CA284C3; Mon, 8 Jul 2019 21:17:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3814828396 for ; Mon, 8 Jul 2019 21:17:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=GqIBGc93sbAh0Ox57zutXlVh/vqT8QDSNNZxBNGAX64=; b=JmsniQb6alkGMt fQAV0LRcKGcFjPOP+99bNxRdyHvOnn4pTnsPLyyBEgyb5OTtvbDk62TAnwUEf4lhC/55xgV0sYnnl 7C90QDynHrKQ62AAxJLvA2ASmsxQ9o2m8i0Y3mGWsmp9iBuyvfw2DzJB4ZSa56hxTvXgF79a5FtG7 QBY35Bg18d8qpm2GNu2Z2EJN1ElMWeyWFWF0jDK4LqFuZcdj/1cxyo77N6+OnaoMyqRVvtptgB7wH MTuqenIoHEOCtMwgDcuhmzBKydXzelDWrHbgVamC6QxzmCiXiibBTzLHNMDoGxEhTtrIhRUg8r2bs qzstbrDZhscCj7I7c4dQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hkb0o-0002wV-9u; Mon, 08 Jul 2019 21:17:26 +0000 Received: from mail-qt1-x841.google.com ([2607:f8b0:4864:20::841]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hkaz2-0001QE-B4 for linux-arm-kernel@lists.infradead.org; Mon, 08 Jul 2019 21:15:39 +0000 Received: by mail-qt1-x841.google.com with SMTP id a15so19480053qtn.7 for ; Mon, 08 Jul 2019 14:15:35 -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=XkNfo7Ng1869ovdwpudNrw0wlKf9MA92JwTYiEJph+VGQaPDhIC8ozhsHnT3ZFniLu xX5baRnstpeEOucyVITA9Xz9gppuLf27+QYgMNoyyfvQQhbQm0IkYXSD4wudfvFtmWdc ft6PJVK9OseR8BeKy0amPm4xmQjutbUoow+0G2TPi/J3Zv8+jT9lkM9bUP73Sk0FgLFe Zo2AHEwA/8MQzVRxCMMmTV55f20IHgKxNhU3CGLLk4SdrOP78pSafOWNNt8ATwroaJWg DKiMOy0AoBI25TfdY+Ua4a0SXfP583XcfX5hcBjYLwNKKBDiq2qpD/Jk0nTyIcH5vILI mg6Q== 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=StlfnzZWX23LVEa9mMrUZyO5AcEmeYDEM7zZ/NJ/KzIaJLuaFJRA1KHa1UIYpAncv4 UnvDPGU+egWM5z2FQjcR3u92eQlYziSBTCdZY2YCDuQLG4wSe4Pwfeyf73p6r9MLsx7h bFGGVMZgPua7Bod+nE5ugCA1gCrL7zC8Ajsald3HUJ+AZa94+R6ArrTq1lD7wkjenyQG CTH6W+bd3bMB0tUK9PNrMP8wjLmHLp9e1TMXNMbz7iSNajqWuRRR/9iH+xgmKf0c0eii fF5sVVas7WDg1J1Y5eSRrijvaCGARm9BDMuNdGbMT6ttis2NBEZ/bQkzFy0P2anQuTI0 A+/w== X-Gm-Message-State: APjAAAVYaPFfA2Kd0VHiKsBwwFoFIdjcTxmMrxsOPUgjIwEMP4Hhiadj WKDy39jxgGbDLmWRe0IVrM93ZEpVLds= X-Google-Smtp-Source: APXvYqzOynfC/xBCJVtVyeRdCM0qBpL/RmjpG/GqV9GNhFtfJLujygjgPzG6SCWKgrGRU8fAmuANkw== X-Received: by 2002:ac8:368a:: with SMTP id a10mr15795831qtc.143.1562620535026; Mon, 08 Jul 2019 14:15:35 -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 b67sm8335620qkd.82.2019.07.08.14.15.33 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 08 Jul 2019 14:15:34 -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: [v1 3/5] kexec: export common crashkernel/kexeckernel parser Date: Mon, 8 Jul 2019 17:15:26 -0400 Message-Id: <20190708211528.12392-4-pasha.tatashin@soleen.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190708211528.12392-1-pasha.tatashin@soleen.com> References: <20190708211528.12392-1-pasha.tatashin@soleen.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190708_141536_429360_26760EC9 X-CRM114-Status: GOOD ( 11.56 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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,