aboutsummaryrefslogtreecommitdiff
path: root/hw/mem/pc-dimm.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2015-01-27 13:17:30 +0000
committerPeter Maydell <peter.maydell@linaro.org>2015-01-27 13:17:30 +0000
commitb00c92e3ef59b78f6029d66353aaf995ceaa6605 (patch)
tree64a5c75792722835949ec417b270fddf71de23ac /hw/mem/pc-dimm.c
parent7baef630732a50fcbb7ca5b1e9cc0ecf4f2998c9 (diff)
parent37153450436f58449ce7e41d13a23821611e889e (diff)
Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging
pci, pc, virtio fixes and cleanups A bunch of fixes all over the place. Also, beginning to generalize acpi build code for reuse by ARM. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> # gpg: Signature made Tue 27 Jan 2015 13:12:25 GMT using RSA key ID D28D5469 # gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>" # gpg: aka "Michael S. Tsirkin <mst@redhat.com>" * remotes/mst/tags/for_upstream: pc-dimm: Add Error argument to pc_existing_dimms_capacity pc-dimm: Make pc_existing_dimms_capacity global pc: Fix DIMMs capacity calculation smbios: Don't report unknown CPU speed (fix SVVP regression) smbios: Fix dimm size calculation when RAM is multiple of 16GB bios-linker-loader: move source to common location bios-linker-loader: move header to common location virtio: fix feature bit checks bios-tables-test: split piix4 and q35 tests acpi: build_append_nameseg(): add padding if necessary acpi: update generated hex files acpi-test: update expected DSDT pc: acpi: fix WindowsXP BSOD when memory hotplug is enabled pci: Split pcie_host_mmcfg_map() Add some trace calls to pci.c. ich9: add disable_s3, disable_s4, s4_val properties Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/mem/pc-dimm.c')
-rw-r--r--hw/mem/pc-dimm.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c
index d431834030..18cdc54bf9 100644
--- a/hw/mem/pc-dimm.c
+++ b/hw/mem/pc-dimm.c
@@ -23,6 +23,43 @@
#include "qapi/visitor.h"
#include "qemu/range.h"
+typedef struct pc_dimms_capacity {
+ uint64_t size;
+ Error **errp;
+} pc_dimms_capacity;
+
+static int pc_existing_dimms_capacity_internal(Object *obj, void *opaque)
+{
+ pc_dimms_capacity *cap = opaque;
+ uint64_t *size = &cap->size;
+
+ 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,
+ cap->errp);
+ }
+
+ if (cap->errp && *cap->errp) {
+ return 1;
+ }
+ }
+ object_child_foreach(obj, pc_existing_dimms_capacity_internal, opaque);
+ return 0;
+}
+
+uint64_t pc_existing_dimms_capacity(Error **errp)
+{
+ pc_dimms_capacity cap;
+
+ cap.size = 0;
+ cap.errp = errp;
+
+ pc_existing_dimms_capacity_internal(qdev_get_machine(), &cap);
+ return cap.size;
+}
+
int qmp_pc_dimm_device_list(Object *obj, void *opaque)
{
MemoryDeviceInfoList ***prev = opaque;