summaryrefslogtreecommitdiffstats
path: root/virt
diff options
context:
space:
mode:
authorChristoffer Dall <christoffer.dall@linaro.org>2017-12-04 21:35:30 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2017-12-14 09:26:54 +0100
commitfd2325612c1493c85cce89ea16b2396baca83311 (patch)
treeb2d82a8da7af6431d198b9de99a2e137f7115e9d /virt
parentb4ef9d4e8cb8938e6c0aa3be672b0aeeb791ecf3 (diff)
downloadlinux-stable-fd2325612c1493c85cce89ea16b2396baca83311.tar.gz
linux-stable-fd2325612c1493c85cce89ea16b2396baca83311.tar.bz2
linux-stable-fd2325612c1493c85cce89ea16b2396baca83311.zip
KVM: Move vcpu_load to arch-specific kvm_arch_vcpu_ioctl_get_mpstate
Move vcpu_load() and vcpu_put() into the architecture specific implementations of kvm_arch_vcpu_ioctl_get_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.c3
-rw-r--r--virt/kvm/kvm_main.c2
2 files changed, 3 insertions, 2 deletions
diff --git a/virt/kvm/arm/arm.c b/virt/kvm/arm/arm.c
index a1b2e8a43ca0..65d50100ba3c 100644
--- a/virt/kvm/arm/arm.c
+++ b/virt/kvm/arm/arm.c
@@ -381,11 +381,14 @@ static void vcpu_power_off(struct kvm_vcpu *vcpu)
int kvm_arch_vcpu_ioctl_get_mpstate(struct kvm_vcpu *vcpu,
struct kvm_mp_state *mp_state)
{
+ vcpu_load(vcpu);
+
if (vcpu->arch.power_off)
mp_state->mp_state = KVM_MP_STATE_STOPPED;
else
mp_state->mp_state = KVM_MP_STATE_RUNNABLE;
+ vcpu_put(vcpu);
return 0;
}
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index e04a216bcd14..8e2f582417c3 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -2634,9 +2634,7 @@ out_free1:
case KVM_GET_MP_STATE: {
struct kvm_mp_state mp_state;
- vcpu_load(vcpu);
r = kvm_arch_vcpu_ioctl_get_mpstate(vcpu, &mp_state);
- vcpu_put(vcpu);
if (r)
goto out;
r = -EFAULT;