aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/kvm_host.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/kvm_host.h')
-rw-r--r--include/linux/kvm_host.h11
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
182static 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
182int kvm_vcpu_init(struct kvm_vcpu *vcpu, struct kvm *kvm, unsigned id); 193int kvm_vcpu_init(struct kvm_vcpu *vcpu, struct kvm *kvm, unsigned id);
183void kvm_vcpu_uninit(struct kvm_vcpu *vcpu); 194void kvm_vcpu_uninit(struct kvm_vcpu *vcpu);
184 195