]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
KVM: arm64: Fix Trace Buffer trapping for protected VMs
authorFuad Tabba <tabba@google.com>
Thu, 11 Dec 2025 10:47:01 +0000 (10:47 +0000)
committerMarc Zyngier <maz@kernel.org>
Thu, 15 Jan 2026 15:42:18 +0000 (15:42 +0000)
For protected VMs in pKVM, the hypervisor should trap accesses to trace
buffer system registers if Trace Buffer isn't supported by the VM.
However, the current code only traps if Trace Buffer External Mode isn't
supported.

Fix this by checking for FEAT_TRBE (Trace Buffer) rather than
FEAT_TRBE_EXT.

Fixes: 9d5261269098 ("KVM: arm64: Trap external trace for protected VMs")
Reported-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Fuad Tabba <tabba@google.com>
Link: https://patch.msgid.link/20251211104710.151771-2-tabba@google.com
Signed-off-by: Marc Zyngier <maz@kernel.org>
arch/arm64/kvm/hyp/nvhe/pkvm.c

index 8911338961c5b19926ed6d323b2c1043c1c9cf12..f0bfab99c334151b9ba3c71962d1243cfe3d9e40 100644 (file)
@@ -117,7 +117,7 @@ static void pvm_init_traps_mdcr(struct kvm_vcpu *vcpu)
        if (!kvm_has_feat(kvm, ID_AA64DFR0_EL1, TraceFilt, IMP))
                val |= MDCR_EL2_TTRF;
 
-       if (!kvm_has_feat(kvm, ID_AA64DFR0_EL1, ExtTrcBuff, IMP))
+       if (!kvm_has_feat(kvm, ID_AA64DFR0_EL1, TraceBuffer, IMP))
                val |= MDCR_EL2_E2TB_MASK;
 
        /* Trap Debug Communications Channel registers */