aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Turner <andrew@FreeBSD.org>2026-02-03 17:14:26 +0000
committerAndrew Turner <andrew@FreeBSD.org>2026-02-03 17:14:26 +0000
commit095a7871f4320e7667a644e6e34a27e1f526b053 (patch)
tree3b601043e3affcedd8afa05b2a713259b73aec8c
parent4f82ce5191d550b875f7f760c83e05167728fe69 (diff)
arm64/vmm: Add HYP_FEAT_FGT{,2}
Add the macros and detection for Fine-grained traps (FEAT_FGT and FEAT_FGT2). Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D54686
-rw-r--r--sys/arm64/vmm/arm64.h2
-rw-r--r--sys/arm64/vmm/vmm_arm64.c12
2 files changed, 14 insertions, 0 deletions
diff --git a/sys/arm64/vmm/arm64.h b/sys/arm64/vmm/arm64.h
index f530dab05331..1b8762545925 100644
--- a/sys/arm64/vmm/arm64.h
+++ b/sys/arm64/vmm/arm64.h
@@ -131,6 +131,8 @@ struct hyp {
uint64_t feats; /* Which features are enabled */
#define HYP_FEAT_HCX (0x1ul << 0)
#define HYP_FEAT_ECV_POFF (0x1ul << 1)
+#define HYP_FEAT_FGT (0x1ul << 2)
+#define HYP_FEAT_FGT2 (0x1ul << 3)
bool vgic_attached;
struct vgic_v3 *vgic;
struct hypctx *ctx[];
diff --git a/sys/arm64/vmm/vmm_arm64.c b/sys/arm64/vmm/vmm_arm64.c
index d529f000b828..6643d32684d8 100644
--- a/sys/arm64/vmm/vmm_arm64.c
+++ b/sys/arm64/vmm/vmm_arm64.c
@@ -525,6 +525,18 @@ vmmops_init(struct vm *vm, pmap_t pmap)
if (get_kernel_reg(ID_AA64MMFR0_EL1, &idreg)) {
if (ID_AA64MMFR0_ECV_VAL(idreg) >= ID_AA64MMFR0_ECV_POFF)
hyp->feats |= HYP_FEAT_ECV_POFF;
+
+ switch (ID_AA64MMFR0_FGT_VAL(idreg)) {
+ case ID_AA64MMFR0_FGT_NONE:
+ break;
+ default:
+ case ID_AA64MMFR0_FGT_8_9:
+ hyp->feats |= HYP_FEAT_FGT2;
+ /* FALLTHROUGH */
+ case ID_AA64MMFR0_FGT_8_6:
+ hyp->feats |= HYP_FEAT_FGT;
+ break;
+ }
}
if (get_kernel_reg(ID_AA64MMFR1_EL1, &idreg)) {