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 hvf_slot slots[32]; 48 int num_slots; 49 50 hvf_vcpu_caps *hvf_caps; 51 uint64_t vtimer_offset; 52 QTAILQ_HEAD(, hvf_sw_breakpoint) hvf_sw_breakpoints; 53 }; 54 extern HVFState *hvf_state; 55 56 struct AccelCPUState { 57 hvf_vcpuid fd; 58 void *exit; 59 bool vtimer_masked; 60 sigset_t unblock_ipi_mask; 61 bool guest_debug_enabled; 62 bool dirty; 63 }; 64 65 void assert_hvf_ok_impl(hv_return_t ret, const char *file, unsigned int line, 66 const char *exp); 67 #define assert_hvf_ok(EX) assert_hvf_ok_impl((EX), __FILE__, __LINE__, #EX) 68 const char *hvf_return_string(hv_return_t ret); 69 int hvf_arch_init(void); 70 hv_return_t hvf_arch_vm_create(MachineState *ms, uint32_t pa_range); 71 int hvf_arch_init_vcpu(CPUState *cpu); 72 void hvf_arch_vcpu_destroy(CPUState *cpu); 73 int hvf_vcpu_exec(CPUState *); 74 hvf_slot *hvf_find_overlap_slot(uint64_t, uint64_t); 75 int hvf_put_registers(CPUState *); 76 int hvf_get_registers(CPUState *); 77 void hvf_kick_vcpu_thread(CPUState *cpu); 78 79 #endif 80