From patchwork Mon Dec 4 02:19:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 13477746 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 5212FC4167B for ; Mon, 4 Dec 2023 02:20:05 +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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=1yFNaESX3NpoQTCTSnni3CGMjaCHXVN11smefeQjZ60=; b=4d0bqsazjvzDFP BlZkkFwaAzX5qYAzoC77V54fd1kDelRpwNpymJ/0YpFYN3OqsVhEj+lX0v1/1z37SVycW20tQfoo4 gG3lyMdbq/zo6U4tNlyV28orS2vT3i1D1h7l9WtRb6lS2l/4YMdTfhIjY31ztpTfSGk0V6T/LVEyY qdKRulmO9A5YtNegllvBZmtNGDvYE0htqZk58o2a2vSbyKuZftXOYuvFeeST3S1naT6McQN/2hHzv Xdv+pTxDTYfMNa561SkgWYw7Bq5wz405zPe6oZqLWZEEda5vEUtvbFZpF6WR+CJDUNqx/5QuNXgGM BDIb/D3B8+1yjL5wp2tw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r9yYr-002pMZ-1t; Mon, 04 Dec 2023 02:19:53 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r9yYk-002pKo-2u for linux-riscv@lists.infradead.org; Mon, 04 Dec 2023 02:19:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1701656386; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=kEYLn+UWJXzVvOdXDQoSl0HV2uxdkFhIxrNZEqvidvw=; b=RuVbHeMocCB6xcp7rclaFRtcg96dQ6oioj3hGaewDtDvjj5/4wbNYqiC/ChWJB0NHg0Lm9 /L7f5wOe9N4Z3xiZfd5LRg4vt+Lw167BVhU7F1pbfJDLjtze5QKGIU0U4EPwKdFcSO8X07 VWG4s3SspHlfVsFVqOKTFxjmc7L1KEg= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-527-IJdQXgyNMci1xrid06S4Qw-1; Sun, 03 Dec 2023 21:19:41 -0500 X-MC-Unique: IJdQXgyNMci1xrid06S4Qw-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id F151E1C041BF; Mon, 4 Dec 2023 02:19:40 +0000 (UTC) Received: from localhost (unknown [10.72.113.121]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4F2A9492BFC; Mon, 4 Dec 2023 02:19:39 +0000 (UTC) Date: Mon, 4 Dec 2023 10:19:36 +0800 From: Baoquan He To: Randy Dunlap Cc: Stephen Rothwell , akpm@linux-foundation.org, ignat@cloudflare.com, linux-next@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, kexec@lists.infradead.org, eric_devolder@yahoo.com Subject: [PATCH 1/2] riscv, crash: don't export some symbols when CONFIG_MMU=n Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.10 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231203_181948_021084_55E35DFA X-CRM114-Status: GOOD ( 12.94 ) X-BeenThere: linux-riscv@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-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org When dropping select of KEXEC and dependency on ARCH_SUPPORTS_KEXEC from CRASH_DUMP, compiling error is reported when below config items are set: ----------------------- CONFIG_CRASH_CORE=y CONFIG_KEXEC_CORE=y CONFIG_CRASH_DUMP=y ...... ----------------------- ------------------------------------------------------------------------------------------------- arch/riscv/kernel/crash_core.c:8:27: error: 'VA_BITS' undeclared (first use in this function) 8 | VMCOREINFO_NUMBER(VA_BITS); | ^~~~~~~ include/linux/crash_core.h:78:64: note: in definition of macro 'VMCOREINFO_NUMBER' 78 | vmcoreinfo_append_str("NUMBER(%s)=%ld\n", #name, (long)name) | ^~~~ arch/riscv/kernel/crash_core.c:14:64: error: 'VMEMMAP_START' undeclared (first use in this function) 14 | vmcoreinfo_append_str("NUMBER(VMEMMAP_START)=0x%lx\n", VMEMMAP_START); | ^~~~~~~~~~~~~ arch/riscv/kernel/crash_core.c:15:62: error: 'VMEMMAP_END' undeclared (first use in this function); did you mean 'MEMREMAP_ENC'? 15 | vmcoreinfo_append_str("NUMBER(VMEMMAP_END)=0x%lx\n", VMEMMAP_END); | ^~~~~~~~~~~ | MEMREMAP_ENC arch/riscv/kernel/crash_core.c:17:64: error: 'MODULES_VADDR' undeclared (first use in this function) 17 | vmcoreinfo_append_str("NUMBER(MODULES_VADDR)=0x%lx\n", MODULES_VADDR); | ^~~~~~~~~~~~~ arch/riscv/kernel/crash_core.c:18:62: error: 'MODULES_END' undeclared (first use in this function) 18 | vmcoreinfo_append_str("NUMBER(MODULES_END)=0x%lx\n", MODULES_END); ------------------------------------------------------------------------------------------------- Currently, riscv's ARCH_SUPPORTS_KEXEC has dependency on MMU. Before dropping ARCH_SUPPORTS_KEXEC, disabling CONFIG_MMU will unset CONFIG_CRASH_DUMP, CONFIG_KEXEC_CORE, CONFIG_CRASH_CORE. Hence crash_core related codes won't be compiled. --------------------- arch/riscv/Kconfig: config ARCH_SUPPORTS_KEXEC def_bool MMU --------------------- After dropping ARCH_SUPPORTS_KEXEC, CONFIG_CRASH_DUMP, CONFIG_KEXEC_CORE, CONFIG_CRASH_CORE can be set independently of CONFIG_MMU. However, there are several macro definitions, such as VA_BITS, VMEMMAP_START, VMEMMAP_END, MODULES_VADDR, MODULES_END are only available when CONFIG_MMU=y. Then compiling errors are triggered. Here, add CONFIG_MMU ifdeffery in arch_crash_save_vmcoreinfo() to export those symbols when CONFIG_MMU is enabled. Signed-off-by: Baoquan He Tested-by: Randy Dunlap # build-tested Signed-off-by: Baoquan He Reported-by: Randy Dunlap Acked-by: Randy Dunlap Tested-by: Randy Dunlap # build-tested --- arch/riscv/kernel/crash_core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/riscv/kernel/crash_core.c b/arch/riscv/kernel/crash_core.c index 55f1d7856b54..8706736fd4e2 100644 --- a/arch/riscv/kernel/crash_core.c +++ b/arch/riscv/kernel/crash_core.c @@ -5,17 +5,19 @@ void arch_crash_save_vmcoreinfo(void) { - VMCOREINFO_NUMBER(VA_BITS); VMCOREINFO_NUMBER(phys_ram_base); vmcoreinfo_append_str("NUMBER(PAGE_OFFSET)=0x%lx\n", PAGE_OFFSET); vmcoreinfo_append_str("NUMBER(VMALLOC_START)=0x%lx\n", VMALLOC_START); vmcoreinfo_append_str("NUMBER(VMALLOC_END)=0x%lx\n", VMALLOC_END); +#ifdef CONFIG_MMU + VMCOREINFO_NUMBER(VA_BITS); vmcoreinfo_append_str("NUMBER(VMEMMAP_START)=0x%lx\n", VMEMMAP_START); vmcoreinfo_append_str("NUMBER(VMEMMAP_END)=0x%lx\n", VMEMMAP_END); #ifdef CONFIG_64BIT vmcoreinfo_append_str("NUMBER(MODULES_VADDR)=0x%lx\n", MODULES_VADDR); vmcoreinfo_append_str("NUMBER(MODULES_END)=0x%lx\n", MODULES_END); +#endif #endif vmcoreinfo_append_str("NUMBER(KERNEL_LINK_ADDR)=0x%lx\n", KERNEL_LINK_ADDR); vmcoreinfo_append_str("NUMBER(va_kernel_pa_offset)=0x%lx\n",