]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
KVM: arm64: Enable SCTLR2 when advertised to the guest
authorOliver Upton <oliver.upton@linux.dev>
Tue, 8 Jul 2025 17:25:18 +0000 (10:25 -0700)
committerOliver Upton <oliver.upton@linux.dev>
Tue, 8 Jul 2025 18:36:35 +0000 (11:36 -0700)
HCRX_EL2.SCTLR2En needs to be set for SCTLR2_EL1 to take effect in
hardware (in addition to disabling traps).

Reviewed-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20250708172532.1699409-14-oliver.upton@linux.dev
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
arch/arm64/include/asm/kvm_emulate.h

index 1ff52e66514cf1631a3b4123062b5faf70ad39df..71ecdc20523eee5a37381b49ebd5af7afae1e365 100644 (file)
@@ -665,6 +665,9 @@ static inline void vcpu_set_hcrx(struct kvm_vcpu *vcpu)
 
                if (kvm_has_fpmr(kvm))
                        vcpu->arch.hcrx_el2 |= HCRX_EL2_EnFPM;
+
+               if (kvm_has_sctlr2(kvm))
+                       vcpu->arch.hcrx_el2 |= HCRX_EL2_SCTLR2En;
        }
 }
 #endif /* __ARM64_KVM_EMULATE_H__ */