1 #ifndef KVM__KVM_CPU_ARCH_H 2 #define KVM__KVM_CPU_ARCH_H 3 4 #include <linux/kvm.h> /* for struct kvm_regs */ 5 #include "kvm/kvm.h" /* for kvm__emulate_{mm}io() */ 6 #include <pthread.h> 7 8 struct kvm; 9 10 struct kvm_cpu { 11 pthread_t thread; /* VCPU thread */ 12 13 unsigned long cpu_id; 14 15 struct kvm *kvm; /* parent KVM */ 16 int vcpu_fd; /* For VCPU ioctls() */ 17 struct kvm_run *kvm_run; 18 19 struct kvm_regs regs; 20 21 u8 is_running; 22 u8 paused; 23 u8 needs_nmi; 24 25 struct kvm_coalesced_mmio_ring *ring; 26 }; 27 28 /* 29 * As these are such simple wrappers, let's have them in the header so they'll 30 * be cheaper to call: 31 */ 32 static inline bool kvm_cpu__emulate_io(struct kvm *kvm, u16 port, void *data, int direction, int size, u32 count) 33 { 34 return kvm__emulate_io(kvm, port, data, direction, size, count); 35 } 36 37 static inline bool kvm_cpu__emulate_mmio(struct kvm_cpu *vcpu, u64 phys_addr, u8 *data, u32 len, u8 is_write) 38 { 39 return kvm__emulate_mmio(vcpu, phys_addr, data, len, is_write); 40 } 41 42 #endif /* KVM__KVM_CPU_ARCH_H */ 43