Skip to content

Commit

Permalink
KVM: arm64: Add some more comments in kvm_hyp_handle_fpsimd()
Browse files Browse the repository at this point in the history
The handling for FPSIMD/SVE traps is multi stage and involves some trap
manipulation which isn't quite so immediately obvious as might be desired
so add a few more comments.

Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20220124155720.3943374-3-broonie@kernel.org
  • Loading branch information
broonie authored and Marc Zyngier committed Feb 8, 2022
1 parent 23afc82 commit 01a244d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions arch/arm64/kvm/hyp/include/hyp/switch.h
Expand Up @@ -173,6 +173,8 @@ static bool kvm_hyp_handle_fpsimd(struct kvm_vcpu *vcpu, u64 *exit_code)
return false;

/* Valid trap. Switch the context: */

/* First disable enough traps to allow us to update the registers */
if (has_vhe()) {
reg = CPACR_EL1_FPEN;
if (sve_guest)
Expand All @@ -188,11 +190,13 @@ static bool kvm_hyp_handle_fpsimd(struct kvm_vcpu *vcpu, u64 *exit_code)
}
isb();

/* Write out the host state if it's in the registers */
if (vcpu->arch.flags & KVM_ARM64_FP_HOST) {
__fpsimd_save_state(vcpu->arch.host_fpsimd_state);
vcpu->arch.flags &= ~KVM_ARM64_FP_HOST;
}

/* Restore the guest state */
if (sve_guest)
__hyp_sve_restore_guest(vcpu);
else
Expand Down

0 comments on commit 01a244d

Please sign in to comment.