1
2
3
4
5
6
7
8
9
10
11
12#ifndef QEMU_RAM_H
13#define QEMU_RAM_H
14
15#include "sysemu/sysemu.h"
16#include "qom/object.h"
17#include "exec/memory.h"
18#include "qemu/option.h"
19#include "qemu/bitmap.h"
20
21#define TYPE_MEMORY_BACKEND "memory-backend"
22#define MEMORY_BACKEND(obj) \
23 OBJECT_CHECK(HostMemoryBackend, (obj), TYPE_MEMORY_BACKEND)
24#define MEMORY_BACKEND_GET_CLASS(obj) \
25 OBJECT_GET_CLASS(HostMemoryBackendClass, (obj), TYPE_MEMORY_BACKEND)
26#define MEMORY_BACKEND_CLASS(klass) \
27 OBJECT_CLASS_CHECK(HostMemoryBackendClass, (klass), TYPE_MEMORY_BACKEND)
28
29typedef struct HostMemoryBackend HostMemoryBackend;
30typedef struct HostMemoryBackendClass HostMemoryBackendClass;
31
32
33
34
35
36struct HostMemoryBackendClass {
37 ObjectClass parent_class;
38
39 void (*alloc)(HostMemoryBackend *backend, Error **errp);
40};
41
42
43
44
45
46
47
48
49
50struct HostMemoryBackend {
51
52 Object parent;
53
54
55 uint64_t size;
56 bool merge, dump;
57 bool prealloc, force_prealloc;
58 DECLARE_BITMAP(host_nodes, MAX_NODES + 1);
59 HostMemPolicy policy;
60
61 MemoryRegion mr;
62};
63
64MemoryRegion *host_memory_backend_get_memory(HostMemoryBackend *backend,
65 Error **errp);
66
67#endif
68