s390, crash: wrap crash dumping code into crash related ifdefs
authorBaoquan He <bhe@redhat.com>
Wed, 24 Jan 2024 05:12:49 +0000 (13:12 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Sat, 24 Feb 2024 01:48:23 +0000 (17:48 -0800)
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 s390 with some adjustments.

Here wrap up crash dumping codes with CONFIG_CRASH_DUMP ifdeffery.

Link: https://lkml.kernel.org/r/20240124051254.67105-10-bhe@redhat.com
Signed-off-by: Baoquan He <bhe@redhat.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: Hari Bathini <hbathini@linux.ibm.com>
Cc: Pingfan Liu <piliu@redhat.com>
Cc: Klara Modin <klarasmodin@gmail.com>
Cc: Michael Kelley <mhklinux@outlook.com>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Yang Li <yang.lee@linux.alibaba.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
arch/s390/kernel/kexec_elf.c
arch/s390/kernel/kexec_image.c
arch/s390/kernel/machine_kexec_file.c

index 9da6fa30c44749fd7f4b044f5d211f7cd25d2b33..4d364de4379921c852de6d98fcea95e82ed53743 100644 (file)
@@ -40,8 +40,10 @@ static int kexec_file_add_kernel_elf(struct kimage *image,
                buf.bufsz = phdr->p_filesz;
 
                buf.mem = ALIGN(phdr->p_paddr, phdr->p_align);
+#ifdef CONFIG_CRASH_DUMP
                if (image->type == KEXEC_TYPE_CRASH)
                        buf.mem += crashk_res.start;
+#endif
                buf.memsz = phdr->p_memsz;
                data->memsz = ALIGN(data->memsz, phdr->p_align) + buf.memsz;
 
index af23eff5774dba339beeb69c34565f92edd87568..a32ce8bea745cfde0a4eea3ff57ac0572714f504 100644 (file)
@@ -24,8 +24,10 @@ static int kexec_file_add_kernel_image(struct kimage *image,
        buf.bufsz = image->kernel_buf_len;
 
        buf.mem = 0;
+#ifdef CONFIG_CRASH_DUMP
        if (image->type == KEXEC_TYPE_CRASH)
                buf.mem += crashk_res.start;
+#endif
        buf.memsz = buf.bufsz;
 
        data->kernel_buf = image->kernel_buf;
index 8d207b82d9feddcd0d12f650e73c4f500bacfc84..c2bac14dd668ae39d7fd9f2aa6092618464f3fd4 100644 (file)
@@ -105,6 +105,7 @@ static int kexec_file_update_purgatory(struct kimage *image,
        if (ret)
                return ret;
 
+#ifdef CONFIG_CRASH_DUMP
        if (image->type == KEXEC_TYPE_CRASH) {
                u64 crash_size;
 
@@ -121,6 +122,7 @@ static int kexec_file_update_purgatory(struct kimage *image,
                                                     sizeof(crash_size),
                                                     false);
        }
+#endif
        return ret;
 }
 
@@ -134,8 +136,10 @@ static int kexec_file_add_purgatory(struct kimage *image,
 
        data->memsz = ALIGN(data->memsz, PAGE_SIZE);
        buf.mem = data->memsz;
+#ifdef CONFIG_CRASH_DUMP
        if (image->type == KEXEC_TYPE_CRASH)
                buf.mem += crashk_res.start;
+#endif
 
        ret = kexec_load_purgatory(image, &buf);
        if (ret)
@@ -158,8 +162,10 @@ static int kexec_file_add_initrd(struct kimage *image,
 
        data->memsz = ALIGN(data->memsz, PAGE_SIZE);
        buf.mem = data->memsz;
+#ifdef CONFIG_CRASH_DUMP
        if (image->type == KEXEC_TYPE_CRASH)
                buf.mem += crashk_res.start;
+#endif
        buf.memsz = buf.bufsz;
 
        data->parm->initrd_start = data->memsz;
@@ -223,8 +229,10 @@ static int kexec_file_add_ipl_report(struct kimage *image,
                data->kernel_buf + offsetof(struct lowcore, ipl_parmblock_ptr);
        *lc_ipl_parmblock_ptr = (__u32)buf.mem;
 
+#ifdef CONFIG_CRASH_DUMP
        if (image->type == KEXEC_TYPE_CRASH)
                buf.mem += crashk_res.start;
+#endif
 
        ret = kexec_add_buffer(&buf);
 out:
@@ -268,10 +276,12 @@ void *kexec_file_add_components(struct kimage *image,
        memcpy(data.parm->command_line, image->cmdline_buf,
               image->cmdline_buf_len);
 
+#ifdef CONFIG_CRASH_DUMP
        if (image->type == KEXEC_TYPE_CRASH) {
                data.parm->oldmem_base = crashk_res.start;
                data.parm->oldmem_size = crashk_res.end - crashk_res.start + 1;
        }
+#endif
 
        if (image->initrd_buf) {
                ret = kexec_file_add_initrd(image, &data);