[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.
This commit is contained in:
Peter Collingbourne
2022-03-30 11:46:03 -07:00
committed by Travis Geiselbrecht
parent 894a580b5f
commit 4a15661ee0
3 changed files with 27 additions and 2 deletions

View File

@@ -12,10 +12,18 @@
/* used to call into PSCI firmware (Power State Coordination Firmware) */
FUNCTION(psci_call)
hvc #0
#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