summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorIgor Mammedov2020-02-19 17:08:37 +0100
committerPatchew Importer2020-02-19 17:49:53 +0100
commit900c0ba373aada4c13d47d95330aa72ec4067ba5 (patch)
tree33a2a784e058d805440f8e2c8f7dac7ba6f4a1a5 /include
parentmachine: introduce memory-backend property (diff)
downloadqemu-900c0ba373aada4c13d47d95330aa72ec4067ba5.tar.gz
qemu-900c0ba373aada4c13d47d95330aa72ec4067ba5.tar.xz
qemu-900c0ba373aada4c13d47d95330aa72ec4067ba5.zip
machine: alias -mem-path and -mem-prealloc into memory-foo backend
Allow machine to opt in for hostmem backend based initial RAM even if user uses old -mem-path/prealloc options by providing MachineClass::default_ram_id Follow up patches will incrementally convert machines to new API, by dropping memory_region_allocate_system_memory() and setting default_ram_id that board used to use before conversion to keep migration stream the same. Signed-off-by: Igor Mammedov <imammedo@redhat.com> Message-Id: <20200219160953.13771-4-imammedo@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/hw/boards.h8
-rw-r--r--include/sysemu/hostmem.h16
2 files changed, 24 insertions, 0 deletions
diff --git a/include/hw/boards.h b/include/hw/boards.h
index 7b4b6b79d7..8e536cafb2 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -170,6 +170,13 @@ typedef struct {
* false is returned, an error must be set to show the reason of
* the rejection. If the hook is not provided, all hotplug will be
* allowed.
+ * @default_ram_id:
+ * Specifies inital RAM MemoryRegion name to be used for default backend
+ * creation if user explicitly hasn't specified backend with "memory-backend"
+ * property.
+ * It also will be used as a way to optin into "-m" option support.
+ * If it's not set by board, '-m' will be ignored and generic code will
+ * not create default RAM MemoryRegion.
*/
struct MachineClass {
/*< private >*/
@@ -226,6 +233,7 @@ struct MachineClass {
bool nvdimm_supported;
bool numa_mem_supported;
bool auto_enable_numa;
+ const char *default_ram_id;
HotplugHandler *(*get_hotplug_handler)(MachineState *machine,
DeviceState *dev);
diff --git a/include/sysemu/hostmem.h b/include/sysemu/hostmem.h
index 4dbdadd39e..5db0d668ec 100644
--- a/include/sysemu/hostmem.h
+++ b/include/sysemu/hostmem.h
@@ -27,6 +27,22 @@
#define MEMORY_BACKEND_CLASS(klass) \
OBJECT_CLASS_CHECK(HostMemoryBackendClass, (klass), TYPE_MEMORY_BACKEND)
+/* hostmem-ram.c */
+/**
+ * @TYPE_MEMORY_BACKEND_RAM:
+ * name of backend that uses mmap on the anonymous RAM
+ */
+
+#define TYPE_MEMORY_BACKEND_RAM "memory-backend-ram"
+
+/* hostmem-file.c */
+/**
+ * @TYPE_MEMORY_BACKEND_FILE:
+ * name of backend that uses mmap on a file descriptor
+ */
+#define TYPE_MEMORY_BACKEND_FILE "memory-backend-file"
+
+typedef struct HostMemoryBackend HostMemoryBackend;
typedef struct HostMemoryBackendClass HostMemoryBackendClass;
/**