]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
KVM: arm64: Enable FEAT_{LS64, LS64_V} in the supported guest
authorYicong Yang <yangyicong@hisilicon.com>
Mon, 19 Jan 2026 02:29:26 +0000 (10:29 +0800)
committerWill Deacon <will@kernel.org>
Thu, 22 Jan 2026 13:24:49 +0000 (13:24 +0000)
Using FEAT_{LS64, LS64_V} instructions in a guest is also controlled
by HCRX_EL2.{EnALS, EnASR}. Enable it if guest has related feature.

Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Oliver Upton <oupton@kernel.org>
Signed-off-by: Yicong Yang <yangyicong@hisilicon.com>
Signed-off-by: Zhou Wang <wangzhou1@hisilicon.com>
Signed-off-by: Will Deacon <will@kernel.org>
arch/arm64/include/asm/kvm_emulate.h

index bab967d657157f3b971b0ed1510cbc6436d6a370..29291e25ecfd08cbf5e77b385b881983ebd27868 100644 (file)
@@ -695,6 +695,12 @@ static inline void vcpu_set_hcrx(struct kvm_vcpu *vcpu)
 
                if (kvm_has_sctlr2(kvm))
                        vcpu->arch.hcrx_el2 |= HCRX_EL2_SCTLR2En;
+
+               if (kvm_has_feat(kvm, ID_AA64ISAR1_EL1, LS64, LS64))
+                       vcpu->arch.hcrx_el2 |= HCRX_EL2_EnALS;
+
+               if (kvm_has_feat(kvm, ID_AA64ISAR1_EL1, LS64, LS64_V))
+                       vcpu->arch.hcrx_el2 |= HCRX_EL2_EnASR;
        }
 }
 #endif /* __ARM64_KVM_EMULATE_H__ */