git: 4f12883c360d - main - arm64: Add register definitions for MDCR_EL2

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Fri, 01 Dec 2023 18:35:19 UTC
The branch main has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=4f12883c360dbb03562f11713e711e3a3a330a0f

commit 4f12883c360dbb03562f11713e711e3a3a330a0f
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2023-12-01 18:28:58 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2023-12-01 18:31:13 +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
---
 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_ */