162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * CPU reset routines 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * Copyright (C) 2001 Deep Blue Solutions Ltd. 662306a36Sopenharmony_ci * Copyright (C) 2012 ARM Ltd. 762306a36Sopenharmony_ci * Copyright (C) 2015 Huawei Futurewei Technologies. 862306a36Sopenharmony_ci */ 962306a36Sopenharmony_ci 1062306a36Sopenharmony_ci#include <linux/linkage.h> 1162306a36Sopenharmony_ci#include <linux/cfi_types.h> 1262306a36Sopenharmony_ci#include <asm/assembler.h> 1362306a36Sopenharmony_ci#include <asm/sysreg.h> 1462306a36Sopenharmony_ci#include <asm/virt.h> 1562306a36Sopenharmony_ci 1662306a36Sopenharmony_ci.text 1762306a36Sopenharmony_ci.pushsection .idmap.text, "a" 1862306a36Sopenharmony_ci 1962306a36Sopenharmony_ci/* 2062306a36Sopenharmony_ci * cpu_soft_restart(el2_switch, entry, arg0, arg1, arg2) 2162306a36Sopenharmony_ci * 2262306a36Sopenharmony_ci * @el2_switch: Flag to indicate a switch to EL2 is needed. 2362306a36Sopenharmony_ci * @entry: Location to jump to for soft reset. 2462306a36Sopenharmony_ci * arg0: First argument passed to @entry. (relocation list) 2562306a36Sopenharmony_ci * arg1: Second argument passed to @entry.(physical kernel entry) 2662306a36Sopenharmony_ci * arg2: Third argument passed to @entry. (physical dtb address) 2762306a36Sopenharmony_ci * 2862306a36Sopenharmony_ci * Put the CPU into the same state as it would be if it had been reset, and 2962306a36Sopenharmony_ci * branch to what would be the reset vector. It must be executed with the 3062306a36Sopenharmony_ci * flat identity mapping. 3162306a36Sopenharmony_ci */ 3262306a36Sopenharmony_ciSYM_TYPED_FUNC_START(cpu_soft_restart) 3362306a36Sopenharmony_ci mov_q x12, INIT_SCTLR_EL1_MMU_OFF 3462306a36Sopenharmony_ci pre_disable_mmu_workaround 3562306a36Sopenharmony_ci /* 3662306a36Sopenharmony_ci * either disable EL1&0 translation regime or disable EL2&0 translation 3762306a36Sopenharmony_ci * regime if HCR_EL2.E2H == 1 3862306a36Sopenharmony_ci */ 3962306a36Sopenharmony_ci msr sctlr_el1, x12 4062306a36Sopenharmony_ci isb 4162306a36Sopenharmony_ci 4262306a36Sopenharmony_ci cbz x0, 1f // el2_switch? 4362306a36Sopenharmony_ci mov x0, #HVC_SOFT_RESTART 4462306a36Sopenharmony_ci hvc #0 // no return 4562306a36Sopenharmony_ci 4662306a36Sopenharmony_ci1: mov x8, x1 // entry 4762306a36Sopenharmony_ci mov x0, x2 // arg0 4862306a36Sopenharmony_ci mov x1, x3 // arg1 4962306a36Sopenharmony_ci mov x2, x4 // arg2 5062306a36Sopenharmony_ci br x8 5162306a36Sopenharmony_ciSYM_FUNC_END(cpu_soft_restart) 5262306a36Sopenharmony_ci 5362306a36Sopenharmony_ci.popsection 54