booke.c (e3c55d406bd8df1a878546002c93db90c42be10c) | booke.c (de79f7b9f6f92ec1bd6f61fa1f20de60728a5b5e) |
---|---|
1/* 2 * This program is free software; you can redistribute it and/or modify 3 * it under the terms of the GNU General Public License, version 2, as 4 * published by the Free Software Foundation. 5 * 6 * This program is distributed in the hope that it will be useful, 7 * but WITHOUT ANY WARRANTY; without even the implied warranty of 8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- 642 unchanged lines hidden (view full) --- 651 652 return r; 653} 654 655int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu) 656{ 657 int ret, s; 658#ifdef CONFIG_PPC_FPU | 1/* 2 * This program is free software; you can redistribute it and/or modify 3 * it under the terms of the GNU General Public License, version 2, as 4 * published by the Free Software Foundation. 5 * 6 * This program is distributed in the hope that it will be useful, 7 * but WITHOUT ANY WARRANTY; without even the implied warranty of 8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- 642 unchanged lines hidden (view full) --- 651 652 return r; 653} 654 655int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu) 656{ 657 int ret, s; 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 663 664 if (!vcpu->arch.sane) { 665 kvm_run->exit_reason = KVM_EXIT_INTERNAL_ERROR; 666 return -EINVAL; 667 } 668 669 local_irq_disable(); 670 s = kvmppc_prepare_to_enter(vcpu); 671 if (s <= 0) { 672 local_irq_enable(); 673 ret = s; 674 goto out; 675 } 676 677#ifdef CONFIG_PPC_FPU 678 /* Save userspace FPU state in stack */ 679 enable_kernel_fp(); | 661#endif 662 663 if (!vcpu->arch.sane) { 664 kvm_run->exit_reason = KVM_EXIT_INTERNAL_ERROR; 665 return -EINVAL; 666 } 667 668 local_irq_disable(); 669 s = kvmppc_prepare_to_enter(vcpu); 670 if (s <= 0) { 671 local_irq_enable(); 672 ret = s; 673 goto out; 674 } 675 676#ifdef CONFIG_PPC_FPU 677 /* Save userspace FPU state in stack */ 678 enable_kernel_fp(); |
680 memcpy(fpr, current->thread.fpr, sizeof(current->thread.fpr)); 681 fpscr = current->thread.fpscr.val; | 679 fp = current->thread.fp_state; |
682 fpexc_mode = current->thread.fpexc_mode; 683 684 /* Restore guest FPU state to thread */ | 680 fpexc_mode = current->thread.fpexc_mode; 681 682 /* Restore guest FPU state to thread */ |
685 memcpy(current->thread.fpr, vcpu->arch.fpr, sizeof(vcpu->arch.fpr)); 686 current->thread.fpscr.val = vcpu->arch.fpscr; | 683 memcpy(current->thread.fp_state.fpr, vcpu->arch.fpr, 684 sizeof(vcpu->arch.fpr)); 685 current->thread.fp_state.fpscr = vcpu->arch.fpscr; |
687 688 /* 689 * Since we can't trap on MSR_FP in GS-mode, we consider the guest 690 * as always using the FPU. Kernel usage of FP (via 691 * enable_kernel_fp()) in this thread must not occur while 692 * vcpu->fpu_active is set. 693 */ 694 vcpu->fpu_active = 1; --- 9 unchanged lines hidden (view full) --- 704 We also get here with interrupts enabled. */ 705 706#ifdef CONFIG_PPC_FPU 707 kvmppc_save_guest_fp(vcpu); 708 709 vcpu->fpu_active = 0; 710 711 /* Save guest FPU state from thread */ | 686 687 /* 688 * Since we can't trap on MSR_FP in GS-mode, we consider the guest 689 * as always using the FPU. Kernel usage of FP (via 690 * enable_kernel_fp()) in this thread must not occur while 691 * vcpu->fpu_active is set. 692 */ 693 vcpu->fpu_active = 1; --- 9 unchanged lines hidden (view full) --- 703 We also get here with interrupts enabled. */ 704 705#ifdef CONFIG_PPC_FPU 706 kvmppc_save_guest_fp(vcpu); 707 708 vcpu->fpu_active = 0; 709 710 /* Save guest FPU state from thread */ |
712 memcpy(vcpu->arch.fpr, current->thread.fpr, sizeof(vcpu->arch.fpr)); 713 vcpu->arch.fpscr = current->thread.fpscr.val; | 711 memcpy(vcpu->arch.fpr, current->thread.fp_state.fpr, 712 sizeof(vcpu->arch.fpr)); 713 vcpu->arch.fpscr = current->thread.fp_state.fpscr; |
714 715 /* Restore userspace FPU state from stack */ | 714 715 /* Restore userspace FPU state from stack */ |
716 memcpy(current->thread.fpr, fpr, sizeof(current->thread.fpr)); 717 current->thread.fpscr.val = fpscr; | 716 current->thread.fp_state = fp; |
718 current->thread.fpexc_mode = fpexc_mode; 719#endif 720 721out: 722 vcpu->mode = OUTSIDE_GUEST_MODE; 723 return ret; 724} 725 --- 1018 unchanged lines hidden --- | 717 current->thread.fpexc_mode = fpexc_mode; 718#endif 719 720out: 721 vcpu->mode = OUTSIDE_GUEST_MODE; 722 return ret; 723} 724 --- 1018 unchanged lines hidden --- |