aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kvm
diff options
context:
space:
mode:
authorGleb Natapov <gleb@redhat.com>2009-06-09 08:56:29 -0400
committerAvi Kivity <avi@redhat.com>2009-09-10 01:32:52 -0400
commit988a2cae6a3c0dea6df59808a935a9a697bfc28c (patch)
treec1118d86c5d6f24fe738c608917b0affb311f26d /arch/powerpc/kvm
parent73880c80aa9c8dc353cd0ad26579023213cd5314 (diff)
KVM: Use macro to iterate over vcpus.
[christian: remove unused variables on s390] Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/powerpc/kvm')
-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)