hc
2024-05-10 37f49e37ab4cb5d0bc4c60eb5c6d4dd57db767bb
kernel/arch/arm64/kernel/machine_kexec.c
....@@ -1,12 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * kexec for arm64
34 *
45 * Copyright (C) Linaro.
56 * Copyright (C) Huawei Futurewei Technologies.
6
- *
7
- * This program is free software; you can redistribute it and/or modify
8
- * it under the terms of the GNU General Public License version 2 as
9
- * published by the Free Software Foundation.
107 */
118
129 #include <linux/interrupt.h>
....@@ -163,18 +160,6 @@
163160
164161 kexec_image_info(kimage);
165162
166
- pr_debug("%s:%d: control_code_page: %p\n", __func__, __LINE__,
167
- kimage->control_code_page);
168
- pr_debug("%s:%d: reboot_code_buffer_phys: %pa\n", __func__, __LINE__,
169
- &reboot_code_buffer_phys);
170
- pr_debug("%s:%d: reboot_code_buffer: %p\n", __func__, __LINE__,
171
- reboot_code_buffer);
172
- pr_debug("%s:%d: relocate_new_kernel: %p\n", __func__, __LINE__,
173
- arm64_relocate_new_kernel);
174
- pr_debug("%s:%d: relocate_new_kernel_size: 0x%lx(%lu) bytes\n",
175
- __func__, __LINE__, arm64_relocate_new_kernel_size,
176
- arm64_relocate_new_kernel_size);
177
-
178163 /*
179164 * Copy arm64_relocate_new_kernel to the reboot_code_buffer for use
180165 * after the kernel is shut down.
....@@ -213,9 +198,17 @@
213198 * uses physical addressing to relocate the new image to its final
214199 * position and transfers control to the image entry point when the
215200 * relocation is complete.
201
+ * In kexec case, kimage->start points to purgatory assuming that
202
+ * kernel entry and dtb address are embedded in purgatory by
203
+ * userspace (kexec-tools).
204
+ * In kexec_file case, the kernel starts directly without purgatory.
216205 */
217
-
218
- cpu_soft_restart(reboot_code_buffer_phys, kimage->head, kimage->start, 0);
206
+ cpu_soft_restart(reboot_code_buffer_phys, kimage->head, kimage->start,
207
+#ifdef CONFIG_KEXEC_FILE
208
+ kimage->arch.dtb_mem);
209
+#else
210
+ 0);
211
+#endif
219212
220213 BUG(); /* Should never get here. */
221214 }
....@@ -314,7 +307,7 @@
314307 * but does not hold any data of loaded kernel image.
315308 *
316309 * Note that all the pages in crash dump kernel memory have been initially
317
- * marked as Reserved in kexec_reserve_crashkres_pages().
310
+ * marked as Reserved as memory was allocated via memblock_reserve().
318311 *
319312 * In hibernation, the pages which are Reserved and yet "nosave" are excluded
320313 * from the hibernation iamge. crash_is_nosave() does thich check for crash
....@@ -354,7 +347,6 @@
354347
355348 for (addr = begin; addr < end; addr += PAGE_SIZE) {
356349 page = phys_to_page(addr);
357
- ClearPageReserved(page);
358350 free_reserved_page(page);
359351 }
360352 }