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
This commit is contained in:
Andrew Turner
2026-02-03 17:14:26 +00:00
parent 4f82ce5191
commit 095a7871f4
2 changed files with 14 additions and 0 deletions
+2
View File
@@ -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[];
+12
View File
@@ -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)) {