]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
KVM: arm64: Account for RESx bits in __compute_fgt()
authorMarc Zyngier <maz@kernel.org>
Wed, 1 Apr 2026 10:36:00 +0000 (11:36 +0100)
committerMarc Zyngier <maz@kernel.org>
Wed, 1 Apr 2026 14:42:26 +0000 (15:42 +0100)
When computing Fine Grained Traps, it is preferable to account for
the reserved bits. The HW will most probably ignore them, unless the
bits have been repurposed to do something else.

Use caution, and fold our view of the reserved bits in,

Reviewed-by: Sascha Bischoff <sascha.bischoff@arm.com>
Fixes: c259d763e6b09 ("KVM: arm64: Account for RES1 bits in DECLARE_FEAT_MAP() and co")
Link: https://sashiko.dev/#/patchset/20260319154937.3619520-1-sascha.bischoff%40arm.com
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20260401103611.357092-6-maz@kernel.org
Signed-off-by: Marc Zyngier <maz@kernel.org>
arch/arm64/kvm/config.c

index e14685343191b2dde1810a4627fad4e12a0aca0d..f35b8dddd7c1f442e55b91a9485eb1fb466d6ace 100644 (file)
@@ -1663,8 +1663,8 @@ static __always_inline void __compute_fgt(struct kvm_vcpu *vcpu, enum vcpu_sysre
                clear |= ~nested & m->nmask;
        }
 
-       val |= set;
-       val &= ~clear;
+       val |= set | m->res1;
+       val &= ~(clear | m->res0);
        *vcpu_fgt(vcpu, reg) = val;
 }