aboutsummaryrefslogtreecommitdiff
path: root/hw/mem
diff options
context:
space:
mode:
authorBharata B Rao <bharata@linux.vnet.ibm.com>2015-01-27 09:35:01 +0530
committerMichael S. Tsirkin <mst@redhat.com>2015-01-27 14:46:18 +0200
commit9967c94957f60c2d1cadbe0bfd4373a13fb1a226 (patch)
treee879370f9121fba989e85d64fccb0bf6d165d94e /hw/mem
parent759048ac20174b34fa7a593f4da2e7fed34e599c (diff)
downloadqemu-9967c94957f60c2d1cadbe0bfd4373a13fb1a226.zip
qemu-9967c94957f60c2d1cadbe0bfd4373a13fb1a226.tar.gz
qemu-9967c94957f60c2d1cadbe0bfd4373a13fb1a226.tar.bz2
pc-dimm: Make pc_existing_dimms_capacity global
Move pc_existing_dimms_capacity() to pc-dimm.c since it would be needed by PowerPC memory hotplug code too. Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com> Reviewed-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/mem')
-rw-r--r--hw/mem/pc-dimm.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c
index d431834..f02ce6e 100644
--- a/hw/mem/pc-dimm.c
+++ b/hw/mem/pc-dimm.c
@@ -22,6 +22,31 @@
#include "qemu/config-file.h"
#include "qapi/visitor.h"
#include "qemu/range.h"
+#include "qapi/qmp/qerror.h"
+
+int pc_existing_dimms_capacity(Object *obj, void *opaque)
+{
+ Error *local_err = NULL;
+ uint64_t *size = opaque;
+
+ if (object_dynamic_cast(obj, TYPE_PC_DIMM)) {
+ DeviceState *dev = DEVICE(obj);
+
+ if (dev->realized) {
+ (*size) += object_property_get_int(obj, PC_DIMM_SIZE_PROP,
+ &local_err);
+ }
+
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return 1;
+ }
+ }
+
+ object_child_foreach(obj, pc_existing_dimms_capacity, opaque);
+ return 0;
+}
int qmp_pc_dimm_device_list(Object *obj, void *opaque)
{