KVM: Move vcpu_load to arch-specific kvm_arch_vcpu_ioctl_get_fpu
Move vcpu_load() and vcpu_put() into the architecture specific implementations of kvm_arch_vcpu_ioctl_get_fpu(). Reviewed-by: David Hildenbrand <david@redhat.com> Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org> Reviewed-by: Cornelia Huck <cohuck@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
66b5656222
commit
1393123e1e
|
@ -2762,6 +2762,8 @@ int kvm_arch_vcpu_ioctl_set_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)
|
|||
|
||||
int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)
|
||||
{
|
||||
vcpu_load(vcpu);
|
||||
|
||||
/* make sure we have the latest values */
|
||||
save_fpu_regs();
|
||||
if (MACHINE_HAS_VX)
|
||||
|
@ -2770,6 +2772,8 @@ int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)
|
|||
else
|
||||
memcpy(fpu->fprs, vcpu->run->s.regs.fprs, sizeof(fpu->fprs));
|
||||
fpu->fpc = vcpu->run->s.regs.fpc;
|
||||
|
||||
vcpu_put(vcpu);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -7702,9 +7702,11 @@ int kvm_arch_vcpu_ioctl_translate(struct kvm_vcpu *vcpu,
|
|||
|
||||
int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)
|
||||
{
|
||||
struct fxregs_state *fxsave =
|
||||
&vcpu->arch.guest_fpu.state.fxsave;
|
||||
struct fxregs_state *fxsave;
|
||||
|
||||
vcpu_load(vcpu);
|
||||
|
||||
fxsave = &vcpu->arch.guest_fpu.state.fxsave;
|
||||
memcpy(fpu->fpr, fxsave->st_space, 128);
|
||||
fpu->fcw = fxsave->cwd;
|
||||
fpu->fsw = fxsave->swd;
|
||||
|
@ -7714,6 +7716,7 @@ int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)
|
|||
fpu->last_dp = fxsave->rdp;
|
||||
memcpy(fpu->xmm, fxsave->xmm_space, sizeof fxsave->xmm_space);
|
||||
|
||||
vcpu_put(vcpu);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -2704,9 +2704,7 @@ out_free1:
|
|||
r = -ENOMEM;
|
||||
if (!fpu)
|
||||
goto out;
|
||||
vcpu_load(vcpu);
|
||||
r = kvm_arch_vcpu_ioctl_get_fpu(vcpu, fpu);
|
||||
vcpu_put(vcpu);
|
||||
if (r)
|
||||
goto out;
|
||||
r = -EFAULT;
|
||||
|
|
Loading…
Reference in New Issue