]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
KVM: arm64: Force trap of GMID_EL1 when the guest doesn't have MTE
authorMarc Zyngier <maz@kernel.org>
Thu, 8 Jan 2026 17:32:30 +0000 (17:32 +0000)
committerMarc Zyngier <maz@kernel.org>
Thu, 15 Jan 2026 11:58:57 +0000 (11:58 +0000)
If our host has MTE, but the guest doesn't, make sure we set HCR_EL2.TID5
to force GMID_EL1 being trapped. Such trap will be handled by the
FEAT_IDST handling.

Reviewed-by: Joey Gouly <joey.gouly@arm.com>
Reviewed-by: Yuan Yao <yaoyuan@linux.alibaba.com>
Link: https://patch.msgid.link/20260108173233.2911955-7-maz@kernel.org
Signed-off-by: Marc Zyngier <maz@kernel.org>
arch/arm64/kvm/sys_regs.c

index a2b14ca2a702bb037a4a03fdce0680e643e0d8b7..3de206b49484911b9e87b0523383dcb134b669fb 100644 (file)
@@ -5576,6 +5576,8 @@ static void vcpu_set_hcr(struct kvm_vcpu *vcpu)
 
        if (kvm_has_mte(vcpu->kvm))
                vcpu->arch.hcr_el2 |= HCR_ATA;
+       else
+               vcpu->arch.hcr_el2 |= HCR_TID5;
 
        /*
         * In the absence of FGT, we cannot independently trap TLBI