Merge remote-tracking branch 'remotes/kraxel/tags/pull-vnc-20151116-1' into staging
[qemu/ar7.git] / include / sysemu / hostmem.h
blob1ce439415d6b46109b69d9c70f7f2206a6f85a0d
1 /*
2 * QEMU Host Memory Backend
4 * Copyright (C) 2013-2014 Red Hat Inc
6 * Authors:
7 * Igor Mammedov <imammedo@redhat.com>
9 * This work is licensed under the terms of the GNU GPL, version 2 or later.
10 * See the COPYING file in the top-level directory.
12 #ifndef QEMU_RAM_H
13 #define QEMU_RAM_H
15 #include "sysemu/sysemu.h" /* for MAX_NODES */
16 #include "qom/object.h"
17 #include "qapi/error.h"
18 #include "exec/memory.h"
19 #include "qemu/option.h"
20 #include "qemu/bitmap.h"
22 #define TYPE_MEMORY_BACKEND "memory-backend"
23 #define MEMORY_BACKEND(obj) \
24 OBJECT_CHECK(HostMemoryBackend, (obj), TYPE_MEMORY_BACKEND)
25 #define MEMORY_BACKEND_GET_CLASS(obj) \
26 OBJECT_GET_CLASS(HostMemoryBackendClass, (obj), TYPE_MEMORY_BACKEND)
27 #define MEMORY_BACKEND_CLASS(klass) \
28 OBJECT_CLASS_CHECK(HostMemoryBackendClass, (klass), TYPE_MEMORY_BACKEND)
30 typedef struct HostMemoryBackend HostMemoryBackend;
31 typedef struct HostMemoryBackendClass HostMemoryBackendClass;
33 /**
34 * HostMemoryBackendClass:
35 * @parent_class: opaque parent class container
37 struct HostMemoryBackendClass {
38 ObjectClass parent_class;
40 void (*alloc)(HostMemoryBackend *backend, Error **errp);
43 /**
44 * @HostMemoryBackend
46 * @parent: opaque parent object container
47 * @size: amount of memory backend provides
48 * @id: unique identification string in memdev namespace
49 * @mr: MemoryRegion representing host memory belonging to backend
51 struct HostMemoryBackend {
52 /* private */
53 Object parent;
55 /* protected */
56 uint64_t size;
57 bool merge, dump;
58 bool prealloc, force_prealloc;
59 DECLARE_BITMAP(host_nodes, MAX_NODES + 1);
60 HostMemPolicy policy;
62 MemoryRegion mr;
65 MemoryRegion *host_memory_backend_get_memory(HostMemoryBackend *backend,
66 Error **errp);
68 #endif