linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Baoquan He <bhe@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: linux-s390@vger.kernel.org, Baoquan He <bhe@redhat.com>,
	piliu@redhat.com, linux-sh@vger.kernel.org, x86@kernel.org,
	kexec@lists.infradead.org, linux-mips@vger.kernel.org,
	ebiederm@xmission.com, loongarch@lists.linux.dev,
	hbathini@linux.ibm.com, linux-riscv@lists.infradead.org,
	linuxppc-dev@lists.ozlabs.org, akpm@linux-foundation.org,
	linux-arm-kernel@lists.infradead.org, viro@zeniv.linux.org.uk
Subject: [PATCH linux-next v3 12/14] riscv, crash: wrap crash dumping code into crash related ifdefs
Date: Wed, 24 Jan 2024 13:12:52 +0800	[thread overview]
Message-ID: <20240124051254.67105-13-bhe@redhat.com> (raw)
In-Reply-To: <20240124051254.67105-1-bhe@redhat.com>

Now crash codes under kernel/ folder has been split out from kexec
code, crash dumping can be separated from kexec reboot in config
items on risc-v with some adjustments.

Here wrap up crash dumping codes with CONFIG_CRASH_DUMP ifdeffery, and
use IS_ENABLED(CONFIG_CRASH_RESERVE) check to decide if compiling
in the crashkernel reservation code.

Signed-off-by: Baoquan He <bhe@redhat.com>
---
 arch/riscv/kernel/elf_kexec.c | 9 +++++++--
 arch/riscv/mm/init.c          | 2 +-
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/arch/riscv/kernel/elf_kexec.c b/arch/riscv/kernel/elf_kexec.c
index 5bd1ec3341fe..54260c16f991 100644
--- a/arch/riscv/kernel/elf_kexec.c
+++ b/arch/riscv/kernel/elf_kexec.c
@@ -117,6 +117,7 @@ static int elf_find_pbase(struct kimage *image, unsigned long kernel_len,
 	return ret;
 }
 
