aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kvm/powerpc.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/kvm/powerpc.c')
-rw-r--r--arch/powerpc/kvm/powerpc.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
index 2cf915e51e7e..7ad30e0a1b9a 100644
--- a/arch/powerpc/kvm/powerpc.c
+++ b/arch/powerpc/kvm/powerpc.c
@@ -122,13 +122,17 @@ struct kvm *kvm_arch_create_vm(void)
122static void kvmppc_free_vcpus(struct kvm *kvm) 122static void kvmppc_free_vcpus(struct kvm *kvm)
123{ 123{
124 unsigned int i; 124 unsigned int i;
125 struct kvm_vcpu *vcpu;
125 126
126 for (i = 0; i < KVM_MAX_VCPUS; ++i) { 127 kvm_for_each_vcpu(i, vcpu, kvm)
127 if (kvm->vcpus[i]) { 128 kvm_arch_vcpu_free(vcpu);
128 kvm_arch_vcpu_free(kvm->vcpus[i]); 129
129 kvm->vcpus[i] = NULL; 130 mutex_lock(&kvm->lock);
130 } 131 for (i = 0; i < atomic_read(&kvm->online_vcpus); i++)
131 } 132 kvm->vcpus[i] = NULL;
133
134 atomic_set(&kvm->online_vcpus, 0);
135 mutex_unlock(&kvm->lock);
132} 136}
133 137
134void kvm_arch_sync_events(struct kvm *kvm) 138void kvm_arch_sync_events(struct kvm *kvm)