^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0-only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * CPU reset routines
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Copyright (C) 2015 Huawei Futurewei Technologies.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #ifndef _ARM64_CPU_RESET_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #define _ARM64_CPU_RESET_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <asm/virt.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) void __cpu_soft_restart(unsigned long el2_switch, unsigned long entry,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) unsigned long arg0, unsigned long arg1, unsigned long arg2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) static inline void __noreturn __nocfi cpu_soft_restart(unsigned long entry,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) unsigned long arg0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) unsigned long arg1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) unsigned long arg2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) typeof(__cpu_soft_restart) *restart;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) unsigned long el2_switch = !is_kernel_in_hyp_mode() &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) is_hyp_mode_available();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) restart = (void *)__pa_function(__cpu_soft_restart);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) cpu_install_idmap();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) restart(el2_switch, entry, arg0, arg1, arg2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) unreachable();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) #endif