Skip to content

Commit d3b41b8

Browse files
committed
Merge: KVM: arm64: Eagerly switch ZCR_EL{1,2}
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/6863 JIRA: https://issues.redhat.com/browse/RHEL-87960 Brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=67597227 Upstream Status: v6.14 Tested: Passed, no stuck guest in 100 times of reboots The upstream commit 59419f1 ("KVM: arm64: Eagerly switch ZCR_EL{1,2}") was incompletely ported by downstream commit 939b186. This leads to CPTR_EL2 isn't properly saved and restored on vCPU entrance and exit. This amends the downstream commit so that the upstream commit is ported completely to avoid CPTR_EL2 lost on vCPU entrance and exit. The detailed changes can be seen from the conflict resolution section. Signed-off-by: Gavin Shan <gshan@redhat.com> Approved-by: Cornelia Huck <cohuck@redhat.com> Approved-by: Sebastian Ott <sebott@redhat.com> Approved-by: Mark Langsdorf <mlangsdo@redhat.com> Approved-by: Donald Dutile <ddutile@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Approved-by: Shaoqin Huang <shahuang@redhat.com> Merged-by: Augusto Caringi <acaringi@redhat.com>
2 parents 25b7bcf + 98526e5 commit d3b41b8

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

arch/arm64/include/asm/kvm_emulate.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -625,14 +625,14 @@ static __always_inline u64 kvm_get_reset_cptr_el2(struct kvm_vcpu *vcpu)
625625
} else if (has_hvhe()) {
626626
val = CPACR_ELx_FPEN;
627627

628-
if (!vcpu_has_sve(vcpu) || !guest_owns_fp_regs())
628+
if (cpus_have_final_cap(ARM64_SVE))
629629
val |= CPACR_ELx_ZEN;
630630
if (cpus_have_final_cap(ARM64_SME))
631631
val |= CPACR_ELx_SMEN;
632632
} else {
633633
val = CPTR_NVHE_EL2_RES1;
634634

635-
if (vcpu_has_sve(vcpu) && guest_owns_fp_regs())
635+
if (!cpus_have_final_cap(ARM64_SVE))
636636
val |= CPTR_EL2_TZ;
637637
if (!cpus_have_final_cap(ARM64_SME))
638638
val |= CPTR_EL2_TSM;

arch/arm64/kvm/hyp/nvhe/switch.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ static void __activate_cptr_traps(struct kvm_vcpu *vcpu)
6363
if (!guest_owns_fp_regs())
6464
val |= CPTR_EL2_TFP;
6565
}
66+
67+
if (!guest_owns_fp_regs())
68+
__activate_traps_fpsimd32(vcpu);
69+
70+
kvm_write_cptr_el2(val);
6671
}
6772

6873
static void __activate_traps(struct kvm_vcpu *vcpu)

0 commit comments

Comments
 (0)