diff mbox series

[08/11] KVM: arm64: Conditionnaly enable FEAT_LS64* instructions

Message ID 20240815125959.2097734-9-maz@kernel.org (mailing list archive)
State New, archived
Headers show
Series KVM: arm64: Add support for FEAT_LS64 and co | expand

Commit Message

Marc Zyngier Aug. 15, 2024, 12:59 p.m. UTC
Enable the FEAT_LS64* features by setting the corresponding HCRX_EL2
bits in the vcpu context when these features are exposed to the guest.

The effective value programmed into the HW will change depending on
what a NV guest will program in its own HCRX_EL2 view.

Signed-off-by: Marc Zyngier <maz@kernel.org>
---
 arch/arm64/kvm/sys_regs.c | 9 +++++++++
 1 file changed, 9 insertions(+)
diff mbox series

Patch

diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c
index 39c2ee15dc0a..cfd1a1bb9675 100644
--- a/arch/arm64/kvm/sys_regs.c
+++ b/arch/arm64/kvm/sys_regs.c
@@ -4570,6 +4570,15 @@  void kvm_calculate_traps(struct kvm_vcpu *vcpu)
 
 		if (kvm_has_feat(kvm, ID_AA64MMFR3_EL1, TCRX, IMP))
 			vcpu->arch.hcrx_el2 |= HCRX_EL2_TCR2En;
+
+		if (kvm_has_feat(kvm, ID_AA64ISAR1_EL1, LS64, LS64_V))
+			vcpu->arch.hcrx_el2 |= HCRX_EL2_EnASR;
+
+		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_ACCDATA))
+			vcpu->arch.hcrx_el2 |= HCRX_EL2_EnAS0;
 	}
 
 	if (test_bit(KVM_ARCH_FLAG_FGU_INITIALIZED, &kvm->arch.flags))