kexec_file, riscv: print out debugging message if required
Then when specifying '-d' for kexec_file_load interface, loaded locations of kernel/initrd/cmdline etc can be printed out to help debug. Here replace pr_debug() with the newly added kexec_dprintk() in kexec_file loading related codes. And also replace pr_notice() with kexec_dprintk() in elf_kexec_load() because loaded location of purgatory and device tree are only printed out for debugging, it doesn't make sense to always print them out. And also remove kexec_image_info() because the content has been printed out in generic code. Link: https://lkml.kernel.org/r/20231213055747.61826-6-bhe@redhat.com Signed-off-by: Baoquan He <bhe@redhat.com> Cc: Conor Dooley <conor@kernel.org> Cc: Joe Perches <joe@perches.com> Cc: Nathan Chancellor <nathan@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
6f8c1da071
commit
eb7622d908
@ -216,7 +216,6 @@ static void *elf_kexec_load(struct kimage *image, char *kernel_buf,
|
||||
if (ret)
|
||||
goto out;
|
||||
kernel_start = image->start;
|
||||
pr_notice("The entry point of kernel at 0x%lx\n", image->start);
|
||||
|
||||
/* Add the kernel binary to the image */
|
||||
ret = riscv_kexec_elf_load(image, &ehdr, &elf_info,
|
||||
@ -252,8 +251,8 @@ static void *elf_kexec_load(struct kimage *image, char *kernel_buf,
|
||||
image->elf_load_addr = kbuf.mem;
|
||||
image->elf_headers_sz = headers_sz;
|
||||
|
||||
pr_debug("Loaded elf core header at 0x%lx bufsz=0x%lx memsz=0x%lx\n",
|
||||
image->elf_load_addr, kbuf.bufsz, kbuf.memsz);
|
||||
kexec_dprintk("Loaded elf core header at 0x%lx bufsz=0x%lx memsz=0x%lx\n",
|
||||
image->elf_load_addr, kbuf.bufsz, kbuf.memsz);
|
||||
|
||||
/* Setup cmdline for kdump kernel case */
|
||||
modified_cmdline = setup_kdump_cmdline(image, cmdline,
|
||||
@ -275,6 +274,8 @@ static void *elf_kexec_load(struct kimage *image, char *kernel_buf,
|
||||
pr_err("Error loading purgatory ret=%d\n", ret);
|
||||
goto out;
|
||||
}
|
||||
kexec_dprintk("Loaded purgatory at 0x%lx\n", kbuf.mem);
|
||||
|
||||
ret = kexec_purgatory_get_set_symbol(image, "riscv_kernel_entry",
|
||||
&kernel_start,
|
||||
sizeof(kernel_start), 0);
|
||||
@ -293,7 +294,7 @@ static void *elf_kexec_load(struct kimage *image, char *kernel_buf,
|
||||
if (ret)
|
||||
goto out;
|
||||
initrd_pbase = kbuf.mem;
|
||||
pr_notice("Loaded initrd at 0x%lx\n", initrd_pbase);
|
||||
kexec_dprintk("Loaded initrd at 0x%lx\n", initrd_pbase);
|
||||
}
|
||||
|
||||
/* Add the DTB to the image */
|
||||
@ -318,7 +319,7 @@ static void *elf_kexec_load(struct kimage *image, char *kernel_buf,
|
||||
}
|
||||
/* Cache the fdt buffer address for memory cleanup */
|
||||
image->arch.fdt = fdt;
|
||||
pr_notice("Loaded device tree at 0x%lx\n", kbuf.mem);
|
||||
kexec_dprintk("Loaded device tree at 0x%lx\n", kbuf.mem);
|
||||
goto out;
|
||||
|
||||
out_free_fdt:
|
||||
|
@ -18,30 +18,6 @@
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/irq.h>
|
||||
|
||||
/*
|
||||
* kexec_image_info - Print received image details
|
||||
*/
|
||||
static void
|
||||
kexec_image_info(const struct kimage *image)
|
||||
{
|
||||
unsigned long i;
|
||||
|
||||
pr_debug("Kexec image info:\n");
|
||||
pr_debug("\ttype: %d\n", image->type);
|
||||
pr_debug("\tstart: %lx\n", image->start);
|
||||
pr_debug("\thead: %lx\n", image->head);
|
||||
pr_debug("\tnr_segments: %lu\n", image->nr_segments);
|
||||
|
||||
for (i = 0; i < image->nr_segments; i++) {
|
||||
pr_debug("\t segment[%lu]: %016lx - %016lx", i,
|
||||
image->segment[i].mem,
|
||||
image->segment[i].mem + image->segment[i].memsz);
|
||||
pr_debug("\t\t0x%lx bytes, %lu pages\n",
|
||||
(unsigned long) image->segment[i].memsz,
|
||||
(unsigned long) image->segment[i].memsz / PAGE_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* machine_kexec_prepare - Initialize kexec
|
||||
*
|
||||
@ -60,8 +36,6 @@ machine_kexec_prepare(struct kimage *image)
|
||||
unsigned int control_code_buffer_sz = 0;
|
||||
int i = 0;
|
||||
|
||||
kexec_image_info(image);
|
||||
|
||||
/* Find the Flattened Device Tree and save its physical address */
|
||||
for (i = 0; i < image->nr_segments; i++) {
|
||||
if (image->segment[i].memsz <= sizeof(fdt))
|
||||
|
Loading…
Reference in New Issue
Block a user