Alexander Graf | d57bc3c | 2021-06-03 14:09:30 +0100 | [diff] [blame] | 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 <Hypervisor/hv.h> |
| 15 | |
Alexander Graf | 861457c | 2021-06-03 14:09:31 +0100 | [diff] [blame] | 16 | /* hvf_slot flags */ |
| 17 | #define HVF_SLOT_LOG (1 << 0) |
| 18 | |
| 19 | typedef struct hvf_slot { |
| 20 | uint64_t start; |
| 21 | uint64_t size; |
| 22 | uint8_t *mem; |
| 23 | int slot_id; |
| 24 | uint32_t flags; |
| 25 | MemoryRegion *region; |
| 26 | } hvf_slot; |
| 27 | |
| 28 | typedef struct hvf_vcpu_caps { |
| 29 | uint64_t vmx_cap_pinbased; |
| 30 | uint64_t vmx_cap_procbased; |
| 31 | uint64_t vmx_cap_procbased2; |
| 32 | uint64_t vmx_cap_entry; |
| 33 | uint64_t vmx_cap_exit; |
| 34 | uint64_t vmx_cap_preemption_timer; |
| 35 | } hvf_vcpu_caps; |
| 36 | |
| 37 | struct HVFState { |
| 38 | AccelState parent; |
| 39 | hvf_slot slots[32]; |
| 40 | int num_slots; |
| 41 | |
| 42 | hvf_vcpu_caps *hvf_caps; |
| 43 | }; |
| 44 | extern HVFState *hvf_state; |
| 45 | |
Alexander Graf | b533450 | 2021-06-03 14:09:34 +0100 | [diff] [blame] | 46 | struct hvf_vcpu_state { |
| 47 | int fd; |
| 48 | }; |
| 49 | |
Alexander Graf | d57bc3c | 2021-06-03 14:09:30 +0100 | [diff] [blame] | 50 | void assert_hvf_ok(hv_return_t ret); |
Alexander Graf | cfe5845 | 2021-06-03 14:09:32 +0100 | [diff] [blame] | 51 | int hvf_arch_init_vcpu(CPUState *cpu); |
| 52 | void hvf_arch_vcpu_destroy(CPUState *cpu); |
Alexander Graf | d662ede | 2021-06-03 14:09:33 +0100 | [diff] [blame] | 53 | int hvf_vcpu_exec(CPUState *); |
Alexander Graf | 358e750 | 2021-06-03 14:09:31 +0100 | [diff] [blame] | 54 | hvf_slot *hvf_find_overlap_slot(uint64_t, uint64_t); |
| 55 | int hvf_put_registers(CPUState *); |
| 56 | int hvf_get_registers(CPUState *); |
Alexander Graf | d57bc3c | 2021-06-03 14:09:30 +0100 | [diff] [blame] | 57 | |
| 58 | #endif |