The host vcpu is not 32-bit so this will be skipped but 32-bit guests will save this state. Signed-off-by: Andrew Scull <ascull@xxxxxxxxxx> --- arch/arm64/kvm/hyp/include/hyp/switch.h | 3 +++ arch/arm64/kvm/hyp/nvhe/switch.c | 5 ++--- arch/arm64/kvm/hyp/vhe/switch.c | 3 +-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/arch/arm64/kvm/hyp/include/hyp/switch.h b/arch/arm64/kvm/hyp/include/hyp/switch.h index 4b1e51b8bb82..18a8ecc2e3a6 100644 --- a/arch/arm64/kvm/hyp/include/hyp/switch.h +++ b/arch/arm64/kvm/hyp/include/hyp/switch.h @@ -52,6 +52,9 @@ static inline bool update_fp_enabled(struct kvm_vcpu *vcpu) /* Save the 32-bit only FPSIMD system register state */ static inline void __fpsimd_save_fpexc32(struct kvm_vcpu *vcpu) { + if (!(vcpu->arch.flags & KVM_ARM64_FP_ENABLED)) + return; + if (!vcpu_el1_is_32bit(vcpu)) return; diff --git a/arch/arm64/kvm/hyp/nvhe/switch.c b/arch/arm64/kvm/hyp/nvhe/switch.c index eb10579174f2..7fdf1a9ab47e 100644 --- a/arch/arm64/kvm/hyp/nvhe/switch.c +++ b/arch/arm64/kvm/hyp/nvhe/switch.c @@ -192,9 +192,6 @@ static void __kvm_vcpu_switch_to_host(struct kvm_vcpu *host_vcpu, __sysreg_restore_state_nvhe(&host_vcpu->arch.ctxt); - if (vcpu->arch.flags & KVM_ARM64_FP_ENABLED) - __fpsimd_save_fpexc32(vcpu); - /* * This must come after restoring the host sysregs, since a non-VHE * system may enable SPE here and make use of the TTBRs. @@ -213,6 +210,8 @@ static void __vcpu_save_state(struct kvm_vcpu *vcpu) __sysreg_save_state_nvhe(&vcpu->arch.ctxt); __sysreg32_save_state(vcpu); __hyp_vgic_save_state(vcpu); + + __fpsimd_save_fpexc32(vcpu); } static void __vcpu_restore_state(struct kvm_vcpu *vcpu) diff --git a/arch/arm64/kvm/hyp/vhe/switch.c b/arch/arm64/kvm/hyp/vhe/switch.c index daf40004e93d..3c475cc83a2d 100644 --- a/arch/arm64/kvm/hyp/vhe/switch.c +++ b/arch/arm64/kvm/hyp/vhe/switch.c @@ -148,8 +148,7 @@ static int __kvm_vcpu_run_vhe(struct kvm_vcpu *vcpu) sysreg_restore_host_state_vhe(host_ctxt); - if (vcpu->arch.flags & KVM_ARM64_FP_ENABLED) - __fpsimd_save_fpexc32(vcpu); + __fpsimd_save_fpexc32(vcpu); __debug_switch_to_host(vcpu); -- 2.27.0.389.gc38d7665816-goog _______________________________________________ kvmarm mailing list kvmarm@xxxxxxxxxxxxxxxxxxxxx https://lists.cs.columbia.edu/mailman/listinfo/kvmarm