-
Notifications
You must be signed in to change notification settings - Fork 320
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
hypervisor: arm64: PSCI support for SMP on AArch64
On AArch64 we pretty much rely on PSCI being present for SMP support (turning multiple cores on and off). This patch implements the helpers needed for SMP and plugs in the PSCI code from AArch32. On AArch64 PSCI calls can be issued via SVC64 hypercalls as well, contrary to AArch32 which uses SVC32 calls only. We add the changes necessary to support the hypercalls that are used by a Linux root cell. CPU hotplug now is still working after we enable Jailhouse. Signed-off-by: Antonios Motakis <antonios.motakis@huawei.com>
- Loading branch information
Showing
8 changed files
with
199 additions
and
2 deletions.
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
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
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,65 @@ | ||
/* | ||
* Jailhouse AArch64 support | ||
* | ||
* Copyright (C) 2015 Huawei Technologies Duesseldorf GmbH | ||
* | ||
* Authors: | ||
* Antonios Motakis <antonios.motakis@huawei.com> | ||
* | ||
* This work is licensed under the terms of the GNU GPL, version 2. See | ||
* the COPYING file in the top-level directory. | ||
*/ | ||
|
||
#include <asm/head.h> | ||
#include <asm/psci.h> | ||
|
||
.globl smc | ||
/* | ||
* Since we trap all SMC instructions, it may be useful to forward them | ||
* when it isn't a PSCI call. The shutdown code will also have to issue | ||
* a real PSCI_OFF call on secondary CPUs. | ||
*/ | ||
smc: | ||
smc #0 | ||
ret | ||
|
||
.global _psci_cpu_off | ||
/* x0: struct psci_mbox* */ | ||
_psci_cpu_off: | ||
ldr x2, =PSCI_INVALID_ADDRESS | ||
/* Clear mbox */ | ||
str x2, [x0] | ||
|
||
/* Wait for a CPU_ON call that updates the mbox */ | ||
1: wfe | ||
ldr x3, [x0] | ||
cmp x3, #PSCI_INVALID_ADDRESS | ||
b.eq 1b | ||
|
||
/* Jump to the requested entry, with a parameter */ | ||
ldr x0, [x0, #8] | ||
br x3 | ||
ret | ||
|
||
.global _psci_cpu_on | ||
/* x0: struct psci_mbox*, x1: entry, x2: context */ | ||
_psci_cpu_on: | ||
1: ldxp x4, x5, [x0] | ||
cmp x4, #PSCI_INVALID_ADDRESS | ||
b.ne store_failed | ||
stxp w7, x1, x2, [x0] | ||
cbnz w7, 1b | ||
|
||
dsb ishst | ||
sev | ||
|
||
mov x0, #0 | ||
ret | ||
|
||
store_failed: | ||
mov x0, #PSCI_ALREADY_ON | ||
ret | ||
|
||
.global _psci_suspend_return | ||
_psci_suspend_return: | ||
ret |
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