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