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 /include | |
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 'include')
-rw-r--r-- | include/linux/kvm_host.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index d3fdf1a738c9..c6e4d02067fe 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h | |||
@@ -179,6 +179,17 @@ struct kvm { | |||
179 | #define kvm_printf(kvm, fmt ...) printk(KERN_DEBUG fmt) | 179 | #define kvm_printf(kvm, fmt ...) printk(KERN_DEBUG fmt) |
180 | #define vcpu_printf(vcpu, fmt...) kvm_printf(vcpu->kvm, fmt) | 180 | #define vcpu_printf(vcpu, fmt...) kvm_printf(vcpu->kvm, fmt) |
181 | 181 | ||
182 | static inline struct kvm_vcpu *kvm_get_vcpu(struct kvm *kvm, int i) | ||
183 | { | ||
184 | smp_rmb(); | ||
185 | return kvm->vcpus[i]; | ||
186 | } | ||
187 | |||
188 | #define kvm_for_each_vcpu(idx, vcpup, kvm) \ | ||
189 | for (idx = 0, vcpup = kvm_get_vcpu(kvm, idx); \ | ||
190 | idx < atomic_read(&kvm->online_vcpus) && vcpup; \ | ||
191 | vcpup = kvm_get_vcpu(kvm, ++idx)) | ||
192 | |||
182 | int kvm_vcpu_init(struct kvm_vcpu *vcpu, struct kvm *kvm, unsigned id); | 193 | int kvm_vcpu_init(struct kvm_vcpu *vcpu, struct kvm *kvm, unsigned id); |
183 | void kvm_vcpu_uninit(struct kvm_vcpu *vcpu); | 194 | void kvm_vcpu_uninit(struct kvm_vcpu *vcpu); |
184 | 195 | ||