1 /* 2 * QEMU Hypervisor.framework (HVF) support 3 * 4 * This work is licensed under the terms of the GNU GPL, version 2 or later. 5 * See the COPYING file in the top-level directory. 6 * 7 */ 8 9 /* header to be included in HVF-specific code */ 10 11 #ifndef HVF_INT_H 12 #define HVF_INT_H 13 14 #include "qemu/queue.h" 15 16 #ifdef __aarch64__ 17 #include <Hypervisor/Hypervisor.h> 18 typedef hv_vcpu_t hvf_vcpuid; 19 #else 20 #include <Hypervisor/hv.h> 21 typedef hv_vcpuid_t hvf_vcpuid; 22 #endif 23 24 /* hvf_slot flags */ 25 #define HVF_SLOT_LOG (1 << 0) 26 27 typedef struct hvf_slot { 28 uint64_t start; 29 uint64_t size; 30 uint8_t *mem; 31 int slot_id; 32 uint32_t flags; 33 MemoryRegion *region; 34 } hvf_slot; 35 36 typedef struct hvf_vcpu_caps { 37 uint64_t vmx_cap_pinbased; 38 uint64_t vmx_cap_procbased; 39 uint64_t vmx_cap_procbased2; 40 uint64_t vmx_cap_entry; 41 uint64_t vmx_cap_exit; 42 uint64_t vmx_cap_preemption_timer; 43 } hvf_vcpu_caps; 44 45 struct HVFState { 46 AccelState parent; 47 48 hvf_slot slots[32]; 49 int num_slots; 50 51 hvf_vcpu_caps *hvf_caps; 52 uint64_t vtimer_offset; 53 QTAILQ_HEAD(, hvf_sw_breakpoint) hvf_sw_breakpoints; 54 }; 55 extern HVFState *hvf_state; 56 57 struct AccelCPUState { 58 hvf_vcpuid fd; 59 void *exit; 60 bool vtimer_masked; 61 sigset_t unblock_ipi_mask; 62 bool guest_debug_enabled; 63 bool dirty; 64 }; 65 66 void assert_hvf_ok_impl(hv_return_t ret, const char *file, unsigned int line, 67 const char *exp); 68 #define assert_hvf_ok(EX) assert_hvf_ok_impl((EX), __FILE__, __LINE__, #EX) 69 const char *hvf_return_string(hv_return_t ret); 70 int hvf_arch_init(void); 71 hv_return_t hvf_arch_vm_create(MachineState *ms, uint32_t pa_range); 72 int hvf_arch_init_vcpu(CPUState *cpu); 73 void hvf_arch_vcpu_destroy(CPUState *cpu); 74 int hvf_vcpu_exec(CPUState *); 75 hvf_slot *hvf_find_overlap_slot(uint64_t, uint64_t); 76 int hvf_put_registers(CPUState *); 77 int hvf_get_registers(CPUState *); 78 void hvf_kick_vcpu_thread(CPUState *cpu); 79 80 #endif 81