-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Commit 68234df ("arm64: kill flush_cache_all()") removed the global arm64 routines cpu_reset() and cpu_soft_restart() needed by the arm64 kexec and kdump support. Add back a simplified version of cpu_soft_restart() with some changes needed for kexec in the new files cpu_reset.S, and cpu_reset.h. When a CPU is reset it needs to be put into the exception level it had when it entered the kernel. Update cpu_soft_restart() to accept an argument which signals if the reset address should be entered at EL1 or EL2, and add a new hypercall HVC_SOFT_RESTART which is used for the EL2 switch. Signed-off-by: Geoff Levand <geoff@infradead.org> Reviewed-by: James Morse <james.morse@arm.com> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
- Loading branch information
Geoff Levand
authored and
Catalin Marinas
committed
Jun 27, 2016
1 parent
b69e0dc
commit f9076ec
Showing
4 changed files
with
102 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* CPU reset routines | ||
* | ||
* Copyright (C) 2001 Deep Blue Solutions Ltd. | ||
* Copyright (C) 2012 ARM Ltd. | ||
* Copyright (C) 2015 Huawei Futurewei Technologies. | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License version 2 as | ||
* published by the Free Software Foundation. | ||
*/ | ||
|
||
#include <linux/linkage.h> | ||
#include <asm/assembler.h> | ||
#include <asm/sysreg.h> | ||
#include <asm/virt.h> | ||
|
||
.text | ||
.pushsection .idmap.text, "ax" | ||
|
||
/* | ||
* __cpu_soft_restart(el2_switch, entry, arg0, arg1, arg2) - Helper for | ||
* cpu_soft_restart. | ||
* | ||
* @el2_switch: Flag to indicate a swich to EL2 is needed. | ||
* @entry: Location to jump to for soft reset. | ||
* arg0: First argument passed to @entry. | ||
* arg1: Second argument passed to @entry. | ||
* arg2: Third argument passed to @entry. | ||
* | ||
* 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. | ||
*/ | ||
ENTRY(__cpu_soft_restart) | ||
/* Clear sctlr_el1 flags. */ | ||
mrs x12, sctlr_el1 | ||
ldr x13, =SCTLR_ELx_FLAGS | ||
bic x12, x12, x13 | ||
msr sctlr_el1, x12 | ||
isb | ||
|
||
cbz x0, 1f // el2_switch? | ||
mov x0, #HVC_SOFT_RESTART | ||
hvc #0 // no return | ||
|
||
1: mov x18, x1 // entry | ||
mov x0, x2 // arg0 | ||
mov x1, x3 // arg1 | ||
mov x2, x4 // arg2 | ||
br x18 | ||
ENDPROC(__cpu_soft_restart) | ||
|
||
.popsection |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* CPU reset routines | ||
* | ||
* Copyright (C) 2015 Huawei Futurewei Technologies. | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License version 2 as | ||
* published by the Free Software Foundation. | ||
*/ | ||
|
||
#ifndef _ARM64_CPU_RESET_H | ||
#define _ARM64_CPU_RESET_H | ||
|
||
#include <asm/virt.h> | ||
|
||
void __cpu_soft_restart(unsigned long el2_switch, unsigned long entry, | ||
unsigned long arg0, unsigned long arg1, unsigned long arg2); | ||
|
||
static inline void __noreturn cpu_soft_restart(unsigned long el2_switch, | ||
unsigned long entry, unsigned long arg0, unsigned long arg1, | ||
unsigned long arg2) | ||
{ | ||
typeof(__cpu_soft_restart) *restart; | ||
|
||
el2_switch = el2_switch && !is_kernel_in_hyp_mode() && | ||
is_hyp_mode_available(); | ||
restart = (void *)virt_to_phys(__cpu_soft_restart); | ||
|
||
cpu_install_idmap(); | ||
restart(el2_switch, entry, arg0, arg1, arg2); | ||
unreachable(); | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters