memory: move RAM_PREALLOC_MASK to exec.c, rename
Prepare for adding more flags. The "_MASK" suffix is unique, kill it.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
diff --git a/exec.c b/exec.c
index dae50a1..bad16e0 100644
--- a/exec.c
+++ b/exec.c
@@ -70,6 +70,9 @@
MemoryRegion io_mem_rom, io_mem_notdirty;
static MemoryRegion io_mem_unassigned;
+/* RAM is pre-allocated and passed into qemu_ram_alloc_from_ptr */
+#define RAM_PREALLOC (1 << 0)
+
#endif
struct CPUTailQ cpus = QTAILQ_HEAD_INITIALIZER(cpus);
@@ -1325,7 +1328,7 @@
new_block->fd = -1;
new_block->host = host;
if (host) {
- new_block->flags |= RAM_PREALLOC_MASK;
+ new_block->flags |= RAM_PREALLOC;
}
return ram_block_add(new_block);
}
@@ -1364,7 +1367,7 @@
QTAILQ_REMOVE(&ram_list.blocks, block, next);
ram_list.mru_block = NULL;
ram_list.version++;
- if (block->flags & RAM_PREALLOC_MASK) {
+ if (block->flags & RAM_PREALLOC) {
;
} else if (xen_enabled()) {
xen_invalidate_map_cache_entry(block->host);
@@ -1396,7 +1399,7 @@
offset = addr - block->offset;
if (offset < block->length) {
vaddr = block->host + offset;
- if (block->flags & RAM_PREALLOC_MASK) {
+ if (block->flags & RAM_PREALLOC) {
;
} else if (xen_enabled()) {
abort();
diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h
index eaddea6..f91581f 100644
--- a/include/exec/cpu-all.h
+++ b/include/exec/cpu-all.h
@@ -297,9 +297,6 @@
/* memory API */
-/* RAM is pre-allocated and passed into qemu_ram_alloc_from_ptr */
-#define RAM_PREALLOC_MASK (1 << 0)
-
typedef struct RAMBlock {
struct MemoryRegion *mr;
uint8_t *host;