target/arm: Allow board models to specify initial NS VTOR
[qemu/ar7.git] / include / sysemu / hostmem.h
blobdf5644723a39523a1a193a828909cfe148bcc1fc
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 OBJECT_DECLARE_TYPE(HostMemoryBackend, HostMemoryBackendClass,
24 MEMORY_BACKEND)
26 /* hostmem-ram.c */
27 /**
28 * @TYPE_MEMORY_BACKEND_RAM:
29 * name of backend that uses mmap on the anonymous RAM
32 #define TYPE_MEMORY_BACKEND_RAM "memory-backend-ram"
34 /* hostmem-file.c */
35 /**
36 * @TYPE_MEMORY_BACKEND_FILE:
37 * name of backend that uses mmap on a file descriptor
39 #define TYPE_MEMORY_BACKEND_FILE "memory-backend-file"
42 /**
43 * HostMemoryBackendClass:
44 * @parent_class: opaque parent class container
46 struct HostMemoryBackendClass {
47 ObjectClass parent_class;
49 void (*alloc)(HostMemoryBackend *backend, Error **errp);
52 /**
53 * @HostMemoryBackend
55 * @parent: opaque parent object container
56 * @size: amount of memory backend provides
57 * @mr: MemoryRegion representing host memory belonging to backend
58 * @prealloc_threads: number of threads to be used for preallocatining RAM
60 struct HostMemoryBackend {
61 /* private */
62 Object parent;
64 /* protected */
65 uint64_t size;
66 bool merge, dump, use_canonical_path;
67 bool prealloc, is_mapped, share;
68 uint32_t prealloc_threads;
69 DECLARE_BITMAP(host_nodes, MAX_NODES + 1);
70 HostMemPolicy policy;
72 MemoryRegion mr;
75 bool host_memory_backend_mr_inited(HostMemoryBackend *backend);
76 MemoryRegion *host_memory_backend_get_memory(HostMemoryBackend *backend);
78 void host_memory_backend_set_mapped(HostMemoryBackend *backend, bool mapped);
79 bool host_memory_backend_is_mapped(HostMemoryBackend *backend);
80 size_t host_memory_backend_pagesize(HostMemoryBackend *memdev);
81 char *host_memory_backend_get_name(HostMemoryBackend *backend);
83 #endif