2021-06-03 16:09:30 +03:00
|
|
|
/*
|
|
|
|
* QEMU Hypervisor.framework (HVF) support
|
|
|
|
*
|
|
|
|
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
|
|
|
* See the COPYING file in the top-level directory.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* header to be included in HVF-specific code */
|
|
|
|
|
|
|
|
#ifndef HVF_INT_H
|
|
|
|
#define HVF_INT_H
|
|
|
|
|
2021-09-16 18:53:58 +03:00
|
|
|
#ifdef __aarch64__
|
|
|
|
#include <Hypervisor/Hypervisor.h>
|
2024-06-05 14:25:52 +03:00
|
|
|
typedef hv_vcpu_t hvf_vcpuid;
|
2021-09-16 18:53:58 +03:00
|
|
|
#else
|
2021-06-03 16:09:30 +03:00
|
|
|
#include <Hypervisor/hv.h>
|
2024-06-05 14:25:52 +03:00
|
|
|
typedef hv_vcpuid_t hvf_vcpuid;
|
2021-09-16 18:53:58 +03:00
|
|
|
#endif
|
2021-06-03 16:09:30 +03:00
|
|
|
|
2021-06-03 16:09:31 +03:00
|
|
|
/* hvf_slot flags */
|
|
|
|
#define HVF_SLOT_LOG (1 << 0)
|
|
|
|
|
|
|
|
typedef struct hvf_slot {
|
|
|
|
uint64_t start;
|
|
|
|
uint64_t size;
|
|
|
|
uint8_t *mem;
|
|
|
|
int slot_id;
|
|
|
|
uint32_t flags;
|
|
|
|
MemoryRegion *region;
|
|
|
|
} hvf_slot;
|
|
|
|
|
|
|
|
typedef struct hvf_vcpu_caps {
|
|
|
|
uint64_t vmx_cap_pinbased;
|
|
|
|
uint64_t vmx_cap_procbased;
|
|
|
|
uint64_t vmx_cap_procbased2;
|
|
|
|
uint64_t vmx_cap_entry;
|
|
|
|
uint64_t vmx_cap_exit;
|
|
|
|
uint64_t vmx_cap_preemption_timer;
|
|
|
|
} hvf_vcpu_caps;
|
|
|
|
|
|
|
|
struct HVFState {
|
|
|
|
AccelState parent;
|
|
|
|
hvf_slot slots[32];
|
|
|
|
int num_slots;
|
|
|
|
|
|
|
|
hvf_vcpu_caps *hvf_caps;
|
2021-09-16 18:53:58 +03:00
|
|
|
uint64_t vtimer_offset;
|
2023-06-06 12:19:30 +03:00
|
|
|
QTAILQ_HEAD(, hvf_sw_breakpoint) hvf_sw_breakpoints;
|
2021-06-03 16:09:31 +03:00
|
|
|
};
|
|
|
|
extern HVFState *hvf_state;
|
|
|
|
|
2023-06-21 14:15:27 +03:00
|
|
|
struct AccelCPUState {
|
2024-06-05 14:25:52 +03:00
|
|
|
hvf_vcpuid fd;
|
2021-09-16 18:53:58 +03:00
|
|
|
void *exit;
|
|
|
|
bool vtimer_masked;
|
2021-09-16 18:53:59 +03:00
|
|
|
sigset_t unblock_ipi_mask;
|
2023-06-06 12:19:30 +03:00
|
|
|
bool guest_debug_enabled;
|
2024-04-24 19:16:59 +03:00
|
|
|
bool dirty;
|
2021-06-03 16:09:34 +03:00
|
|
|
};
|
|
|
|
|
2024-06-05 14:25:56 +03:00
|
|
|
void assert_hvf_ok_impl(hv_return_t ret, const char *file, unsigned int line,
|
|
|
|
const char *exp);
|
|
|
|
#define assert_hvf_ok(EX) assert_hvf_ok_impl((EX), __FILE__, __LINE__, #EX)
|
|
|
|
const char *hvf_return_string(hv_return_t ret);
|
2021-09-16 18:53:57 +03:00
|
|
|
int hvf_arch_init(void);
|
2021-06-03 16:09:32 +03:00
|
|
|
int hvf_arch_init_vcpu(CPUState *cpu);
|
|
|
|
void hvf_arch_vcpu_destroy(CPUState *cpu);
|
2021-06-03 16:09:33 +03:00
|
|
|
int hvf_vcpu_exec(CPUState *);
|
2021-06-03 16:09:31 +03:00
|
|
|
hvf_slot *hvf_find_overlap_slot(uint64_t, uint64_t);
|
|
|
|
int hvf_put_registers(CPUState *);
|
|
|
|
int hvf_get_registers(CPUState *);
|
2021-09-16 18:53:58 +03:00
|
|
|
void hvf_kick_vcpu_thread(CPUState *cpu);
|
2021-06-03 16:09:30 +03:00
|
|
|
|
|
|
|
#endif
|