]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
KVM: arm64: nv: Return correct RES0 bits for FGT registers
authorZenghui Yu (Huawei) <zenghui.yu@linux.dev>
Wed, 21 Jan 2026 10:16:31 +0000 (18:16 +0800)
committerMarc Zyngier <maz@kernel.org>
Thu, 22 Jan 2026 09:09:50 +0000 (09:09 +0000)
We had extended the sysreg masking infrastructure to more general
registers, instead of restricting it to VNCR-backed registers, since
commit a0162020095e ("KVM: arm64: Extend masking facility to arbitrary
registers"). Fix kvm_get_sysreg_res0() to reflect this fact.

Note that we're sure that we only deal with FGT registers in
kvm_get_sysreg_res0(), the

if (sr < __VNCR_START__)

is actually a never false, which should probably be removed later.

Fixes: 69c19e047dfe ("KVM: arm64: Add TCR2_EL2 to the sysreg arrays")
Signed-off-by: Zenghui Yu (Huawei) <zenghui.yu@linux.dev>
Link: https://patch.msgid.link/20260121101631.41037-1-zenghui.yu@linux.dev
Signed-off-by: Marc Zyngier <maz@kernel.org>
Cc: stable@vger.kernel.org
arch/arm64/kvm/emulate-nested.c

index e5874effdf16712b821fa34c2e7e0241c3304a7a..774cfbf5b43baa1621a316e61cad2105e6c5722f 100644 (file)
@@ -2435,7 +2435,7 @@ static u64 kvm_get_sysreg_res0(struct kvm *kvm, enum vcpu_sysreg sr)
 
        masks = kvm->arch.sysreg_masks;
 
-       return masks->mask[sr - __VNCR_START__].res0;
+       return masks->mask[sr - __SANITISED_REG_START__].res0;
 }
 
 static bool check_fgt_bit(struct kvm_vcpu *vcpu, enum vcpu_sysreg sr,