| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * kexec for arm64 |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) Linaro. |
|---|
| 5 | 6 | * 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. |
|---|
| 10 | 7 | */ |
|---|
| 11 | 8 | |
|---|
| 12 | 9 | #include <linux/interrupt.h> |
|---|
| .. | .. |
|---|
| 163 | 160 | |
|---|
| 164 | 161 | kexec_image_info(kimage); |
|---|
| 165 | 162 | |
|---|
| 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 | | - |
|---|
| 178 | 163 | /* |
|---|
| 179 | 164 | * Copy arm64_relocate_new_kernel to the reboot_code_buffer for use |
|---|
| 180 | 165 | * after the kernel is shut down. |
|---|
| .. | .. |
|---|
| 213 | 198 | * uses physical addressing to relocate the new image to its final |
|---|
| 214 | 199 | * position and transfers control to the image entry point when the |
|---|
| 215 | 200 | * 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. |
|---|
| 216 | 205 | */ |
|---|
| 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 |
|---|
| 219 | 212 | |
|---|
| 220 | 213 | BUG(); /* Should never get here. */ |
|---|
| 221 | 214 | } |
|---|
| .. | .. |
|---|
| 314 | 307 | * but does not hold any data of loaded kernel image. |
|---|
| 315 | 308 | * |
|---|
| 316 | 309 | * 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(). |
|---|
| 318 | 311 | * |
|---|
| 319 | 312 | * In hibernation, the pages which are Reserved and yet "nosave" are excluded |
|---|
| 320 | 313 | * from the hibernation iamge. crash_is_nosave() does thich check for crash |
|---|
| .. | .. |
|---|
| 354 | 347 | |
|---|
| 355 | 348 | for (addr = begin; addr < end; addr += PAGE_SIZE) { |
|---|
| 356 | 349 | page = phys_to_page(addr); |
|---|
| 357 | | - ClearPageReserved(page); |
|---|
| 358 | 350 | free_reserved_page(page); |
|---|
| 359 | 351 | } |
|---|
| 360 | 352 | } |
|---|