summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFuad Tabba <tabba@google.com>2023-07-24 13:38:28 +0100
committerOliver Upton <oliver.upton@linux.dev>2023-07-26 17:08:30 +0000
commit7af0d5e50006614cbf313373df708df79d9f4657 (patch)
tree5fcd9b150aa806837b092cf024dd12fb34d25d0a
parenta9626099a51f697939d35983b92a9384a4c4a676 (diff)
downloadlinux-stable-7af0d5e50006614cbf313373df708df79d9f4657.tar.gz
linux-stable-7af0d5e50006614cbf313373df708df79d9f4657.tar.bz2
linux-stable-7af0d5e50006614cbf313373df708df79d9f4657.zip
KVM: arm64: Fix resetting SVE trap values on reset for hVHE
Ensure that SVE traps are disabled for hVHE, if the FPSIMD state isn't owned by the guest, when getting the reset value for the architectural feature control register. Fixes: 75c76ab5a641 ("KVM: arm64: Rework CPTR_EL2 programming for HVHE configuration") Signed-off-by: Fuad Tabba <tabba@google.com> Reviewed-by: Marc Zyngier <maz@kernel.org> Link: https://lore.kernel.org/r/20230724123829.2929609-8-tabba@google.com Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
-rw-r--r--arch/arm64/include/asm/kvm_emulate.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/arm64/include/asm/kvm_emulate.h b/arch/arm64/include/asm/kvm_emulate.h
index f5941f6dce49..adfb7d0ac55b 100644
--- a/arch/arm64/include/asm/kvm_emulate.h
+++ b/arch/arm64/include/asm/kvm_emulate.h
@@ -588,6 +588,10 @@ static __always_inline u64 kvm_get_reset_cptr_el2(struct kvm_vcpu *vcpu)
CPACR_EL1_ZEN_EL1EN);
} else if (has_hvhe()) {
val = (CPACR_EL1_FPEN_EL0EN | CPACR_EL1_FPEN_EL1EN);
+
+ if (!vcpu_has_sve(vcpu) ||
+ (vcpu->arch.fp_state != FP_STATE_GUEST_OWNED))
+ val |= CPACR_EL1_ZEN_EL1EN | CPACR_EL1_ZEN_EL0EN;
} else {
val = CPTR_NVHE_EL2_RES1;