xref: /openbmc/qemu/include/sysemu/kvm_int.h (revision 64552b6b)
1 /*
2  * Internal definitions for a target's KVM 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 #ifndef QEMU_KVM_INT_H
10 #define QEMU_KVM_INT_H
11 
12 #include "exec/cpu-common.h"
13 #include "exec/memory.h"
14 #include "sysemu/sysemu.h"
15 #include "sysemu/accel.h"
16 #include "sysemu/kvm.h"
17 
18 typedef struct KVMSlot
19 {
20     hwaddr start_addr;
21     ram_addr_t memory_size;
22     void *ram;
23     int slot;
24     int flags;
25     int old_flags;
26     /* Dirty bitmap cache for the slot */
27     unsigned long *dirty_bmap;
28 } KVMSlot;
29 
30 typedef struct KVMMemoryListener {
31     MemoryListener listener;
32     /* Protects the slots and all inside them */
33     QemuMutex slots_lock;
34     KVMSlot *slots;
35     int as_id;
36 } KVMMemoryListener;
37 
38 #define TYPE_KVM_ACCEL ACCEL_CLASS_NAME("kvm")
39 
40 #define KVM_STATE(obj) \
41     OBJECT_CHECK(KVMState, (obj), TYPE_KVM_ACCEL)
42 
43 void kvm_memory_listener_register(KVMState *s, KVMMemoryListener *kml,
44                                   AddressSpace *as, int as_id);
45 
46 #endif
47