summaryrefslogtreecommitdiff
path: root/arch/powerpc/kvm/booke.h
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2013-10-15 13:43:03 +0400
committerAlexander Graf <agraf@suse.de>2014-01-09 13:15:02 +0400
commit99dae3bad28d8fdd32b7bfdd5e2ec7bb2d4d019d (patch)
tree524617ede36278f57f7a06be1f6ea88987f520c0 /arch/powerpc/kvm/booke.h
parentefff19122315f1431f6b02cd2983b15f5d3957bd (diff)
downloadlinux-99dae3bad28d8fdd32b7bfdd5e2ec7bb2d4d019d.tar.xz
KVM: PPC: Load/save FP/VMX/VSX state directly to/from vcpu struct
Now that we have the vcpu floating-point and vector state stored in the same type of struct as the main kernel uses, we can load that state directly from the vcpu struct instead of having extra copies to/from the thread_struct. Similarly, when the guest state needs to be saved, we can have it saved it directly to the vcpu struct by setting the current->thread.fp_save_area and current->thread.vr_save_area pointers. That also means that we don't need to back up and restore userspace's FP/vector state. This all makes the code simpler and faster. Note that it's not necessary to save or modify current->thread.fpexc_mode, since nothing in KVM uses or is affected by its value. Nor is it necessary to touch used_vr or used_vsr. Signed-off-by: Paul Mackerras <paulus@samba.org> Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'arch/powerpc/kvm/booke.h')
-rw-r--r--arch/powerpc/kvm/booke.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/arch/powerpc/kvm/booke.h b/arch/powerpc/kvm/booke.h
index fe59f225327f..b632cd35919b 100644
--- a/arch/powerpc/kvm/booke.h
+++ b/arch/powerpc/kvm/booke.h
@@ -137,7 +137,8 @@ static inline void kvmppc_load_guest_fp(struct kvm_vcpu *vcpu)
#ifdef CONFIG_PPC_FPU
if (vcpu->fpu_active && !(current->thread.regs->msr & MSR_FP)) {
enable_kernel_fp();
- load_fp_state(&current->thread.fp_state);
+ load_fp_state(&vcpu->arch.fp);
+ current->thread.fp_save_area = &vcpu->arch.fp;
current->thread.regs->msr |= MSR_FP;
}
#endif
@@ -152,6 +153,7 @@ static inline void kvmppc_save_guest_fp(struct kvm_vcpu *vcpu)
#ifdef CONFIG_PPC_FPU
if (vcpu->fpu_active && (current->thread.regs->msr & MSR_FP))
giveup_fpu(current);
+ current->thread.fp_save_area = NULL;
#endif
}