Commit 77a43be1 authored by Pavel Tatashin's avatar Pavel Tatashin Committed by Will Deacon
Browse files

arm64: kexec: call kexec_image_info only once



Currently, kexec_image_info() is called during load time, and
right before kernel is being kexec'ed. There is no need to do both.
So, call it only once when segments are loaded and the physical
location of page with copy of arm64_relocate_new_kernel is known.

Signed-off-by: default avatarPavel Tatashin <pasha.tatashin@soleen.com>
Acked-by: default avatarJames Morse <james.morse@arm.com>
Link: https://lore.kernel.org/r/20210125191923.1060122-11-pasha.tatashin@soleen.com


Signed-off-by: default avatarWill Deacon <will@kernel.org>
parent 4c3c3123
Loading
Loading
Loading
Loading
+1 −4
Original line number Original line Diff line number Diff line
@@ -66,6 +66,7 @@ int machine_kexec_post_load(struct kimage *kimage)
	memcpy(reloc_code, arm64_relocate_new_kernel,
	memcpy(reloc_code, arm64_relocate_new_kernel,
	       arm64_relocate_new_kernel_size);
	       arm64_relocate_new_kernel_size);
	kimage->arch.kern_reloc = __pa(reloc_code);
	kimage->arch.kern_reloc = __pa(reloc_code);
	kexec_image_info(kimage);


	/* Flush the reloc_code in preparation for its execution. */
	/* Flush the reloc_code in preparation for its execution. */
	__flush_dcache_area(reloc_code, arm64_relocate_new_kernel_size);
	__flush_dcache_area(reloc_code, arm64_relocate_new_kernel_size);
@@ -84,8 +85,6 @@ int machine_kexec_post_load(struct kimage *kimage)
 */
 */
int machine_kexec_prepare(struct kimage *kimage)
int machine_kexec_prepare(struct kimage *kimage)
{
{
	kexec_image_info(kimage);

	if (kimage->type != KEXEC_TYPE_CRASH && cpus_are_stuck_in_kernel()) {
	if (kimage->type != KEXEC_TYPE_CRASH && cpus_are_stuck_in_kernel()) {
		pr_err("Can't kexec: CPUs are stuck in the kernel.\n");
		pr_err("Can't kexec: CPUs are stuck in the kernel.\n");
		return -EBUSY;
		return -EBUSY;
@@ -170,8 +169,6 @@ void machine_kexec(struct kimage *kimage)
	WARN(in_kexec_crash && (stuck_cpus || smp_crash_stop_failed()),
	WARN(in_kexec_crash && (stuck_cpus || smp_crash_stop_failed()),
		"Some CPUs may be stale, kdump will be unreliable.\n");
		"Some CPUs may be stale, kdump will be unreliable.\n");


	kexec_image_info(kimage);

	/* Flush the kimage list and its buffers. */
	/* Flush the kimage list and its buffers. */
	kexec_list_flush(kimage);
	kexec_list_flush(kimage);