From patchwork Fri Dec 3 05:11:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 12694585 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 404B8C433EF for ; Fri, 3 Dec 2021 05:20:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=aVIAosgFv9u9kDDmctsBnSqZMRVV4Zv0q72fn3dBr3s=; b=NH06hngdZzrItA gZeXJ805nxqJOuaqrmjwfjIAqhwbiTY7cnIh9U8sfvSe7CkecNTWZDjPMm0Ju13D91m0RhgiKkLvA 14yqq03KEOzssmk4L5NpDF4Q/f65cnqfTzM/LDkl8alnwCppiUCHM+GyAx+Jtp01PmBhyEaudHT0F ipMvjFSzMisEy1J9IWJFyTy+l9wg+efZY93/jZ4JnP4bRimYmONR+97Q8kkNFB4VwyK7BtNsf/M9+ iVh+pYGCC9vU3h+nZkpMlSC0rbc4LsAizNzVU3xAyhF8pk0gDC1bjPbWXTmYAu4EEVDloXAQVMCVi fi43+RSph5JlbJTKCDrQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mt0yr-00EMBL-CM; Fri, 03 Dec 2021 05:19:33 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mt0yb-00EM4k-Bd; Fri, 03 Dec 2021 05:19:18 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E58E962956; Fri, 3 Dec 2021 05:19:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D838CC53FAD; Fri, 3 Dec 2021 05:19:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1638508756; bh=Pwe0wYHKG5lxvAb6z5/hTI+22/H72lsdHUeOXryUv9w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SQwA+lKlGMNL5+ZkG7fJpteCU1piW7MSKcUDcDOMfJURL53112HoSUivtVDIQCJiP VWXAID0dxXH0vkl/fKdMXC64Li71glf4sdbelM1ePF123whpN3CxzO5sQ19+Y2vxbB iAXdJyYE82EhSthCH4WnMQkVD7Od2ZIGSNPAk42hZEYNLF4liT7QVFHzu4SIEdBw5P j8oAiWpE/h62SA+diLe3gNQWcfrkXTuleSNcGg2+QZQe/TpT34DSvQgL9YZwJys8Dk 4wiirN0zV2EkksxpTmadF5ewDJt/IlWbtu9HiilkY3W+c5OBXHQuZj7jKeZ9Tvvvx2 KeKEISnvy75Kg== From: Jisheng Zhang To: Russell King , Catalin Marinas , Paul Walmsley , Will Deacon , Palmer Dabbelt , Albert Ou , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, hpa@zytor.com, Eric Biederman , Alexandre Ghiti Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, kexec@lists.infradead.org Subject: [RFC PATCH 1/5] kexec: make crashk_res, crashk_low_res and crash_notes symbols always visible Date: Fri, 3 Dec 2021 13:11:53 +0800 Message-Id: <20211203051157.2160-2-jszhang@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20211203051157.2160-1-jszhang@kernel.org> References: <20211203051157.2160-1-jszhang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211202_211917_502461_3C356073 X-CRM114-Status: GOOD ( 13.39 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Make the forward declarations of crashk_res, crashk_low_res and crash_notes always visible. Code referring to these symbols can then just check for IS_ENABLED(CONFIG_KEXEC_CORE), instead of requiring conditional compilation using an #ifdef, thus preparing to increase compile coverage and simplify the code. Signed-off-by: Jisheng Zhang --- include/linux/kexec.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/include/linux/kexec.h b/include/linux/kexec.h index 0c994ae37729..58d1b58a971e 100644 --- a/include/linux/kexec.h +++ b/include/linux/kexec.h @@ -20,6 +20,12 @@ #include +/* Location of a reserved region to hold the crash kernel. + */ +extern struct resource crashk_res; +extern struct resource crashk_low_res; +extern note_buf_t __percpu *crash_notes; + #ifdef CONFIG_KEXEC_CORE #include #include @@ -350,12 +356,6 @@ extern int kexec_load_disabled; #define KEXEC_FILE_FLAGS (KEXEC_FILE_UNLOAD | KEXEC_FILE_ON_CRASH | \ KEXEC_FILE_NO_INITRAMFS) -/* Location of a reserved region to hold the crash kernel. - */ -extern struct resource crashk_res; -extern struct resource crashk_low_res; -extern note_buf_t __percpu *crash_notes; - /* flag to track if kexec reboot is in progress */ extern bool kexec_in_progress; From patchwork Fri Dec 3 05:11:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 12694586 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E1F6BC433F5 for ; Fri, 3 Dec 2021 05:21:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=O0ZJd7PfXd1gwKXO2ne6LAGeWB76CI3A0owTZTdiIw0=; b=MvP/nFtRngdLLi hd7Kd7wLZIL44u6uvqnR+4myaipKuvDizw7zjo+VGdoLilfmpqxhlKP1JYRgidnsca7ug3vVzwmFM vAUdM/AIi/1uef9slI5IDUMhOUFHCOH/A5vPUyqkzBZc2YIEoX11GAJTgmh/d43K6jcQeLGK9EjD1 X5FaZzQyE0y3GDdhjqn1/fCErCbY3zDWPDRj41srZ0ic105NyvgCuN/Ioqs6SLpENCMk94ERfQWCQ 4jgJr9K7+lIzU7j9VGI/bJklIA1hmastaVz8Vl+w8tcV8rd7uEMNWT97N9AVoe5jO+gEPL5D/pBZP lyfzOstn2yJop0kUYcbQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mt0z6-00EMIo-Jf; Fri, 03 Dec 2021 05:19:48 +0000 Received: from ams.source.kernel.org ([145.40.68.75]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mt0yi-00EM6p-0r; Fri, 03 Dec 2021 05:19:25 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7DBA5B825C1; Fri, 3 Dec 2021 05:19:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95F68C53FD0; Fri, 3 Dec 2021 05:19:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1638508760; bh=B71rQ+fNXM16LM47OdH86wRkLVWIAb35br+fzuzSHJo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZCbjVkSOnULAfcIFVLS25gQ3yFkJtv6i85o1SvTuCcq8KEA1X7cddy5R12NLvSL/J Rq73NTTJvkYyTHkvqW4VRm01m+5JXgVK+jvIHnyYPTXSVfOBETzujMNGTdXNiWCLOS VUUcAqi7oA0ZPLV4342e1tEPJT229ZQFOO52RH6rVr5VDsymeHl0ebD2m3Ez+QtNJG y9XfLElDn5VhSNwKCNZLqY8B7RNUCdt2v41N1AhbX2ejkzqLhBhrh5fnOC7ifhYVZj EBpypc8QsAjBuXJdOYAPnyIJ/2rXojJ4b6Hdho5Gma+5H9s7cjH+TVuj6a0WrvZJDT mSvbuFtAPRpAQ== From: Jisheng Zhang To: Russell King , Catalin Marinas , Paul Walmsley , Will Deacon , Palmer Dabbelt , Albert Ou , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, hpa@zytor.com, Eric Biederman , Alexandre Ghiti Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, kexec@lists.infradead.org Subject: [RFC PATCH 2/5] riscv: mm: init: use IS_ENABLED(CONFIG_KEXEC_CORE) instead of #ifdef Date: Fri, 3 Dec 2021 13:11:54 +0800 Message-Id: <20211203051157.2160-3-jszhang@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20211203051157.2160-1-jszhang@kernel.org> References: <20211203051157.2160-1-jszhang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211202_211924_212621_523CD940 X-CRM114-Status: GOOD ( 15.22 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Replace the conditional compilation using "#ifdef CONFIG_KEXEC_CORE" by a check for "IS_ENABLED(CONFIG_BLK_DEV_INITRD)", to simplify the code and increase compile coverage. Signed-off-by: Jisheng Zhang --- arch/riscv/mm/init.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c index aeae7d6b2fee..704e2463e976 100644 --- a/arch/riscv/mm/init.c +++ b/arch/riscv/mm/init.c @@ -755,7 +755,6 @@ static inline void setup_vm_final(void) } #endif /* CONFIG_MMU */ -#ifdef CONFIG_KEXEC_CORE /* * reserve_crashkernel() - reserves memory for crash kernel * @@ -772,6 +771,8 @@ static void __init reserve_crashkernel(void) int ret = 0; + if (!IS_ENABLED(CONFIG_KEXEC_CORE)) + return; /* * Don't reserve a region for a crash kernel on a crash kernel * since it doesn't make much sense and we have limited memory @@ -812,7 +813,6 @@ static void __init reserve_crashkernel(void) crashk_res.start = crash_base; crashk_res.end = crash_base + crash_size - 1; } -#endif /* CONFIG_KEXEC_CORE */ void __init paging_init(void) { @@ -826,9 +826,7 @@ void __init misc_mem_init(void) arch_numa_init(); sparse_init(); zone_sizes_init(); -#ifdef CONFIG_KEXEC_CORE reserve_crashkernel(); -#endif memblock_dump_all(); } From patchwork Fri Dec 3 05:11:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 12694587 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 86274C433EF for ; Fri, 3 Dec 2021 05:21:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=MtaoaKJft2NR6PWiFmjyG8R2YjPmnQmLhrtcbGYIjCc=; b=3A90aWSfgDZM2T 1tc61VxU5Lqu1uedJwfJxv4HO8TZzhB0QbfBJXXByNWfudLnpwWSX09I6/9ks2OY705CQDrrWAqST qIadE66YRJfB7thVoJZqHnbfbMQNy00D047v9HWkDORb+oOfdtcpXC5Dr9ZlN2ddCrPK1xU9w7dV5 yB5jx4vlNtRZ0glD58ey/RSfKsq3lEN8BLVggv0U1NLr4hiVHOPae8wSkiLmt83KKVZ0SITBcneIv yrkMtVZZc1qSJ03MHs5qcaLm6RLMV+KQ9EwJzndUD4638SSTpR3i1bGuE68JQ/VX+eI2l6o6fENl2 TDJYEqfNGc1bEzLifZog==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mt0zO-00EMSV-DL; Fri, 03 Dec 2021 05:20:06 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mt0yl-00EM8v-Im; Fri, 03 Dec 2021 05:19:28 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3AE65B825BE; Fri, 3 Dec 2021 05:19:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2A459C53FD3; Fri, 3 Dec 2021 05:19:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1638508765; bh=wV/b0hF7y3zy43Frcbos22daBFox+EfkOXqMxi+aJWI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HMkaFZ8GXMAQNbOGmHuxHQoTvdk2KZtX181kJkyT1+qqJVFz2rXoy9yU0Gx/NRpGZ hxMMSzie86ToVMkXFTuEh51Oc5LCWGtQUAzqr1Z3UoE7It7c4D2MtEdJP9KjNjBfv2 SVxtubOUKUMje60uOwpOln+WxANdMyeaXurlWODGCX/7SGmn9FiZwznuI7BbaNdBQe fTGOTC+xgVzVgHK/hxvlhML2CnsZMUOF64Xlc35T6giVbu+xPTyHJWNBL+gUeObLP6 r2asA+RbfoKmN/eS4ScAXe9ttlhiOnL3KK/7EBIOSUFtaa+DHeQg3m4/WB1PyoubA7 U5Zk7U/nNMutA== From: Jisheng Zhang To: Russell King , Catalin Marinas , Paul Walmsley , Will Deacon , Palmer Dabbelt , Albert Ou , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, hpa@zytor.com, Eric Biederman , Alexandre Ghiti Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, kexec@lists.infradead.org Subject: [RFC PATCH 3/5] x86/setup: use IS_ENABLED(CONFIG_KEXEC_CORE) instead of #ifdef Date: Fri, 3 Dec 2021 13:11:55 +0800 Message-Id: <20211203051157.2160-4-jszhang@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20211203051157.2160-1-jszhang@kernel.org> References: <20211203051157.2160-1-jszhang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211202_211927_773856_6FFD1412 X-CRM114-Status: GOOD ( 14.37 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Replace the conditional compilation using "#ifdef CONFIG_KEXEC_CORE" by a check for "IS_ENABLED(CONFIG_BLK_DEV_INITRD)", to simplify the code and increase compile coverage. Signed-off-by: Jisheng Zhang --- arch/x86/kernel/setup.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index c410be738ae7..56b738c1ca33 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c @@ -390,8 +390,6 @@ static void __init memblock_x86_reserve_range_setup_data(void) * --------- Crashkernel reservation ------------------------------ */ -#ifdef CONFIG_KEXEC_CORE - /* 16M alignment for crash kernel regions */ #define CRASH_ALIGN SZ_16M @@ -469,6 +467,9 @@ static void __init reserve_crashkernel(void) bool high = false; int ret; + if (!IS_ENABLED(CONFIG_KEXEC_CORE)) + return; + total_mem = memblock_phys_mem_size(); /* crashkernel=XM */ @@ -534,11 +535,6 @@ static void __init reserve_crashkernel(void) crashk_res.end = crash_base + crash_size - 1; insert_resource(&iomem_resource, &crashk_res); } -#else -static void __init reserve_crashkernel(void) -{ -} -#endif static struct resource standard_io_resources[] = { { .name = "dma1", .start = 0x00, .end = 0x1f, From patchwork Fri Dec 3 05:11:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 12694588 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 22867C433F5 for ; Fri, 3 Dec 2021 05:22:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=TZbEVUn+XXsZUtxrLE3MhGqyUcMB9SFVsQONtlM8P90=; b=L2KPEOytokOgE8 pxxMBTUpTxYKreAUWAigGjtpRc37ZBPZRNdOquNQAFtgbAxXkIOdIsMOvBd9yowOMx6mm5NZYEhRS Z/T39PkivU8KRfZZSJqD3NdSlpj6M6iAXTdHELOB6nh8Gc5QY0pLwRVuWx0KoS+IjqOXBIrX6x4xo QLKK300CuzVmGDDc0unipu+ipwDAWgOrvtC8/XSg7OOpbmOxKAIPW9d186RDJTmcg7cL2ErFtv1P6 mERWjbJZubgAPrIKIDzvxr2fEO7HEeJZEmAU8Lq7UfXMeWDONQjMgXwWAENxJTCoenTcEICY4MbGv V9q3GVkl2V6v4jRossWg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mt0zs-00EMlt-Pr; Fri, 03 Dec 2021 05:20:37 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mt0yp-00EMAb-NT; Fri, 03 Dec 2021 05:19:33 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6499AB825C2; Fri, 3 Dec 2021 05:19:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 70A1FC53FAD; Fri, 3 Dec 2021 05:19:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1638508769; bh=kRChCS06ixTKVgpe7b9Wuqso2wFqw6W6lFZFIfBAfZc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iE9FKuBVEQloHyNsn2y92aOUC57PTVDh6lCAmD20cAeOCFQUMGhsEPjGXDgPoryte Kctd+FU9xSTV1yrHfy9k8eFg57vj4/ezmXf5vLqWZDNF8pfWjTtLaglXNCg75UmdPE Wjn1LcXP7SwfC1HFqvSZhp5gzkhzaqkPYbvznZzG07by4zbpgVzbwQdOHngz3aWSWS ezpw/2GLRQTVCfT32lpGndQg2Ac52N67WsYfC6XnIexjTGK30ni4fjwHZ/tI3pSCsw rFyfAw1RYv/7ktRzNf9B3MouLWlYGP7QyVDkn5WZgu/+ngvWry3x0Su1hRuh+e5d3E QyPWDrnYBN1Fg== From: Jisheng Zhang To: Russell King , Catalin Marinas , Paul Walmsley , Will Deacon , Palmer Dabbelt , Albert Ou , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, hpa@zytor.com, Eric Biederman , Alexandre Ghiti Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, kexec@lists.infradead.org Subject: [RFC PATCH 4/5] arm64: mm: use IS_ENABLED(CONFIG_KEXEC_CORE) instead of #ifdef Date: Fri, 3 Dec 2021 13:11:56 +0800 Message-Id: <20211203051157.2160-5-jszhang@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20211203051157.2160-1-jszhang@kernel.org> References: <20211203051157.2160-1-jszhang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211202_211932_129831_44138AD1 X-CRM114-Status: GOOD ( 13.33 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Replace the conditional compilation using "#ifdef CONFIG_KEXEC_CORE" by a check for "IS_ENABLED(CONFIG_BLK_DEV_INITRD)", to simplify the code and increase compile coverage. Signed-off-by: Jisheng Zhang Acked-by: Catalin Marinas --- arch/arm64/mm/init.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c index a8834434af99..b4b8b4dc2d31 100644 --- a/arch/arm64/mm/init.c +++ b/arch/arm64/mm/init.c @@ -64,7 +64,6 @@ EXPORT_SYMBOL(memstart_addr); */ phys_addr_t arm64_dma_phys_limit __ro_after_init; -#ifdef CONFIG_KEXEC_CORE /* * reserve_crashkernel() - reserves memory for crash kernel * @@ -78,6 +77,9 @@ static void __init reserve_crashkernel(void) unsigned long long crash_max = arm64_dma_phys_limit; int ret; + if (!IS_ENABLED(CONFIG_KEXEC_CORE)) + return; + ret = parse_crashkernel(boot_command_line, memblock_phys_mem_size(), &crash_size, &crash_base); /* no crashkernel= or invalid value specified */ @@ -110,11 +112,6 @@ static void __init reserve_crashkernel(void) crashk_res.start = crash_base; crashk_res.end = crash_base + crash_size - 1; } -#else -static void __init reserve_crashkernel(void) -{ -} -#endif /* CONFIG_KEXEC_CORE */ /* * Return the maximum physical address for a zone accessible by the given bits From patchwork Fri Dec 3 05:11:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 12694589 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 63A0EC433EF for ; Fri, 3 Dec 2021 05:22:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=n2HQlQX42t77rNiB6bPf8X9YjU4YR7rXqskHaiu6cq8=; b=C84539goXGDCOO j3TsVDlf6xgK+J+FmrmsS6Q1IUHus5CpbNxhVMmewsTRCJ587eN0/73N5koHTqxqtcRQVRPwzAZT5 BTrrgksiYxb1tnSh+zJ3YoFa3RBxXwbjk/RKl1/+LrQQJNWyZoZBg63HCm0LUBl/2/iEj7w9NVYSV 3fAaKJGVVMT6OBXkkvGwKNo1vrOvzQ/uXF6YBOJ+adfY644ITNJqem01PxT5tJV08xCxwmlgazD7l RUVdSG2+w2pVlwpCeAY8ozLYC1PG4UGrr6En6vwQYX++iEmhxDGta1r7Bqm7rBC/AGgANNO/K3BLR 8ALZibVcuXTsII/PjMFg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mt10d-00ENHn-NC; Fri, 03 Dec 2021 05:21:24 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mt0ys-00EMC7-2Q; Fri, 03 Dec 2021 05:19:35 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A2E7462957; Fri, 3 Dec 2021 05:19:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95775C53FD1; Fri, 3 Dec 2021 05:19:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1638508773; bh=8aNi3jzRLx9EvlHvQrJ8+c0FPLWUfjaF4txqATGz5dk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PbmtvVVu3EW5lZpDtlp5isAZcUo7CXeKc+dXipWy344d/9FofNAtRnFsEkHQibyxM 94plzcYhxqXUeq6UOQl3HEne1hxkOcko15N7K9RLfmZrdtGsJjxLN6OBmlpT20nJdm IhpanescmVnYesI7ThWQRZx75hvpVkn+DTPgRlkf4uc57wZzQy19dTfTzkFRusqEoo uBw4C8R4NVLrTIBYtmfEmM/oG2KXWgy05CPuBCPotoU0vkM87Oph5vGg8XDMyzchnX /BVLkmJ5xjW+KWxzbDYsfRp+8EvOkeZSpZabclJ/y20qiusZQeMl+7T3D093aqlb+o qmAKcKrIGGGOg== From: Jisheng Zhang To: Russell King , Catalin Marinas , Paul Walmsley , Will Deacon , Palmer Dabbelt , Albert Ou , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, hpa@zytor.com, Eric Biederman , Alexandre Ghiti Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, kexec@lists.infradead.org Subject: [RFC PATCH 5/5] arm: use IS_ENABLED(CONFIG_KEXEC_CORE) instead of #ifdef Date: Fri, 3 Dec 2021 13:11:57 +0800 Message-Id: <20211203051157.2160-6-jszhang@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20211203051157.2160-1-jszhang@kernel.org> References: <20211203051157.2160-1-jszhang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211202_211934_182960_52342E5F X-CRM114-Status: GOOD ( 13.23 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Replace the conditional compilation using "#ifdef CONFIG_KEXEC_CORE" by a check for "IS_ENABLED(CONFIG_BLK_DEV_INITRD)", to simplify the code and increase compile coverage. Signed-off-by: Jisheng Zhang Reviewed-by: Russell King (Oracle) --- arch/arm/kernel/setup.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index 284a80c0b6e1..f9a054a344c0 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c @@ -973,7 +973,6 @@ static int __init init_machine_late(void) } late_initcall(init_machine_late); -#ifdef CONFIG_KEXEC /* * The crash region must be aligned to 128MB to avoid * zImage relocating below the reserved region. @@ -1001,6 +1000,9 @@ static void __init reserve_crashkernel(void) unsigned long long total_mem; int ret; + if (!IS_ENABLED(CONFIG_KEXEC_CORE)) + return; + total_mem = get_total_mem(); ret = parse_crashkernel(boot_command_line, total_mem, &crash_size, &crash_base); @@ -1056,9 +1058,6 @@ static void __init reserve_crashkernel(void) insert_resource(&iomem_resource, &crashk_boot_res); } } -#else -static inline void reserve_crashkernel(void) {} -#endif /* CONFIG_KEXEC */ void __init hyp_mode_check(void) {