git: 4161f141aa79 - stable/14 - arm64: Add register definitions for MDCR_EL2

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Fri, 08 Dec 2023 14:24:03 UTC
The branch stable/14 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=4161f141aa798a90da77daacf7c5425a2b99f9b8

commit 4161f141aa798a90da77daacf7c5425a2b99f9b8
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2023-12-01 18:28:58 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2023-12-08 14:23:52 +0000

    arm64: Add register definitions for MDCR_EL2
    
    This is needed to support the bhyve gdb stub implementation on arm64.
    
    Reviewed by:    andrew
    MFC after:      1 week
    Sponsored by:   Innovate UK
    Differential Revision:  https://reviews.freebsd.org/D42867
    
    (cherry picked from commit 4f12883c360dbb03562f11713e711e3a3a330a0f)
---
 sys/arm64/include/hypervisor.h | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/sys/arm64/include/hypervisor.h b/sys/arm64/include/hypervisor.h
index 109169601c83..589d6e9cbdbe 100644
--- a/sys/arm64/include/hypervisor.h
+++ b/sys/arm64/include/hypervisor.h
@@ -232,4 +232,22 @@
 /* Assumed to be 0 by locore.S */
 #define	VTTBR_HOST		0x0000000000000000
 
+/* MDCR_EL2 - Hyp Debug Control Register */
+#define	MDCR_EL2_HPMN_MASK	0x1f
+#define	MDCR_EL2_HPMN_SHIFT	0
+#define	MDCR_EL2_TPMCR_SHIFT	5
+#define	MDCR_EL2_TPMCR		(0x1UL << MDCR_EL2_TPMCR_SHIFT)
+#define	MDCR_EL2_TPM_SHIFT	6
+#define	MDCR_EL2_TPM		(0x1UL << MDCR_EL2_TPM_SHIFT)
+#define	MDCR_EL2_HPME_SHIFT	7
+#define	MDCR_EL2_HPME		(0x1UL << MDCR_EL2_HPME_SHIFT)
+#define	MDCR_EL2_TDE_SHIFT	8
+#define	MDCR_EL2_TDE		(0x1UL << MDCR_EL2_TDE_SHIFT)
+#define	MDCR_EL2_TDA_SHIFT	9
+#define	MDCR_EL2_TDA		(0x1UL << MDCR_EL2_TDA_SHIFT)
+#define	MDCR_EL2_TDOSA_SHIFT	10
+#define	MDCR_EL2_TDOSA		(0x1UL << MDCR_EL2_TDOSA_SHIFT)
+#define	MDCR_EL2_TDRA_SHIFT	11
+#define	MDCR_EL2_TDRA		(0x1UL << MDCR_EL2_TDRA_SHIFT)
+
 #endif /* !_MACHINE_HYPERVISOR_H_ */