blob: 6ea337d464c414ed67cd139071022500220604d1 [file] [log] [blame]
David Brazdil0f672f62019-12-10 10:32:29 +00001/* SPDX-License-Identifier: GPL-2.0-only */
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00002/*
3 * CPU reset routines
4 *
5 * Copyright (C) 2001 Deep Blue Solutions Ltd.
6 * Copyright (C) 2012 ARM Ltd.
7 * Copyright (C) 2015 Huawei Futurewei Technologies.
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00008 */
9
10#include <linux/linkage.h>
11#include <asm/assembler.h>
12#include <asm/sysreg.h>
13#include <asm/virt.h>
14
15.text
16.pushsection .idmap.text, "awx"
17
18/*
19 * __cpu_soft_restart(el2_switch, entry, arg0, arg1, arg2) - Helper for
20 * cpu_soft_restart.
21 *
David Brazdil0f672f62019-12-10 10:32:29 +000022 * @el2_switch: Flag to indicate a switch to EL2 is needed.
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000023 * @entry: Location to jump to for soft reset.
David Brazdil0f672f62019-12-10 10:32:29 +000024 * arg0: First argument passed to @entry. (relocation list)
25 * arg1: Second argument passed to @entry.(physical kernel entry)
26 * arg2: Third argument passed to @entry. (physical dtb address)
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000027 *
28 * Put the CPU into the same state as it would be if it had been reset, and
29 * branch to what would be the reset vector. It must be executed with the
30 * flat identity mapping.
31 */
32ENTRY(__cpu_soft_restart)
33 /* Clear sctlr_el1 flags. */
34 mrs x12, sctlr_el1
35 ldr x13, =SCTLR_ELx_FLAGS
36 bic x12, x12, x13
37 pre_disable_mmu_workaround
38 msr sctlr_el1, x12
39 isb
40
41 cbz x0, 1f // el2_switch?
42 mov x0, #HVC_SOFT_RESTART
43 hvc #0 // no return
44
451: mov x18, x1 // entry
46 mov x0, x2 // arg0
47 mov x1, x3 // arg1
48 mov x2, x4 // arg2
49 br x18
50ENDPROC(__cpu_soft_restart)
51
52.popsection