xref: /openbmc/qemu/include/sysemu/hvf_int.h (revision af206c28)
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 #ifdef __aarch64__
15 #include <Hypervisor/Hypervisor.h>
16 typedef hv_vcpu_t hvf_vcpuid;
17 #else
18 #include <Hypervisor/hv.h>
19 typedef hv_vcpuid_t hvf_vcpuid;
20 #endif
21 
22 /* hvf_slot flags */
23 #define HVF_SLOT_LOG (1 << 0)
24 
25 typedef struct hvf_slot {
26     uint64_t start;
27     uint64_t size;
28     uint8_t *mem;
29     int slot_id;
30     uint32_t flags;
31     MemoryRegion *region;
32 } hvf_slot;
33 
34 typedef struct hvf_vcpu_caps {
35     uint64_t vmx_cap_pinbased;
36     uint64_t vmx_cap_procbased;
37     uint64_t vmx_cap_procbased2;
38     uint64_t vmx_cap_entry;
39     uint64_t vmx_cap_exit;
40     uint64_t vmx_cap_preemption_timer;
41 } hvf_vcpu_caps;
42 
43 struct HVFState {
44     AccelState parent;
45     hvf_slot slots[32];
46     int num_slots;
47 
48     hvf_vcpu_caps *hvf_caps;
49     uint64_t vtimer_offset;
50     QTAILQ_HEAD(, hvf_sw_breakpoint) hvf_sw_breakpoints;
51 };
52 extern HVFState *hvf_state;
53 
54 struct AccelCPUState {
55     hvf_vcpuid fd;
56     void *exit;
57     bool vtimer_masked;
58     sigset_t unblock_ipi_mask;
59     bool guest_debug_enabled;
60     bool dirty;
61 };
62 
63 void assert_hvf_ok_impl(hv_return_t ret, const char *file, unsigned int line,
64                         const char *exp);
65 #define assert_hvf_ok(EX) assert_hvf_ok_impl((EX), __FILE__, __LINE__, #EX)
66 const char *hvf_return_string(hv_return_t ret);
67 int hvf_arch_init(void);
68 int hvf_arch_init_vcpu(CPUState *cpu);
69 void hvf_arch_vcpu_destroy(CPUState *cpu);
70 int hvf_vcpu_exec(CPUState *);
71 hvf_slot *hvf_find_overlap_slot(uint64_t, uint64_t);
72 int hvf_put_registers(CPUState *);
73 int hvf_get_registers(CPUState *);
74 void hvf_kick_vcpu_thread(CPUState *cpu);
75 
76 #endif
77