xref: /kvmtool/arm/include/arm-common/kvm-cpu-arch.h (revision 61076240634dd372f691d577f6990b8121891ac9)
1*61076240SWill Deacon #ifndef ARM_COMMON__KVM_CPU_ARCH_H
2*61076240SWill Deacon #define ARM_COMMON__KVM_CPU_ARCH_H
37c0e8b0cSWill Deacon 
47c0e8b0cSWill Deacon #include <linux/kvm.h>
57c0e8b0cSWill Deacon #include <pthread.h>
67c0e8b0cSWill Deacon #include <stdbool.h>
77c0e8b0cSWill Deacon 
87c0e8b0cSWill Deacon struct kvm;
97c0e8b0cSWill Deacon 
107c0e8b0cSWill Deacon struct kvm_cpu {
117c0e8b0cSWill Deacon 	pthread_t	thread;
127c0e8b0cSWill Deacon 
137c0e8b0cSWill Deacon 	unsigned long	cpu_id;
147c0e8b0cSWill Deacon 	unsigned long	cpu_type;
157c0e8b0cSWill Deacon 
167c0e8b0cSWill Deacon 	struct kvm	*kvm;
177c0e8b0cSWill Deacon 	int		vcpu_fd;
187c0e8b0cSWill Deacon 	struct kvm_run	*kvm_run;
197c0e8b0cSWill Deacon 
207c0e8b0cSWill Deacon 	u8		is_running;
217c0e8b0cSWill Deacon 	u8		paused;
227c0e8b0cSWill Deacon 	u8		needs_nmi;
237c0e8b0cSWill Deacon 
247c0e8b0cSWill Deacon 	struct kvm_coalesced_mmio_ring	*ring;
257c0e8b0cSWill Deacon 
267c0e8b0cSWill Deacon 	void		(*generate_fdt_nodes)(void *fdt, struct kvm* kvm,
277c0e8b0cSWill Deacon 					      u32 gic_phandle);
287c0e8b0cSWill Deacon };
297c0e8b0cSWill Deacon 
307c0e8b0cSWill Deacon struct kvm_arm_target {
317c0e8b0cSWill Deacon 	u32	id;
327c0e8b0cSWill Deacon 	int	(*init)(struct kvm_cpu *vcpu);
337c0e8b0cSWill Deacon };
347c0e8b0cSWill Deacon 
357c0e8b0cSWill Deacon int kvm_cpu__register_kvm_arm_target(struct kvm_arm_target *target);
367c0e8b0cSWill Deacon 
377c0e8b0cSWill Deacon static inline bool kvm_cpu__emulate_io(struct kvm *kvm, u16 port, void *data,
387c0e8b0cSWill Deacon 				       int direction, int size, u32 count)
397c0e8b0cSWill Deacon {
407c0e8b0cSWill Deacon 	return false;
417c0e8b0cSWill Deacon }
427c0e8b0cSWill Deacon 
437c0e8b0cSWill Deacon bool kvm_cpu__emulate_mmio(struct kvm *kvm, u64 phys_addr, u8 *data, u32 len,
447c0e8b0cSWill Deacon 			   u8 is_write);
457c0e8b0cSWill Deacon 
46*61076240SWill Deacon #endif /* ARM_COMMON__KVM_CPU_ARCH_H */
47