+#ifdef CONFIG_CRASH_DUMP
 static int get_nr_ram_ranges_callback(struct resource *res, void *arg)
 {
 	unsigned int *nr_ranges = arg;
@@ -189,6 +190,7 @@ static char *setup_kdump_cmdline(struct kimage *image, char *cmdline,
 	cmdline_ptr[COMMAND_LINE_SIZE - 1] = '\0';
 	return cmdline_ptr;
 }
+#endif
 
 static void *elf_kexec_load(struct kimage *image, char *kernel_buf,
 			    unsigned long kernel_len, char *initrd,
@@ -196,12 +198,11 @@ static void *elf_kexec_load(struct kimage *image, char *kernel_buf,
 			    unsigned long cmdline_len)
 {
 	int ret;
+	void *fdt;
 	unsigned long old_kernel_pbase = ULONG_MAX;
 	unsigned long new_kernel_pbase = 0UL;
 	unsigned long initrd_pbase = 0UL;
-	unsigned long headers_sz;
 	unsigned long kernel_start;
-	void *fdt, *headers;
 	struct elfhdr ehdr;
 	struct kexec_buf kbuf;
 	struct kexec_elf_info elf_info;
@@ -227,8 +228,11 @@ static void *elf_kexec_load(struct kimage *image, char *kernel_buf,
 	kbuf.buf_min = new_kernel_pbase + kernel_len;
 	kbuf.buf_max = ULONG_MAX;
 
+#ifdef CONFIG_CRASH_DUMP
 	/* Add elfcorehdr */
 	if (image->type == KEXEC_TYPE_CRASH) {
+		void *headers;
+		unsigned long headers_sz;
 		ret = prepare_elf_headers(&headers, &headers_sz);
 		if (ret) {
 			pr_err("Preparing elf core header failed\n");
@@ -264,6 +268,7 @@ static void *elf_kexec_load(struct kimage *image, char *kernel_buf,
 		}
 		cmdline = modified_cmdline;
 	}
+#endif
 
 #ifdef CONFIG_ARCH_SUPPORTS_KEXEC_PURGATORY
 	/* Add purgatory to the image */
diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
index 32cad6a65ccd..245919dda910 100644
--- a/arch/riscv/mm/init.c
+++ b/arch/riscv/mm/init.c
@@ -1358,7 +1358,7 @@ static void __init arch_reserve_crashkernel(void)
 	bool high = false;
 	int ret;
 
-	if (!IS_ENABLED(CONFIG_KEXEC_CORE))
+	if (!IS_ENABLED(CONFIG_CRASH_RESERVE))
 		return;
 
 	ret = parse_crashkernel(cmdline, memblock_phys_mem_size(),
-- 
2.41.0


  parent reply	other threads:[~2024-01-24  5:23 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-24  5:12 [PATCH linux-next v3 00/14] Split crash out from kexec and clean up related config items Baoquan He
2024-01-24  5:12 ` [PATCH linux-next v3 01/14] kexec: split crashkernel reservation code out from crash_core.c Baoquan He
2024-01-28  1:28   ` Klara Modin
2024-01-29  1:57     ` Baoquan He
2024-01-24  5:12 ` [PATCH linux-next v3 02/14] crash: split vmcoreinfo exporting " Baoquan He
2024-03-25  8:24   ` Geert Uytterhoeven
2024-03-25  9:48     ` Baoquan He
2024-01-24  5:12 ` [PATCH linux-next v3 03/14] crash: remove dependency of FA_DUMP on CRASH_DUMP Baoquan He
2024-01-24  5:12 ` [PATCH linux-next v3 04/14] crash: split crash dumping code out from kexec_core.c Baoquan He
2024-01-24  5:12 ` [PATCH linux-next v3 05/14] crash: clean up kdump related config items Baoquan He
2024-01-24  5:12 ` [PATCH linux-next v3 06/14] x86, crash: wrap crash dumping code into crash related ifdefs Baoquan He
2024-01-24 23:02   ` Michael Kelley
2024-01-25  4:09     ` Baoquan He
2024-01-25  5:12       ` Michael Kelley
2024-01-25  9:17         ` Baoquan He
2024-01-25 15:30           ` Michael Kelley
2024-01-24  5:12 ` [PATCH linux-next v3 07/14] arm64, " Baoquan He
2024-01-24  5:12 ` [PATCH linux-next v3 08/14] ppc, crash: enforce KEXEC and KEXEC_FILE to select CRASH_DUMP Baoquan He
2024-01-24  5:12 ` [PATCH linux-next v3 09/14] s390, crash: wrap crash dumping code into crash related ifdefs Baoquan He
2024-01-24  5:12 ` [PATCH linux-next v3 10/14] sh, " Baoquan He
2024-01-24  8:13   ` John Paul Adrian Glaubitz
2024-01-24 14:38     ` Baoquan He
2024-01-24  5:12 ` [PATCH linux-next v3 11/14] mips, " Baoquan He
2024-01-24  5:12 ` Baoquan He [this message]
2024-01-24  5:12 ` [PATCH linux-next v3 13/14] arm, " Baoquan He
2024-01-24  5:12 ` [PATCH linux-next v3 14/14] loongarch, " Baoquan He
2024-01-26  4:55 ` [PATCH linux-next v3 00/14] Split crash out from kexec and clean up related config items Nathan Chancellor
2024-01-26  6:07   ` Baoquan He

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240124051254.67105-13-bhe@redhat.com \
    --to=bhe@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=ebiederm@xmission.com \
    --cc=hbathini@linux.ibm.com \
    --cc=kexec@lists.infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=loongarch@lists.linux.dev \
    --cc=piliu@redhat.com \
    --cc=viro@zeniv.linux.org.uk \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).