aboutsummaryrefslogtreecommitdiff
path: root/hw/mem/nvdimm.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2018-01-19 16:35:25 +0000
committerPeter Maydell <peter.maydell@linaro.org>2018-01-19 16:35:25 +0000
commitb384cd95eb9c6f73ad84ed1bb0717a26e29cc78f (patch)
treebbd0e7a39efd262c9196edea6d75a88d47557d8a /hw/mem/nvdimm.c
parent3e5bdc6573edf0585e4085e6a4e349b135abf3b4 (diff)
parentd6b6abc51dda79a97f2c7bd6652c1940c068f1ec (diff)
Merge remote-tracking branch 'remotes/ehabkost/tags/machine-next-pull-request' into staging
machine queue, 2018-01-19 # gpg: Signature made Fri 19 Jan 2018 16:30:19 GMT # gpg: using RSA key 0x2807936F984DC5A6 # gpg: Good signature from "Eduardo Habkost <ehabkost@redhat.com>" # Primary key fingerprint: 5A32 2FD5 ABC4 D3DB ACCF D1AA 2807 936F 984D C5A6 * remotes/ehabkost/tags/machine-next-pull-request: fw_cfg: fix memory corruption when all fw_cfg slots are used possible_cpus: add CPUArchId::type field nvdimm: add 'unarmed' option nvdimm: add a macro for property "label-size" hostmem-file: add "align" option scripts: Remove fixed entries from the device-crash-test qdev: Check for the availability of a hotplug controller before adding a device qdev_monitor: Simplify error handling in qdev_device_add() q35: Allow only supported dynamic sysbus devices xen: Add only xen-sysdev to dynamic sysbus device list spapr: Allow only supported dynamic sysbus devices ppc: e500: Allow only supported dynamic sysbus devices hw/arm/virt: Allow only supported dynamic sysbus devices machine: Replace has_dynamic_sysbus with list of allowed devices numa: fix missing '-numa cpu' in '-help' output qemu-options: document memory-backend-ram qemu-options: document missing memory-backend-file options memfd: remove needless include memfd: split qemu_memfd_alloc() Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/mem/nvdimm.c')
-rw-r--r--hw/mem/nvdimm.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/hw/mem/nvdimm.c b/hw/mem/nvdimm.c
index 952fce5ec8..61e677f92f 100644
--- a/hw/mem/nvdimm.c
+++ b/hw/mem/nvdimm.c
@@ -25,6 +25,7 @@
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qapi/visitor.h"
+#include "qapi-visit.h"
#include "hw/mem/nvdimm.h"
static void nvdimm_get_label_size(Object *obj, Visitor *v, const char *name,
@@ -64,11 +65,36 @@ out:
error_propagate(errp, local_err);
}
+static bool nvdimm_get_unarmed(Object *obj, Error **errp)
+{
+ NVDIMMDevice *nvdimm = NVDIMM(obj);
+
+ return nvdimm->unarmed;
+}
+
+static void nvdimm_set_unarmed(Object *obj, bool value, Error **errp)
+{
+ NVDIMMDevice *nvdimm = NVDIMM(obj);
+ Error *local_err = NULL;
+
+ if (memory_region_size(&nvdimm->nvdimm_mr)) {
+ error_setg(&local_err, "cannot change property value");
+ goto out;
+ }
+
+ nvdimm->unarmed = value;
+
+ out:
+ error_propagate(errp, local_err);
+}
+
static void nvdimm_init(Object *obj)
{
- object_property_add(obj, "label-size", "int",
+ object_property_add(obj, NVDIMM_LABLE_SIZE_PROP, "int",
nvdimm_get_label_size, nvdimm_set_label_size, NULL,
NULL, NULL);
+ object_property_add_bool(obj, NVDIMM_UNARMED_PROP,
+ nvdimm_get_unarmed, nvdimm_set_unarmed, NULL);
}
static MemoryRegion *nvdimm_get_memory_region(PCDIMMDevice *dimm, Error **errp)