git: 0e0576700fbe - main - arm64: Only set HCR_EL2.E2H when VHE is supported

From: Andrew Turner <andrew_at_FreeBSD.org>
Date: Wed, 02 Jul 2025 10:02:24 UTC
The branch main has been updated by andrew:

URL: https://cgit.FreeBSD.org/src/commit/?id=0e0576700fbeb7c765095132a43410d3e35c1a80

commit 0e0576700fbeb7c765095132a43410d3e35c1a80
Author:     Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2025-07-02 09:49:24 +0000
Commit:     Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2025-07-02 09:49:24 +0000

    arm64: Only set HCR_EL2.E2H when VHE is supported
    
    When VHE isn't implemented then the HCR_EL2.E2H field should be 0. Move
    setting it to the VHE path of the early boot code so it is only set
    when supported.
    
    Sponsored by:   Arm Ltd
    Differential Revision:  https://reviews.freebsd.org/D51103
---
 sys/arm64/arm64/locore.S | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/sys/arm64/arm64/locore.S b/sys/arm64/arm64/locore.S
index 3c75feaa685b..bb323dbafd85 100644
--- a/sys/arm64/arm64/locore.S
+++ b/sys/arm64/arm64/locore.S
@@ -354,7 +354,7 @@ LENTRY(enter_kernel_el)
 	isb
 
 	/* Configure the Hypervisor */
-	ldr	x2, =(HCR_RW | HCR_APK | HCR_API | HCR_E2H)
+	ldr	x2, =(HCR_RW | HCR_APK | HCR_API)
 	msr	hcr_el2, x2
 
 	/* Stash value of HCR_EL2 for later */
@@ -380,7 +380,8 @@ LENTRY(enter_kernel_el)
 	 * The kernel will be running in EL2, route exceptions here rather
 	 * than EL1.
 	 */
-	orr	x4, x4, #(HCR_TGE)
+	orr	x4, x4, #HCR_E2H
+	orr	x4, x4, #HCR_TGE
 	msr	hcr_el2, x4
 	isb