xref: /kvmtool/mips/include/kvm/kvm-cpu-arch.h (revision e300a5eef43ed25dc415b47d67cdf8d8987a9bf8)
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 	struct kvm_cpu_task	*task;
19 
20 	struct kvm_regs	regs;
21 
22 	u8		is_running;
23 	u8		paused;
24 	u8		needs_nmi;
25 
26 	struct kvm_coalesced_mmio_ring *ring;
27 };
28 
29 /*
30  * As these are such simple wrappers, let's have them in the header so they'll
31  * be cheaper to call:
32  */
kvm_cpu__emulate_io(struct kvm_cpu * vcpu,u16 port,void * data,int direction,int size,u32 count)33 static inline bool kvm_cpu__emulate_io(struct kvm_cpu *vcpu, u16 port, void *data, int direction, int size, u32 count)
34 {
35 	return kvm__emulate_io(vcpu, port, data, direction, size, count);
36 }
37 
kvm_cpu__emulate_mmio(struct kvm_cpu * vcpu,u64 phys_addr,u8 * data,u32 len,u8 is_write)38 static inline bool kvm_cpu__emulate_mmio(struct kvm_cpu *vcpu, u64 phys_addr, u8 *data, u32 len, u8 is_write)
39 {
40 	return kvm__emulate_mmio(vcpu, phys_addr, data, len, is_write);
41 }
42 
43 #endif /* KVM__KVM_CPU_ARCH_H */
44