relocate_kernel.S (0ea5c948cb64bab5bc7a5516774eb8536f05aa0d) | relocate_kernel.S (cb8a2ef0848ca80d67d6d56e2df757cfdf6b3355) |
---|---|
1/* SPDX-License-Identifier: GPL-2.0 */ 2/* 3 * relocate_kernel.S for kexec 4 * 5 * Copyright (C) 2022 Loongson Technology Corporation Limited 6 */ 7 8#include <linux/kexec.h> 9 10#include <asm/asm.h> 11#include <asm/asmmacro.h> 12#include <asm/regdef.h> 13#include <asm/loongarch.h> 14#include <asm/stackframe.h> 15#include <asm/addrspace.h> 16 17SYM_CODE_START(relocate_new_kernel) | 1/* SPDX-License-Identifier: GPL-2.0 */ 2/* 3 * relocate_kernel.S for kexec 4 * 5 * Copyright (C) 2022 Loongson Technology Corporation Limited 6 */ 7 8#include <linux/kexec.h> 9 10#include <asm/asm.h> 11#include <asm/asmmacro.h> 12#include <asm/regdef.h> 13#include <asm/loongarch.h> 14#include <asm/stackframe.h> 15#include <asm/addrspace.h> 16 17SYM_CODE_START(relocate_new_kernel) |
18 UNWIND_HINT_UNDEFINED |
|
18 /* 19 * a0: EFI boot flag for the new kernel 20 * a1: Command line pointer for the new kernel 21 * a2: System table pointer for the new kernel 22 * a3: Start address to jump to after relocation 23 * a4: Pointer to the current indirection page entry 24 */ 25 move s0, a4 --- 59 unchanged lines hidden (view full) --- 85SYM_CODE_END(relocate_new_kernel) 86 87#ifdef CONFIG_SMP 88/* 89 * Other CPUs should wait until code is relocated and 90 * then start at the entry point from LOONGARCH_IOCSR_MBUF0. 91 */ 92SYM_CODE_START(kexec_smp_wait) | 19 /* 20 * a0: EFI boot flag for the new kernel 21 * a1: Command line pointer for the new kernel 22 * a2: System table pointer for the new kernel 23 * a3: Start address to jump to after relocation 24 * a4: Pointer to the current indirection page entry 25 */ 26 move s0, a4 --- 59 unchanged lines hidden (view full) --- 86SYM_CODE_END(relocate_new_kernel) 87 88#ifdef CONFIG_SMP 89/* 90 * Other CPUs should wait until code is relocated and 91 * then start at the entry point from LOONGARCH_IOCSR_MBUF0. 92 */ 93SYM_CODE_START(kexec_smp_wait) |
94 UNWIND_HINT_UNDEFINED |
|
931: li.w t0, 0x100 /* wait for init loop */ 942: addi.w t0, t0, -1 /* limit mailbox access */ 95 bnez t0, 2b 96 li.w t1, LOONGARCH_IOCSR_MBUF0 97 iocsrrd.w s0, t1 /* check PC as an indicator */ 98 beqz s0, 1b 99 iocsrrd.d s0, t1 /* get PC via mailbox */ 100 101 li.d t0, CACHE_BASE 102 or s0, s0, t0 /* s0 = TO_CACHE(s0) */ 103 jr s0 /* jump to initial PC */ 104SYM_CODE_END(kexec_smp_wait) 105#endif 106 107relocate_new_kernel_end: 108 | 951: li.w t0, 0x100 /* wait for init loop */ 962: addi.w t0, t0, -1 /* limit mailbox access */ 97 bnez t0, 2b 98 li.w t1, LOONGARCH_IOCSR_MBUF0 99 iocsrrd.w s0, t1 /* check PC as an indicator */ 100 beqz s0, 1b 101 iocsrrd.d s0, t1 /* get PC via mailbox */ 102 103 li.d t0, CACHE_BASE 104 or s0, s0, t0 /* s0 = TO_CACHE(s0) */ 105 jr s0 /* jump to initial PC */ 106SYM_CODE_END(kexec_smp_wait) 107#endif 108 109relocate_new_kernel_end: 110 |
109SYM_DATA_START(relocate_new_kernel_size) 110 PTR relocate_new_kernel_end - relocate_new_kernel 111SYM_DATA_END(relocate_new_kernel_size) | 111 .section ".data" 112SYM_DATA(relocate_new_kernel_size, .long relocate_new_kernel_end - relocate_new_kernel) |