git: 38ead08e27ad - main - arm64/vmm: Disable fine grained trapping of range-based TLBI instructions

From: Andrew Turner <andrew_at_FreeBSD.org>
Date: Wed, 04 Nov 2026 16:56:47 UTC
The branch main has been updated by andrew:

URL: https://cgit.FreeBSD.org/src/commit/?id=38ead08e27addad96223f7cc5b13f2863de2a6f6

commit 38ead08e27addad96223f7cc5b13f2863de2a6f6
Author:     Sarah Walker <sarah.walker2@arm.com>
AuthorDate: 2026-10-01 10:19:53 +0000
Commit:     Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2026-11-04 14:56:40 +0000

    arm64/vmm: Disable fine grained trapping of range-based TLBI instructions
    
    vmm passes the FEAT_TLBIRANGE field of ID_AA64ISAR0_EL1 to the guest, but also
    enables fine-grained traps in the range-based TLBI instructions. This didn't
    cause a problem until commit 5549785
    ("arm64 pmap: use range-based TLBI instructions"); following this commit, the VM
    will exit with VM_EXITCODE_REG_EMUL during boot if the host supports FEAT_FGT and
    FEAT_TLBIRANGE.
    
    This commit disables fine-grained trapping of these instructions.
    
    Reviewed by:    andrew
    Sponsored by:   Arm Ltd
    Pull Request:   https://reviews.freebsd.org/D60196
---
 sys/arm64/vmm/vmm_reset.c | 36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/sys/arm64/vmm/vmm_reset.c b/sys/arm64/vmm/vmm_reset.c
index 4e7b6a7e160f..abaaa81b7e99 100644
--- a/sys/arm64/vmm/vmm_reset.c
+++ b/sys/arm64/vmm/vmm_reset.c
@@ -511,30 +511,30 @@ reset_vm_el2_regs(void *vcpu)
 
 		/* FEAT_TLBIRANGE */
 		*hypctx_sys_reg(el2ctx, HOST_HFGITR_EL2) |=
-		    HFGITR_EL2_TLBIRVAALE1_TRAP |
-		    HFGITR_EL2_TLBIRVALE1_TRAP |
-		    HFGITR_EL2_TLBIRVAAE1_TRAP |
-		    HFGITR_EL2_TLBIRVAE1_TRAP |
-		    HFGITR_EL2_TLBIRVAALE1IS_TRAP |
-		    HFGITR_EL2_TLBIRVALE1IS_TRAP |
-		    HFGITR_EL2_TLBIRVAAE1IS_TRAP |
-		    HFGITR_EL2_TLBIRVAE1IS_TRAP;
+		    HFGITR_EL2_TLBIRVAALE1_NOTRAP |
+		    HFGITR_EL2_TLBIRVALE1_NOTRAP |
+		    HFGITR_EL2_TLBIRVAAE1_NOTRAP |
+		    HFGITR_EL2_TLBIRVAE1_NOTRAP |
+		    HFGITR_EL2_TLBIRVAALE1IS_NOTRAP |
+		    HFGITR_EL2_TLBIRVALE1IS_NOTRAP |
+		    HFGITR_EL2_TLBIRVAAE1IS_NOTRAP |
+		    HFGITR_EL2_TLBIRVAE1IS_NOTRAP;
 
 		/* FEAT_TLBIRANGE && FEAT_TLBIOS */
 		*hypctx_sys_reg(el2ctx, HOST_HFGITR_EL2) |=
-		    HFGITR_EL2_TLBIRVAALE1OS_TRAP |
-		    HFGITR_EL2_TLBIRVALE1OS_TRAP |
-		    HFGITR_EL2_TLBIRVAAE1OS_TRAP |
-		    HFGITR_EL2_TLBIRVAE1OS_TRAP;
+		    HFGITR_EL2_TLBIRVAALE1OS_NOTRAP |
+		    HFGITR_EL2_TLBIRVALE1OS_NOTRAP |
+		    HFGITR_EL2_TLBIRVAAE1OS_NOTRAP |
+		    HFGITR_EL2_TLBIRVAE1OS_NOTRAP;
 
 		/* FEAT_TLBIOS */
 		*hypctx_sys_reg(el2ctx, HOST_HFGITR_EL2) |=
-		    HFGITR_EL2_TLBIVAALE1OS_TRAP |
-		    HFGITR_EL2_TLBIVALE1OS_TRAP |
-		    HFGITR_EL2_TLBIVAAE1OS_TRAP |
-		    HFGITR_EL2_TLBIASIDE1OS_TRAP |
-		    HFGITR_EL2_TLBIVAE1OS_TRAP |
-		    HFGITR_EL2_TLBIVMALLE1OS_TRAP;
+		    HFGITR_EL2_TLBIVAALE1OS_NOTRAP |
+		    HFGITR_EL2_TLBIVALE1OS_NOTRAP |
+		    HFGITR_EL2_TLBIVAAE1OS_NOTRAP |
+		    HFGITR_EL2_TLBIASIDE1OS_NOTRAP |
+		    HFGITR_EL2_TLBIVAE1OS_NOTRAP |
+		    HFGITR_EL2_TLBIVMALLE1OS_NOTRAP;
 
 		/* FEAT_PAN2 */
 		*hypctx_sys_reg(el2ctx, HOST_HFGITR_EL2) |=