File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -631,3 +631,30 @@ static int kvm_handle_write_fault(struct kvm_vcpu *vcpu)
631
631
{
632
632
return kvm_handle_rdwr_fault (vcpu , true);
633
633
}
634
+
635
+ /**
636
+ * kvm_handle_fpu_disabled() - Guest used fpu however it is disabled at host
637
+ * @vcpu: Virtual CPU context.
638
+ *
639
+ * Handle when the guest attempts to use fpu which hasn't been allowed
640
+ * by the root context.
641
+ */
642
+ static int kvm_handle_fpu_disabled (struct kvm_vcpu * vcpu )
643
+ {
644
+ struct kvm_run * run = vcpu -> run ;
645
+
646
+ /*
647
+ * If guest FPU not present, the FPU operation should have been
648
+ * treated as a reserved instruction!
649
+ * If FPU already in use, we shouldn't get this at all.
650
+ */
651
+ if (WARN_ON (vcpu -> arch .aux_inuse & KVM_LARCH_FPU )) {
652
+ kvm_err ("%s internal error\n" , __func__ );
653
+ run -> exit_reason = KVM_EXIT_INTERNAL_ERROR ;
654
+ return RESUME_HOST ;
655
+ }
656
+
657
+ kvm_own_fpu (vcpu );
658
+
659
+ return RESUME_GUEST ;
660
+ }
You can’t perform that action at this time.
0 commit comments