Files
lk/platform/qemu-virt-arm/secondary_boot.S
Peter Collingbourne 4a15661ee0 [arch][arm64] use SMC when booted at EL2 in QEMU
If we were booted at EL2 (e.g. when passing -machine
virt,virtualization=on), we need to use SMC instead of HVC for PSCI
calls. Change psci_call() to do this and add a flag to do-qemuarm to
allow testing this scenario.
2022-04-19 18:32:12 -07:00

32 lines
635 B
ArmAsm

/*
* Copyright (c) 2014 Travis Geiselbrecht
*
* Use of this source code is governed by a MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT
*/
#include <lk/asm.h>
.section .text
/* used to call into PSCI firmware (Power State Coordination Firmware) */
FUNCTION(psci_call)
#if ARCH_ARM
hvc #0
bx lr
#else
/* If booted at EL2 (bit 3 set of boot EL), we need to use SMC instead of HVC. */
adrp x9, arm64_boot_el
ldr x9, [x9, #:lo12:arm64_boot_el]
tbnz x9, #3, .Lsmc
hvc #0
ret
.Lsmc:
smc #0
ret
#endif
.ltorg