summaryrefslogtreecommitdiffstats
path: root/include/hw/boards.h
diff options
context:
space:
mode:
authorIgor Mammedov2020-02-19 17:08:38 +0100
committerPatchew Importer2020-02-19 17:49:53 +0100
commit82b911aaff3ba33a3c028a533c5e169c274a7c3d (patch)
tree884387b1f8c4657ab5a1e8e366d7a159f11ca282 /include/hw/boards.h
parentmachine: alias -mem-path and -mem-prealloc into memory-foo backend (diff)
downloadqemu-82b911aaff3ba33a3c028a533c5e169c274a7c3d.tar.gz
qemu-82b911aaff3ba33a3c028a533c5e169c274a7c3d.tar.xz
qemu-82b911aaff3ba33a3c028a533c5e169c274a7c3d.zip
machine: introduce convenience MachineState::ram
the new field will be used by boards to get access to main RAM memory region and will help to save boiler plate in boards which often introduce a field or variable just for this purpose. Memory region will be equivalent to what currently used memory_region_allocate_system_memory() is returning apart from that it will come from hostmem backend. Followup patches will incrementally switch boards to using RAM from MachineState::ram. Patch takes care of non-NUMA case and follow up patch will initialize MachineState::ram for NUMA case. Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20200219160953.13771-5-imammedo@redhat.com>
Diffstat (limited to 'include/hw/boards.h')
-rw-r--r--include/hw/boards.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/include/hw/boards.h b/include/hw/boards.h
index 8e536cafb2..ae2b60fb5e 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -73,7 +73,12 @@ void machine_set_cpu_numa_node(MachineState *machine,
Error **errp);
void machine_class_allow_dynamic_sysbus_dev(MachineClass *mc, const char *type);
-
+/*
+ * Checks that backend isn't used, preps it for exclusive usage and
+ * returns migratable MemoryRegion provided by backend.
+ */
+MemoryRegion *machine_consume_memdev(MachineState *machine,
+ HostMemoryBackend *backend);
/**
* CPUArchId:
@@ -295,6 +300,11 @@ struct MachineState {
bool enable_graphics;
char *memory_encryption;
char *ram_memdev_id;
+ /*
+ * convenience alias to ram_memdev_id backend memory region
+ * or to numa container memory region
+ */
+ MemoryRegion *ram;
DeviceMemoryState *device_memory;
ram_addr_t ram_size;