xref: /kvmtool/arm/include/arm-common/kvm-cpu-arch.h (revision d06bc640e568ec33bf06f40b62f7d0ac6ce102da)
161076240SWill Deacon #ifndef ARM_COMMON__KVM_CPU_ARCH_H
261076240SWill 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;
159b47146bSMarc Zyngier 	const char	*cpu_compatible;
167c0e8b0cSWill Deacon 
177c0e8b0cSWill Deacon 	struct kvm	*kvm;
187c0e8b0cSWill Deacon 	int		vcpu_fd;
197c0e8b0cSWill Deacon 	struct kvm_run	*kvm_run;
207c0e8b0cSWill Deacon 
217c0e8b0cSWill Deacon 	u8		is_running;
227c0e8b0cSWill Deacon 	u8		paused;
237c0e8b0cSWill Deacon 	u8		needs_nmi;
247c0e8b0cSWill Deacon 
257c0e8b0cSWill Deacon 	struct kvm_coalesced_mmio_ring	*ring;
267c0e8b0cSWill Deacon 
277c0e8b0cSWill Deacon 	void		(*generate_fdt_nodes)(void *fdt, struct kvm* kvm,
287c0e8b0cSWill Deacon 					      u32 gic_phandle);
297c0e8b0cSWill Deacon };
307c0e8b0cSWill Deacon 
317c0e8b0cSWill Deacon struct kvm_arm_target {
327c0e8b0cSWill Deacon 	u32		id;
339b47146bSMarc Zyngier 	const char 	*compatible;
347c0e8b0cSWill Deacon 	int		(*init)(struct kvm_cpu *vcpu);
357c0e8b0cSWill Deacon };
367c0e8b0cSWill Deacon 
377c0e8b0cSWill Deacon int kvm_cpu__register_kvm_arm_target(struct kvm_arm_target *target);
387c0e8b0cSWill Deacon 
397c0e8b0cSWill Deacon static inline bool kvm_cpu__emulate_io(struct kvm *kvm, u16 port, void *data,
407c0e8b0cSWill Deacon 				       int direction, int size, u32 count)
417c0e8b0cSWill Deacon {
427c0e8b0cSWill Deacon 	return false;
437c0e8b0cSWill Deacon }
447c0e8b0cSWill Deacon 
457c0e8b0cSWill Deacon bool kvm_cpu__emulate_mmio(struct kvm *kvm, u64 phys_addr, u8 *data, u32 len,
467c0e8b0cSWill Deacon 			   u8 is_write);
477c0e8b0cSWill Deacon 
48*d06bc640SMarc Zyngier unsigned long kvm_cpu__get_vcpu_mpidr(struct kvm_cpu *vcpu);
49*d06bc640SMarc Zyngier 
5061076240SWill Deacon #endif /* ARM_COMMON__KVM_CPU_ARCH_H */
51