aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kvm/booke.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/kvm/booke.c')
-rw-r--r--arch/powerpc/kvm/booke.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
index 17722d82f1d1..5133199f6cb7 100644
--- a/arch/powerpc/kvm/booke.c
+++ b/arch/powerpc/kvm/booke.c
@@ -656,9 +656,8 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
656{ 656{
657 int ret, s; 657 int ret, s;
658#ifdef CONFIG_PPC_FPU 658#ifdef CONFIG_PPC_FPU
659 unsigned int fpscr; 659 struct thread_fp_state fp;
660 int fpexc_mode; 660 int fpexc_mode;
661 u64 fpr[32];
662#endif 661#endif
663 662
664 if (!vcpu->arch.sane) { 663 if (!vcpu->arch.sane) {
@@ -677,13 +676,13 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
677#ifdef CONFIG_PPC_FPU 676#ifdef CONFIG_PPC_FPU
678 /* Save userspace FPU state in stack */ 677 /* Save userspace FPU state in stack */
679 enable_kernel_fp(); 678 enable_kernel_fp();
680 memcpy(fpr, current->thread.fpr, sizeof(current->thread.fpr)); 679 fp = current->thread.fp_state;
681 fpscr = current->thread.fpscr.val;
682 fpexc_mode = current->thread.fpexc_mode; 680 fpexc_mode = current->thread.fpexc_mode;
683 681
684 /* Restore guest FPU state to thread */ 682 /* Restore guest FPU state to thread */
685 memcpy(current->thread.fpr, vcpu->arch.fpr, sizeof(vcpu->arch.fpr)); 683 memcpy(current->thread.fp_state.fpr, vcpu->arch.fpr,
686 current->thread.fpscr.val = vcpu->arch.fpscr; 684 sizeof(vcpu->arch.fpr));
685 current->thread.fp_state.fpscr = vcpu->arch.fpscr;
687 686
688 /* 687 /*
689 * Since we can't trap on MSR_FP in GS-mode, we consider the guest 688 * Since we can't trap on MSR_FP in GS-mode, we consider the guest
@@ -709,12 +708,12 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
709 vcpu->fpu_active = 0; 708 vcpu->fpu_active = 0;
710 709
711 /* Save guest FPU state from thread */ 710 /* Save guest FPU state from thread */
712 memcpy(vcpu->arch.fpr, current->thread.fpr, sizeof(vcpu->arch.fpr)); 711 memcpy(vcpu->arch.fpr, current->thread.fp_state.fpr,
713 vcpu->arch.fpscr = current->thread.fpscr.val; 712 sizeof(vcpu->arch.fpr));
713 vcpu->arch.fpscr = current->thread.fp_state.fpscr;
714 714
715 /* Restore userspace FPU state from stack */ 715 /* Restore userspace FPU state from stack */
716 memcpy(current->thread.fpr, fpr, sizeof(current->thread.fpr)); 716 current->thread.fp_state = fp;
717 current->thread.fpscr.val = fpscr;
718 current->thread.fpexc_mode = fpexc_mode; 717 current->thread.fpexc_mode = fpexc_mode;
719#endif 718#endif
720 719