summaryrefslogtreecommitdiffstats
path: root/virt
diff options
context:
space:
mode:
authorChristoffer Dall <christoffer.dall@linaro.org>2017-12-04 21:35:31 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2017-12-14 09:26:54 +0100
commite83dff5edf0c3f014e4b4ac5e1c86dbe797687c7 (patch)
treea72f719f5a323c6cbf902fa65151d6801dd6c89a /virt
parentfd2325612c1493c85cce89ea16b2396baca83311 (diff)
downloadlinux-stable-e83dff5edf0c3f014e4b4ac5e1c86dbe797687c7.tar.gz
linux-stable-e83dff5edf0c3f014e4b4ac5e1c86dbe797687c7.tar.bz2
linux-stable-e83dff5edf0c3f014e4b4ac5e1c86dbe797687c7.zip
KVM: Move vcpu_load to arch-specific kvm_arch_vcpu_ioctl_set_mpstate
Move vcpu_load() and vcpu_put() into the architecture specific implementations of kvm_arch_vcpu_ioctl_set_mpstate(). 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>
Diffstat (limited to 'virt')
-rw-r--r--virt/kvm/arm/arm.c9
-rw-r--r--virt/kvm/kvm_main.c2
2 files changed, 7 insertions, 4 deletions
diff --git a/virt/kvm/arm/arm.c b/virt/kvm/arm/arm.c
index 65d50100ba3c..aa6167086211 100644
--- a/virt/kvm/arm/arm.c
+++ b/virt/kvm/arm/arm.c
@@ -395,6 +395,10 @@ int kvm_arch_vcpu_ioctl_get_mpstate(struct kvm_vcpu *vcpu,
int kvm_arch_vcpu_ioctl_set_mpstate(struct kvm_vcpu *vcpu,
struct kvm_mp_state *mp_state)
{
+ int ret = 0;
+
+ vcpu_load(vcpu);
+
switch (mp_state->mp_state) {
case KVM_MP_STATE_RUNNABLE:
vcpu->arch.power_off = false;
@@ -403,10 +407,11 @@ int kvm_arch_vcpu_ioctl_set_mpstate(struct kvm_vcpu *vcpu,
vcpu_power_off(vcpu);
break;
default:
- return -EINVAL;
+ ret = -EINVAL;
}
- return 0;
+ vcpu_put(vcpu);
+ return ret;
}
/**
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 8e2f582417c3..4b5aeb4b8c58 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -2649,9 +2649,7 @@ out_free1:
r = -EFAULT;
if (copy_from_user(&mp_state, argp, sizeof(mp_state)))
goto out;
- vcpu_load(vcpu);
r = kvm_arch_vcpu_ioctl_set_mpstate(vcpu, &mp_state);
- vcpu_put(vcpu);
break;
}
case KVM_TRANSLATE: {