MIPS: KVM: Add missing disable FPU hazard barriers
authorJames Hogan <james.hogan@imgtec.com>
Fri, 22 Apr 2016 09:38:49 +0000 (10:38 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 10 May 2016 13:56:52 +0000 (15:56 +0200)
Add the necessary hazard barriers after disabling the FPU in
kvm_lose_fpu(), just to be safe.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: "Radim KrÄ\8dmář" <rkrcmar@redhat.com>
Cc: linux-mips@linux-mips.org
Cc: kvm@vger.kernel.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/mips/kvm/mips.c

index ec3fe09ef15cad438bd80bb9d1a4c4b97b6b6d72..23b20946323899ef20142184c08e8c5dde20784d 100644 (file)
@@ -1556,8 +1556,10 @@ void kvm_lose_fpu(struct kvm_vcpu *vcpu)
 
                /* Disable MSA & FPU */
                disable_msa();
-               if (vcpu->arch.fpu_inuse & KVM_MIPS_FPU_FPU)
+               if (vcpu->arch.fpu_inuse & KVM_MIPS_FPU_FPU) {
                        clear_c0_status(ST0_CU1 | ST0_FR);
+                       disable_fpu_hazard();
+               }
                vcpu->arch.fpu_inuse &= ~(KVM_MIPS_FPU_FPU | KVM_MIPS_FPU_MSA);
        } else if (vcpu->arch.fpu_inuse & KVM_MIPS_FPU_FPU) {
                set_c0_status(ST0_CU1);
@@ -1568,6 +1570,7 @@ void kvm_lose_fpu(struct kvm_vcpu *vcpu)
 
                /* Disable FPU */
                clear_c0_status(ST0_CU1 | ST0_FR);
+               disable_fpu_hazard();
        }
        preempt_enable();
 }