git: 295f7255a391 - stable/15 - arm64/vmm: Fix handling of MDCR_EL2.TDE
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 15 Nov 2025 17:42:32 UTC
The branch stable/15 has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=295f7255a3917dd7e176c2fcb1034d629df0ac08
commit 295f7255a3917dd7e176c2fcb1034d629df0ac08
Author: Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2025-11-12 15:19:07 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2025-11-15 17:42:16 +0000
arm64/vmm: Fix handling of MDCR_EL2.TDE
TDE (make EL2 the target EL for debug exceptions) is set both when
setting guest breakpoints and when single-stepping the guest. In some
cases we may configure both capabilities, and when subsequently
disabling one of them we need to take care to avoid clearing TDE if the
other is still configured.
MFC after: 3 days
Fixes: 75cb949228bb ("arm64/vmm: Add breakpoint and single-stepping support")
Sponsored by: CHERI Research Centre (EPSRC grant UKRI3001)
(cherry picked from commit b6f25aca11c98acc49f111f2899ecd4e96c7debd)
---
sys/arm64/vmm/vmm_arm64.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/sys/arm64/vmm/vmm_arm64.c b/sys/arm64/vmm/vmm_arm64.c
index 5bb038dec2d3..e4deb052d396 100644
--- a/sys/arm64/vmm/vmm_arm64.c
+++ b/sys/arm64/vmm/vmm_arm64.c
@@ -1356,7 +1356,7 @@ vmmops_setcap(void *vcpui, int num, int val)
break;
if (val != 0)
hypctx->mdcr_el2 |= MDCR_EL2_TDE;
- else
+ else if ((hypctx->setcaps & (1ul << VM_CAP_SS_EXIT)) == 0)
hypctx->mdcr_el2 &= ~MDCR_EL2_TDE;
break;
case VM_CAP_SS_EXIT:
@@ -1377,7 +1377,8 @@ vmmops_setcap(void *vcpui, int num, int val)
hypctx->mdscr_el1 &= ~MDSCR_SS;
hypctx->mdscr_el1 |= hypctx->debug_mdscr;
hypctx->debug_mdscr &= ~MDSCR_SS;
- hypctx->mdcr_el2 &= ~MDCR_EL2_TDE;
+ if ((hypctx->setcaps & (1ul << VM_CAP_BRK_EXIT)) == 0)
+ hypctx->mdcr_el2 &= ~MDCR_EL2_TDE;
}
break;
case VM_CAP_MASK_HWINTR: