]> xenbits.xensource.com Git - people/pauldu/linux.git/commitdiff
KVM: arm64: Save guest's ZCR_EL1 before saving the FPSIMD state
authorMarc Zyngier <maz@kernel.org>
Fri, 12 Mar 2021 14:30:52 +0000 (14:30 +0000)
committerMarc Zyngier <maz@kernel.org>
Thu, 18 Mar 2021 13:57:54 +0000 (13:57 +0000)
Make sure the guest's ZCR_EL1 is saved before we save/flush the
state. This will be useful in later patches.

Acked-by: Will Deacon <will@kernel.org>
Signed-off-by: Marc Zyngier <maz@kernel.org>
arch/arm64/kvm/fpsimd.c

index 3c37a419fa82e339eaa7383d1b60393fb4d9b50d..14ea05c5134ab1d2de606b0734d8854808975c89 100644 (file)
@@ -121,10 +121,10 @@ void kvm_arch_vcpu_put_fp(struct kvm_vcpu *vcpu)
        local_irq_save(flags);
 
        if (vcpu->arch.flags & KVM_ARM64_FP_ENABLED) {
-               fpsimd_save_and_flush_cpu_state();
-
                if (guest_has_sve)
                        __vcpu_sys_reg(vcpu, ZCR_EL1) = read_sysreg_el1(SYS_ZCR);
+
+               fpsimd_save_and_flush_cpu_state();
        } else if (host_has_sve) {
                /*
                 * The FPSIMD/SVE state in the CPU has not been touched, and we