git: 4f0b47708003 - releng/15.0 - arm64/vmm: Fix handling of MDCR_EL2.TDE
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 16 Nov 2025 02:00:46 UTC
The branch releng/15.0 has been updated by cperciva:
URL: https://cgit.FreeBSD.org/src/commit/?id=4f0b47708003201f01dbe98da022970441716257
commit 4f0b47708003201f01dbe98da022970441716257
Author: Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2025-11-12 15:19:07 +0000
Commit: Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2025-11-16 02:00:36 +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.
Approved by: re (cperciva)
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)
(cherry picked from commit 295f7255a3917dd7e176c2fcb1034d629df0ac08)
---
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: