aboutsummaryrefslogtreecommitdiff
path: root/hw/core
diff options
context:
space:
mode:
authorIgor Mammedov <imammedo@redhat.com>2020-02-19 11:08:36 -0500
committerPatchew Importer <importer@patchew.org>2020-02-19 16:49:53 +0000
commitaa8b183974b27d4dc025905eb869a1941e85e17d (patch)
tree4cc744fbd54e764212e52d88d24f359f4e50c8db /hw/core
parent68a86dc15ccdf0f1242dc71b3d8da18a3ee6b8be (diff)
downloadqemu-aa8b183974b27d4dc025905eb869a1941e85e17d.zip
qemu-aa8b183974b27d4dc025905eb869a1941e85e17d.tar.gz
qemu-aa8b183974b27d4dc025905eb869a1941e85e17d.tar.bz2
machine: introduce memory-backend property
Property will contain link to memory backend that will be used for backing initial RAM. Follow up commit will alias -mem-path and -mem-prealloc CLI options into memory backend options to make memory handling consistent (using only hostmem backend family for guest RAM allocation). Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20200219160953.13771-3-imammedo@redhat.com>
Diffstat (limited to 'hw/core')
-rw-r--r--hw/core/machine.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/hw/core/machine.c b/hw/core/machine.c
index 84812a1..1a6e485 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -508,6 +508,22 @@ static void validate_sysbus_device(SysBusDevice *sbdev, void *opaque)
}
}
+static char *machine_get_memdev(Object *obj, Error **errp)
+{
+ MachineState *ms = MACHINE(obj);
+
+ return g_strdup(ms->ram_memdev_id);
+}
+
+static void machine_set_memdev(Object *obj, const char *value, Error **errp)
+{
+ MachineState *ms = MACHINE(obj);
+
+ g_free(ms->ram_memdev_id);
+ ms->ram_memdev_id = g_strdup(value);
+}
+
+
static void machine_init_notify(Notifier *notifier, void *data)
{
MachineState *machine = MACHINE(qdev_get_machine());
@@ -889,6 +905,14 @@ static void machine_initfn(Object *obj)
"Table (HMAT)", NULL);
}
+ object_property_add_str(obj, "memory-backend",
+ machine_get_memdev, machine_set_memdev,
+ &error_abort);
+ object_property_set_description(obj, "memory-backend",
+ "Set RAM backend"
+ "Valid value is ID of hostmem based backend",
+ &error_abort);
+
/* Register notifier when init is done for sysbus sanity checks */
ms->sysbus_notifier.notify = machine_init_notify;
qemu_add_machine_init_done_notifier(&ms->sysbus_notifier);