aboutsummaryrefslogtreecommitdiff
path: root/include/hw/mem
diff options
context:
space:
mode:
authorHaozhong Zhang <haozhong.zhang@intel.com>2017-12-11 15:28:06 +0800
committerEduardo Habkost <ehabkost@redhat.com>2018-01-19 11:18:51 -0200
commitcb836434cda103fac3c06174e70bf5c9b7083b8e (patch)
treedbdfa8f28c5c8bd9d9811e5395fd4c65a8764b04 /include/hw/mem
parentda6789c27c2ea71765cfab04bad9a42b5426f0bd (diff)
nvdimm: add 'unarmed' option
Currently the only vNVDIMM backend can guarantee the guest write persistence is device DAX on Linux, because no host-side kernel cache is involved in the guest access to it. The approach to detect whether the backend is device DAX needs to access sysfs, which may not work with SELinux. Instead, we add the 'unarmed' option to device 'nvdimm', so that users or management utils, which have enough knowledge about the backend, can control the unarmed flag in guest ACPI NFIT via this option. The guest Linux NVDIMM driver, for example, will mark the corresponding vNVDIMM device read-only if the unarmed flag in guest NFIT is set. The default value of 'unarmed' option is 'off' in order to keep the backwards compatibility. Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com> Message-Id: <20171211072806.2812-4-haozhong.zhang@intel.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'include/hw/mem')
-rw-r--r--include/hw/mem/nvdimm.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/hw/mem/nvdimm.h b/include/hw/mem/nvdimm.h
index 28e68ddf59..7fd87c4e1c 100644
--- a/include/hw/mem/nvdimm.h
+++ b/include/hw/mem/nvdimm.h
@@ -49,6 +49,7 @@
TYPE_NVDIMM)
#define NVDIMM_LABLE_SIZE_PROP "label-size"
+#define NVDIMM_UNARMED_PROP "unarmed"
struct NVDIMMDevice {
/* private */
@@ -74,6 +75,14 @@ struct NVDIMMDevice {
* guest via ACPI NFIT and _FIT method if NVDIMM hotplug is supported.
*/
MemoryRegion nvdimm_mr;
+
+ /*
+ * The 'on' value results in the unarmed flag set in ACPI NFIT,
+ * which can be used to notify guest implicitly that the host
+ * backend (e.g., files on HDD, /dev/pmemX, etc.) cannot guarantee
+ * the guest write persistence.
+ */
+ bool unarmed;
};
typedef struct NVDIMMDevice NVDIMMDevice;