summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--hw/core/machine.c24
-rw-r--r--include/hw/boards.h2
2 files changed, 26 insertions, 0 deletions
diff --git a/hw/core/machine.c b/hw/core/machine.c
index 84812a1d1c..1a6e485c87 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);
diff --git a/include/hw/boards.h b/include/hw/boards.h
index fb1b43d5b9..7b4b6b79d7 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -4,6 +4,7 @@
#define HW_BOARDS_H
#include "exec/memory.h"
+#include "sysemu/hostmem.h"
#include "sysemu/blockdev.h"
#include "sysemu/accel.h"
#include "qapi/qapi-types-machine.h"
@@ -285,6 +286,7 @@ struct MachineState {
bool enforce_config_section;
bool enable_graphics;
char *memory_encryption;
+ char *ram_memdev_id;
DeviceMemoryState *device_memory;
ram_addr_t ram_size;