1af7b0868SMatt Evans #ifndef KVM__KVM_CPU_ARCH_H 2af7b0868SMatt Evans #define KVM__KVM_CPU_ARCH_H 3af7b0868SMatt Evans 4af7b0868SMatt Evans /* Architecture-specific kvm_cpu definitions. */ 5af7b0868SMatt Evans 6af7b0868SMatt Evans #include <linux/kvm.h> /* for struct kvm_regs */ 717edd536SMatt Evans #include "kvm/kvm.h" /* for kvm__emulate_{mm}io() */ 817edd536SMatt Evans #include <stdbool.h> 9af7b0868SMatt Evans #include <pthread.h> 10af7b0868SMatt Evans 11af7b0868SMatt Evans struct kvm; 12af7b0868SMatt Evans 13af7b0868SMatt Evans struct kvm_cpu { 14af7b0868SMatt Evans pthread_t thread; /* VCPU thread */ 15af7b0868SMatt Evans 16af7b0868SMatt Evans unsigned long cpu_id; 17af7b0868SMatt Evans 18af7b0868SMatt Evans struct kvm *kvm; /* parent KVM */ 19af7b0868SMatt Evans int vcpu_fd; /* For VCPU ioctls() */ 20af7b0868SMatt Evans struct kvm_run *kvm_run; 21af7b0868SMatt Evans 22af7b0868SMatt Evans struct kvm_regs regs; 23af7b0868SMatt Evans struct kvm_sregs sregs; 24af7b0868SMatt Evans struct kvm_fpu fpu; 25af7b0868SMatt Evans 26af7b0868SMatt Evans struct kvm_msrs *msrs; /* dynamically allocated */ 27af7b0868SMatt Evans 28af7b0868SMatt Evans u8 is_running; 29af7b0868SMatt Evans u8 paused; 304b1c6f6eSSasha Levin u8 needs_nmi; 31af7b0868SMatt Evans 32af7b0868SMatt Evans struct kvm_coalesced_mmio_ring *ring; 33af7b0868SMatt Evans }; 34af7b0868SMatt Evans 3517edd536SMatt Evans /* 3617edd536SMatt Evans * As these are such simple wrappers, let's have them in the header so they'll 3717edd536SMatt Evans * be cheaper to call: 3817edd536SMatt Evans */ 3917edd536SMatt Evans static inline bool kvm_cpu__emulate_io(struct kvm *kvm, u16 port, void *data, int direction, int size, u32 count) 4017edd536SMatt Evans { 4117edd536SMatt Evans return kvm__emulate_io(kvm, port, data, direction, size, count); 4217edd536SMatt Evans } 4317edd536SMatt Evans 44*9b735910SMarc Zyngier static inline bool kvm_cpu__emulate_mmio(struct kvm_cpu *vcpu, u64 phys_addr, u8 *data, u32 len, u8 is_write) 4517edd536SMatt Evans { 46*9b735910SMarc Zyngier return kvm__emulate_mmio(vcpu, phys_addr, data, len, is_write); 4717edd536SMatt Evans } 4817edd536SMatt Evans 49af7b0868SMatt Evans #endif /* KVM__KVM_CPU_ARCH_H */ 50