xref: /openbmc/qemu/target/i386/hvf/hvf-i386.h (revision bf5dcf8f)
1 /*
2  * QEMU Hypervisor.framework (HVF) support
3  *
4  * Copyright 2017 Google Inc
5  *
6  * Adapted from target-i386/hax-i386.h:
7  * Copyright (c) 2011 Intel Corporation
8  *  Written by:
9  *  Jiang Yunhong<yunhong.jiang@intel.com>
10  *
11  * This work is licensed under the terms of the GNU GPL, version 2 or later.
12  * See the COPYING file in the top-level directory.
13  *
14  */
15 
16 #ifndef HVF_I386_H
17 #define HVF_I386_H
18 
19 #include "qemu/accel.h"
20 #include "sysemu/hvf.h"
21 #include "cpu.h"
22 #include "x86.h"
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 };
52 extern HVFState *hvf_state;
53 
54 void hvf_set_phys_mem(MemoryRegionSection *, bool);
55 void hvf_handle_io(CPUArchState *, uint16_t, void *, int, int, int);
56 hvf_slot *hvf_find_overlap_slot(uint64_t, uint64_t);
57 
58 #ifdef NEED_CPU_H
59 /* Functions exported to host specific mode */
60 
61 /* Host specific functions */
62 int hvf_inject_interrupt(CPUArchState *env, int vector);
63 #endif
64 
65 #endif
66