Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/aarch64/aarch64 If we start in EL2 mode and the CPU...



details:   https://anonhg.NetBSD.org/src/rev/cc7332168671
branches:  trunk
changeset: 985581:cc7332168671
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Mon Aug 30 22:31:20 2021 +0000

description:
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.

diffstat:

 sys/arch/aarch64/aarch64/locore_el2.S |  12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diffs (33 lines):

diff -r 8674aca90599 -r cc7332168671 sys/arch/aarch64/aarch64/locore_el2.S
--- a/sys/arch/aarch64/aarch64/locore_el2.S     Mon Aug 30 22:28:50 2021 +0000
+++ b/sys/arch/aarch64/aarch64/locore_el2.S     Mon Aug 30 22:31:20 2021 +0000
@@ -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 @@
        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



Home | Main Index | Thread Index | Old Index