From patchwork Wed Dec 22 13:08:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Leizhen (ThunderTown)" X-Patchwork-Id: 12697093 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 33BEDC433EF for ; Wed, 22 Dec 2021 13:17: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=oUpGY38D5iQl07OGFpPT4Zq/cAfXmeUGNd+CK23+6PY=; b=XZHXk6f41WDUTP kd814VX26sninkpsMgmsh3kqRwraV5fIXeh/EmtmKPxoQ8fStQo4o27ppJb4ON9QZMaztSAODZiBg TmD1fj6QXLyCAoPdVvd1MUozgHrcRLBcdU1sCU08a551cPi4shwi9WUi5F3h3dkD6dgzhDzymDo4s XNW6pctRo+8npZimaZQWaHeHO5tuSrC1bMvwBFPLyPJXiaHK5jinTKVcEDvwSbC61ewb3J2sYHAp3 SJBQWFaMekjD67hCh7afg/AcItFyugVy56Qmc9RK2EZgVl0XKoFMIeOjIK2ngV2lC6Qraec5TPH9f 6b6JHCa4iJxgYRMdLUpg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n01T3-00AR3h-CK; Wed, 22 Dec 2021 13:15:42 +0000 Received: from szxga01-in.huawei.com ([45.249.212.187]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n01Pw-00APG5-EH; Wed, 22 Dec 2021 13:12:30 +0000 Received: from dggpemm500023.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4JJtvK3JFvzZddm; Wed, 22 Dec 2021 21:09:17 +0800 (CST) Received: from dggpemm500006.china.huawei.com (7.185.36.236) by dggpemm500023.china.huawei.com (7.185.36.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Wed, 22 Dec 2021 21:12:26 +0800 Received: from thunder-town.china.huawei.com (10.174.178.55) by dggpemm500006.china.huawei.com (7.185.36.236) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Wed, 22 Dec 2021 21:12:25 +0800 From: Zhen Lei To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , , "H . Peter Anvin" , , Dave Young , Baoquan He , Vivek Goyal , Eric Biederman , , Catalin Marinas , "Will Deacon" , , Rob Herring , Frank Rowand , , Jonathan Corbet , CC: Zhen Lei , Randy Dunlap , Feng Zhou , Kefeng Wang , Chen Zhou , "John Donnelly" Subject: [PATCH v18 08/17] x86/setup: Add build option ARCH_WANT_RESERVE_CRASH_KERNEL Date: Wed, 22 Dec 2021 21:08:11 +0800 Message-ID: <20211222130820.1754-9-thunder.leizhen@huawei.com> X-Mailer: git-send-email 2.26.0.windows.1 In-Reply-To: <20211222130820.1754-1-thunder.leizhen@huawei.com> References: <20211222130820.1754-1-thunder.leizhen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.174.178.55] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemm500006.china.huawei.com (7.185.36.236) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211222_051228_908305_AC5554A8 X-CRM114-Status: GOOD ( 16.25 ) 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 From: Chen Zhou There are multiple ARCHs that implement reserve_crashkernel(), all of them are marked as static. Currently, we want to combine the implementations on x86 and arm64 into one, and move it to public crash_core.c. To avoid symbol conflicts on other platforms, add a new build option ARCH_WANT_RESERVE_CRASH_KERNEL. And change CONFIG_X86_64 to CONFIG_64BIT, so it can be shared with arm64, or other users in future. Signed-off-by: Chen Zhou Co-developed-by: Zhen Lei Signed-off-by: Zhen Lei --- arch/Kconfig | 3 +++ arch/x86/Kconfig | 2 ++ arch/x86/kernel/setup.c | 10 +++++----- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/arch/Kconfig b/arch/Kconfig index d3c4ab249e9c275..f53dd7852290b9a 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -11,6 +11,9 @@ source "arch/$(SRCARCH)/Kconfig" menu "General architecture-dependent options" +config ARCH_WANT_RESERVE_CRASH_KERNEL + bool + config CRASH_CORE bool diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 5c2ccb85f2efb86..bd78ed8193079b9 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -12,6 +12,7 @@ config X86_32 depends on !64BIT # Options that are inherently 32-bit kernel only: select ARCH_WANT_IPC_PARSE_VERSION + select ARCH_WANT_RESERVE_CRASH_KERNEL if KEXEC_CORE select CLKSRC_I8253 select CLONE_BACKWARDS select GENERIC_VDSO_32 @@ -28,6 +29,7 @@ config X86_64 select ARCH_HAS_GIGANTIC_PAGE select ARCH_SUPPORTS_INT128 if CC_HAS_INT128 select ARCH_USE_CMPXCHG_LOCKREF + select ARCH_WANT_RESERVE_CRASH_KERNEL if KEXEC_CORE select HAVE_ARCH_SOFT_DIRTY select MODULES_USE_ELF_RELA select NEED_DMA_MAP_STATE diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index abff57ffbe92884..beb73cce4b8b826 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c @@ -390,9 +390,9 @@ static void __init memblock_x86_reserve_range_setup_data(void) * --------- Crashkernel reservation ------------------------------ */ -#ifdef CONFIG_KEXEC_CORE +#ifdef CONFIG_ARCH_WANT_RESERVE_CRASH_KERNEL -#ifdef CONFIG_X86_64 +#ifdef CONFIG_64BIT static int __init reserve_crashkernel_low(unsigned long long low_size) { unsigned long long low_base = 0; @@ -456,7 +456,7 @@ static int __init parse_crashkernel_in_order(char *cmdline, if (!ret && crash_size > 0) return CRASHKERNEL_MEM_CLASSIC; -#ifdef CONFIG_X86_64 +#ifdef CONFIG_64BIT /* crashkernel=X,high */ ret = parse_crashkernel_high(cmdline, system_ram, crash_size, crash_base); if (ret || crash_size <= 0) @@ -522,7 +522,7 @@ static void __init reserve_crashkernel(void) } } -#ifdef CONFIG_X86_64 +#ifdef CONFIG_64BIT if (crash_base >= CRASH_ADDR_LOW_MAX) { /* * Ensure that at least 256M extra low memory is allocated for @@ -556,7 +556,7 @@ static void __init reserve_crashkernel(void) crashk_res.start = crash_base; crashk_res.end = crash_base + crash_size - 1; } -#endif +#endif /* CONFIG_ARCH_WANT_RESERVE_CRASH_KERNEL */ static struct resource standard_io_resources[] = { { .name = "dma1", .start = 0x00, .end = 0x1f,