monitor/qmp: Update comment for commit 4eaca8de268
[qemu/armbru.git] / include / sysemu / hostmem.h
blob4dbdadd39e0a17e4836b659f10ce824695f657fb
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.
13 #ifndef SYSEMU_HOSTMEM_H
14 #define SYSEMU_HOSTMEM_H
16 #include "sysemu/numa.h"
17 #include "qapi/qapi-types-machine.h"
18 #include "qom/object.h"
19 #include "exec/memory.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 HostMemoryBackendClass HostMemoryBackendClass;
32 /**
33 * HostMemoryBackendClass:
34 * @parent_class: opaque parent class container
36 struct HostMemoryBackendClass {
37 ObjectClass parent_class;
39 void (*alloc)(HostMemoryBackend *backend, Error **errp);
42 /**
43 * @HostMemoryBackend
45 * @parent: opaque parent object container
46 * @size: amount of memory backend provides
47 * @mr: MemoryRegion representing host memory belonging to backend
49 struct HostMemoryBackend {
50 /* private */
51 Object parent;
53 /* protected */
54 uint64_t size;
55 bool merge, dump, use_canonical_path;
56 bool prealloc, force_prealloc, is_mapped, share;
57 DECLARE_BITMAP(host_nodes, MAX_NODES + 1);
58 HostMemPolicy policy;
60 MemoryRegion mr;
63 bool host_memory_backend_mr_inited(HostMemoryBackend *backend);
64 MemoryRegion *host_memory_backend_get_memory(HostMemoryBackend *backend);
66 void host_memory_backend_set_mapped(HostMemoryBackend *backend, bool mapped);
67 bool host_memory_backend_is_mapped(HostMemoryBackend *backend);
68 size_t host_memory_backend_pagesize(HostMemoryBackend *memdev);
69 char *host_memory_backend_get_name(HostMemoryBackend *backend);
71 #endif