diff options
author | Gleb Natapov <gleb@redhat.com> | 2009-06-09 08:56:29 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2009-09-10 01:32:52 -0400 |
commit | 988a2cae6a3c0dea6df59808a935a9a697bfc28c (patch) | |
tree | c1118d86c5d6f24fe738c608917b0affb311f26d /arch/ia64 | |
parent | 73880c80aa9c8dc353cd0ad26579023213cd5314 (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/ia64')
-rw-r--r-- | arch/ia64/kvm/kvm-ia64.c | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/arch/ia64/kvm/kvm-ia64.c b/arch/ia64/kvm/kvm-ia64.c index d1f7bcda2c7f..5c766bd82b05 100644 --- a/arch/ia64/kvm/kvm-ia64.c +++ b/arch/ia64/kvm/kvm-ia64.c | |||
@@ -337,13 +337,12 @@ static struct kvm_vcpu *lid_to_vcpu(struct kvm *kvm, unsigned long id, | |||
337 | { | 337 | { |
338 | union ia64_lid lid; | 338 | union ia64_lid lid; |
339 | int i; | 339 | int i; |
340 | struct kvm_vcpu *vcpu; | ||
340 | 341 | ||
341 | for (i = 0; i < atomic_read(&kvm->online_vcpus); i++) { | 342 | kvm_for_each_vcpu(i, vcpu, kvm) { |
342 | if (kvm->vcpus[i]) { | 343 | lid.val = VCPU_LID(vcpu); |
343 | lid.val = VCPU_LID(kvm->vcpus[i]); | 344 | if (lid.id == id && lid.eid == eid) |
344 | if (lid.id == id && lid.eid == eid) | 345 | return vcpu; |
345 | return kvm->vcpus[i]; | ||
346 | } | ||
347 | } | 346 | } |
348 | 347 | ||
349 | return NULL; | 348 | return NULL; |
@@ -409,21 +408,21 @@ static int handle_global_purge(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | |||
409 | struct kvm *kvm = vcpu->kvm; | 408 | struct kvm *kvm = vcpu->kvm; |
410 | struct call_data call_data; | 409 | struct call_data call_data; |
411 | int i; | 410 | int i; |
411 | struct kvm_vcpu *vcpui; | ||
412 | 412 | ||
413 | call_data.ptc_g_data = p->u.ptc_g_data; | 413 | call_data.ptc_g_data = p->u.ptc_g_data; |
414 | 414 | ||
415 | for (i = 0; i < atomic_read(&kvm->online_vcpus); i++) { | 415 | kvm_for_each_vcpu(i, vcpui, kvm) { |
416 | if (!kvm->vcpus[i] || kvm->vcpus[i]->arch.mp_state == | 416 | if (vcpui->arch.mp_state == KVM_MP_STATE_UNINITIALIZED || |
417 | KVM_MP_STATE_UNINITIALIZED || | 417 | vcpu == vcpui) |
418 | vcpu == kvm->vcpus[i]) | ||
419 | continue; | 418 | continue; |
420 | 419 | ||
421 | if (waitqueue_active(&kvm->vcpus[i]->wq)) | 420 | if (waitqueue_active(&vcpui->wq)) |
422 | wake_up_interruptible(&kvm->vcpus[i]->wq); | 421 | wake_up_interruptible(&vcpui->wq); |
423 | 422 | ||
424 | if (kvm->vcpus[i]->cpu != -1) { | 423 | if (vcpui->cpu != -1) { |
425 | call_data.vcpu = kvm->vcpus[i]; | 424 | call_data.vcpu = vcpui; |
426 | smp_call_function_single(kvm->vcpus[i]->cpu, | 425 | smp_call_function_single(vcpui->cpu, |
427 | vcpu_global_purge, &call_data, 1); | 426 | vcpu_global_purge, &call_data, 1); |
428 | } else | 427 | } else |
429 | printk(KERN_WARNING"kvm: Uninit vcpu received ipi!\n"); | 428 | printk(KERN_WARNING"kvm: Uninit vcpu received ipi!\n"); |