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 37*85bd726aSAnup Patel void kvm_cpu__set_kvm_arm_generic_target(struct kvm_arm_target *target); 38*85bd726aSAnup Patel 397c0e8b0cSWill Deacon int kvm_cpu__register_kvm_arm_target(struct kvm_arm_target *target); 407c0e8b0cSWill Deacon 414123ca55SMarc Zyngier static inline bool kvm_cpu__emulate_io(struct kvm_cpu *vcpu, u16 port, void *data, 427c0e8b0cSWill Deacon int direction, int size, u32 count) 437c0e8b0cSWill Deacon { 447c0e8b0cSWill Deacon return false; 457c0e8b0cSWill Deacon } 467c0e8b0cSWill Deacon 479b735910SMarc Zyngier bool kvm_cpu__emulate_mmio(struct kvm_cpu *vcpu, u64 phys_addr, u8 *data, 489b735910SMarc Zyngier u32 len, u8 is_write); 497c0e8b0cSWill Deacon 50d06bc640SMarc Zyngier unsigned long kvm_cpu__get_vcpu_mpidr(struct kvm_cpu *vcpu); 51d06bc640SMarc Zyngier 5261076240SWill Deacon #endif /* ARM_COMMON__KVM_CPU_ARCH_H */ 53