2019-06-04 16:11:33 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2016-06-24 01:54:48 +08:00
|
|
|
/*
|
|
|
|
* CPU reset routines
|
|
|
|
*
|
|
|
|
* Copyright (C) 2001 Deep Blue Solutions Ltd.
|
|
|
|
* Copyright (C) 2012 ARM Ltd.
|
|
|
|
* Copyright (C) 2015 Huawei Futurewei Technologies.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/linkage.h>
|
|
|
|
#include <asm/assembler.h>
|
|
|
|
#include <asm/sysreg.h>
|
|
|
|
#include <asm/virt.h>
|
|
|
|
|
|
|
|
.text
|
2018-01-29 20:00:00 +08:00
|
|
|
.pushsection .idmap.text, "awx"
|
2016-06-24 01:54:48 +08:00
|
|
|
|
|
|
|
/*
|
2021-09-30 22:31:12 +08:00
|
|
|
* cpu_soft_restart(el2_switch, entry, arg0, arg1, arg2)
|
2016-06-24 01:54:48 +08:00
|
|
|
*
|
2018-11-15 13:52:52 +08:00
|
|
|
* @el2_switch: Flag to indicate a switch to EL2 is needed.
|
2016-06-24 01:54:48 +08:00
|
|
|
* @entry: Location to jump to for soft reset.
|
2018-11-15 13:52:52 +08:00
|
|
|
* arg0: First argument passed to @entry. (relocation list)
|
|
|
|
* arg1: Second argument passed to @entry.(physical kernel entry)
|
|
|
|
* arg2: Third argument passed to @entry. (physical dtb address)
|
2016-06-24 01:54:48 +08:00
|
|
|
*
|
|
|
|
* Put the CPU into the same state as it would be if it had been reset, and
|
|
|
|
* branch to what would be the reset vector. It must be executed with the
|
|
|
|
* flat identity mapping.
|
|
|
|
*/
|
2021-09-30 22:31:12 +08:00
|
|
|
SYM_CODE_START(cpu_soft_restart)
|
2021-03-10 21:25:57 +08:00
|
|
|
mov_q x12, INIT_SCTLR_EL1_MMU_OFF
|
2018-01-29 19:59:52 +08:00
|
|
|
pre_disable_mmu_workaround
|
2020-08-28 21:39:57 +08:00
|
|
|
/*
|
|
|
|
* either disable EL1&0 translation regime or disable EL2&0 translation
|
|
|
|
* regime if HCR_EL2.E2H == 1
|
|
|
|
*/
|
2016-06-24 01:54:48 +08:00
|
|
|
msr sctlr_el1, x12
|
|
|
|
isb
|
|
|
|
|
|
|
|
cbz x0, 1f // el2_switch?
|
|
|
|
mov x0, #HVC_SOFT_RESTART
|
|
|
|
hvc #0 // no return
|
|
|
|
|
2019-12-07 06:13:40 +08:00
|
|
|
1: mov x8, x1 // entry
|
2016-06-24 01:54:48 +08:00
|
|
|
mov x0, x2 // arg0
|
|
|
|
mov x1, x3 // arg1
|
|
|
|
mov x2, x4 // arg2
|
2019-12-07 06:13:40 +08:00
|
|
|
br x8
|
2021-09-30 22:31:12 +08:00
|
|
|
SYM_CODE_END(cpu_soft_restart)
|
2016-06-24 01:54:48 +08:00
|
|
|
|
|
|
|
.popsection
|