aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Turner <andrew@FreeBSD.org>2022-11-15 12:53:28 +0000
committerAndrew Turner <andrew@FreeBSD.org>2022-11-15 17:26:52 +0000
commitae43a817d33db3aa51f6dfce8dd940f06716e2a9 (patch)
treedb198aadafddca016709cbfcf030226906930361
parent80ba994bfacd8a843af4eb9cb7558b62e8de26ee (diff)
-rw-r--r--sys/arm64/arm64/locore.S3
-rw-r--r--sys/arm64/include/hypervisor.h1
2 files changed, 4 insertions, 0 deletions
diff --git a/sys/arm64/arm64/locore.S b/sys/arm64/arm64/locore.S
index 059b6fd0fe1c..3b4f2ccc5353 100644
--- a/sys/arm64/arm64/locore.S
+++ b/sys/arm64/arm64/locore.S
@@ -295,6 +295,9 @@ LENTRY(drop_to_el1)
add x2, x2, :lo12:hyp_vectors
msr vbar_el2, x2
+ /* Zero vttbr_el2 so a hypervisor can tell the host and guest apart */
+ msr vttbr_el2, xzr
+
mov x2, #(PSR_F | PSR_I | PSR_A | PSR_D | PSR_M_EL1h)
msr spsr_el2, x2
diff --git a/sys/arm64/include/hypervisor.h b/sys/arm64/include/hypervisor.h
index f209ecde120a..dc6ccbfe20a9 100644
--- a/sys/arm64/include/hypervisor.h
+++ b/sys/arm64/include/hypervisor.h
@@ -199,6 +199,7 @@
/* VTTBR_EL2 - Virtualization Translation Table Base Register */
#define VTTBR_VMID_MASK 0xffff000000000000
#define VTTBR_VMID_SHIFT 48
+/* Assumed to be 0 by locore.S */
#define VTTBR_HOST 0x0000000000000000
#endif /* !_MACHINE_HYPERVISOR_H_ */