summaryrefslogtreecommitdiffstats
path: root/hw/i386
diff options
context:
space:
mode:
authorIgor Mammedov <imammedo@redhat.com>2014-06-02 15:25:27 +0200
committerMichael S. Tsirkin <mst@redhat.com>2014-06-19 16:41:52 +0300
commitbf1e89395996c3a4c888faf297433482934ec007 (patch)
treefdcd820f6a4bfee06d006d3f66825537d70fd672 /hw/i386
parentbef3492d1169a54c966cecd0e0b1dd25e9341582 (diff)
downloadhqemu-bf1e89395996c3a4c888faf297433482934ec007.zip
hqemu-bf1e89395996c3a4c888faf297433482934ec007.tar.gz
pc: add "hotplug-memory-region-size" property to PC_MACHINE
... it will be used by acpi-build code and by unit tests Signed-off-by: Igor Mammedov <imammedo@redhat.com> Acked-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/i386')
-rw-r--r--hw/i386/pc.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 0bedd46..fec1e13 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -60,6 +60,7 @@
#include "acpi-build.h"
#include "hw/mem/pc-dimm.h"
#include "trace.h"
+#include "qapi/visitor.h"
/* debug PC/ISA interrupts */
//#define DEBUG_IRQ
@@ -1629,6 +1630,23 @@ static HotplugHandler *pc_get_hotpug_handler(MachineState *machine,
pcmc->get_hotplug_handler(machine, dev) : NULL;
}
+static void
+pc_machine_get_hotplug_memory_region_size(Object *obj, Visitor *v, void *opaque,
+ const char *name, Error **errp)
+{
+ PCMachineState *pcms = PC_MACHINE(obj);
+ int64_t value = memory_region_size(&pcms->hotplug_memory);
+
+ visit_type_int(v, &value, name, errp);
+}
+
+static void pc_machine_initfn(Object *obj)
+{
+ object_property_add(obj, PC_MACHINE_MEMHP_REGION_SIZE, "int",
+ pc_machine_get_hotplug_memory_region_size,
+ NULL, NULL, NULL, NULL);
+}
+
static void pc_machine_class_init(ObjectClass *oc, void *data)
{
MachineClass *mc = MACHINE_CLASS(oc);
@@ -1645,6 +1663,7 @@ static const TypeInfo pc_machine_info = {
.parent = TYPE_MACHINE,
.abstract = true,
.instance_size = sizeof(PCMachineState),
+ .instance_init = pc_machine_initfn,
.class_size = sizeof(PCMachineClass),
.class_init = pc_machine_class_init,
.interfaces = (InterfaceInfo[]) {
OpenPOWER on IntegriCloud