Module Name: src
Committed By: jmcneill
Date: Mon Aug 30 22:31:20 UTC 2021
Modified Files:
src/sys/arch/aarch64/aarch64: locore_el2.S
Log Message:
If we start in EL2 mode and the CPU supports EL2 host mode, don't bother
dropping to EL1 and just run the kernel in EL2 instead.
To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/aarch64/aarch64/locore_el2.S
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/aarch64/aarch64/locore_el2.S
diff -u src/sys/arch/aarch64/aarch64/locore_el2.S:1.8 src/sys/arch/aarch64/aarch64/locore_el2.S:1.9
--- src/sys/arch/aarch64/aarch64/locore_el2.S:1.8 Sat Dec 26 00:55:26 2020
+++ src/sys/arch/aarch64/aarch64/locore_el2.S Mon Aug 30 22:31:20 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: locore_el2.S,v 1.8 2020/12/26 00:55:26 jmcneill Exp $ */
+/* $NetBSD: locore_el2.S,v 1.9 2021/08/30 22:31:20 jmcneill Exp $ */
/*-
* Copyright (c) 2012-2014 Andrew Turner
@@ -32,7 +32,7 @@
#include <aarch64/hypervisor.h>
#include "assym.h"
-RCSID("$NetBSD: locore_el2.S,v 1.8 2020/12/26 00:55:26 jmcneill Exp $")
+RCSID("$NetBSD: locore_el2.S,v 1.9 2021/08/30 22:31:20 jmcneill Exp $")
/*
* For use in #include "locore_el2.S".
@@ -61,6 +61,14 @@ drop_to_el1:
ret
in_el2:
+ /* Check for EL2 host mode */
+ mrs x2, hcr_el2
+ tbz x2, #34, no_el2_host_mode /* HCR_E2H not set? */
+
+ /* EL2 host mode supported, nothing to do, leave. */
+ ret
+
+no_el2_host_mode:
/* EL1 will be AArch64. */
mov x2, #(HCR_RW)
msr hcr_el2, x2