xref: /kvmtool/arm/include/arm-common/kvm-cpu-arch.h (revision 7c0e8b0c5560ce2f500fa4d7ba7865e7360e7991)
1 #ifndef ARM_COMMON__KVM_CPU_ARCH_H
2 #define ARM_COMMON__KVM_CPU_ARCH_H
3 
4 #include <linux/kvm.h>
5 #include <pthread.h>
6 #include <stdbool.h>
7 
8 struct kvm;
9 
10 struct kvm_cpu {
11 	pthread_t	thread;
12 
13 	unsigned long	cpu_id;
14 	unsigned long	cpu_type;
15 
16 	struct kvm	*kvm;
17 	int		vcpu_fd;
18 	struct kvm_run	*kvm_run;
19 
20 	u8		is_running;
21 	u8		paused;
22 	u8		needs_nmi;
23 
24 	struct kvm_coalesced_mmio_ring	*ring;
25 
26 	void		(*generate_fdt_nodes)(void *fdt, struct kvm* kvm,
27 					      u32 gic_phandle);
28 };
29 
30 struct kvm_arm_target {
31 	u32	id;
32 	int	(*init)(struct kvm_cpu *vcpu);
33 };
34 
35 int kvm_cpu__register_kvm_arm_target(struct kvm_arm_target *target);
36 
37 static inline bool kvm_cpu__emulate_io(struct kvm *kvm, u16 port, void *data,
38 				       int direction, int size, u32 count)
39 {
40 	return false;
41 }
42 
43 bool kvm_cpu__emulate_mmio(struct kvm *kvm, u64 phys_addr, u8 *data, u32 len,
44 			   u8 is_write);
45 
46 #endif /* ARM_COMMON__KVM_CPU_ARCH_H */
47