diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index a5d5a6fb24..0b1b478b2a 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -8332,6 +8332,19 @@ qemu-kvm -net nic,model=? /dev/null
</label>
</target>
</memory>
+ <memory model='nvdimm'>
+ <source>
+ <path>/dev/dax0.0</path>
+ <pmem/>
+ </source>
+ <target>
+ <size unit='KiB'>524288</size>
+ <node>1</node>
+ <label>
+ <size unit='KiB'>128</size>
+ </label>
+ </target>
+ </memory>
</devices>
...
@@ -8422,6 +8435,17 @@ qemu-kvm -net nic,model=? /dev/null
Since 5.0.0
+
+ pmem
+
+
+ If persistent memory is supported and enabled by the hypervisor
+ in order to guarantee the persistence of writes to the vNVDIMM
+ backend, then use the pmem
element in order to
+ utilize the feature.
+ Since 5.0.0
+
+
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 21006c3b1d..a7b7164ad1 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -5393,6 +5393,11 @@
+
+
+
+
+
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 7e59d8c528..9edaf6d493 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -15785,6 +15785,9 @@ virDomainMemorySourceDefParseXML(xmlNodePtr node,
&def->alignsize, false, false) < 0)
goto cleanup;
+ if (virXPathBoolean("boolean(./pmem)", ctxt))
+ def->nvdimmPmem = true;
+
break;
case VIR_DOMAIN_MEMORY_MODEL_NONE:
@@ -22756,6 +22759,13 @@ virDomainMemoryDefCheckABIStability(virDomainMemoryDefPtr src,
src->alignsize, dst->alignsize);
return false;
}
+
+ if (src->nvdimmPmem != dst->nvdimmPmem) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("Target NVDIMM pmem flag doesn't match "
+ "source NVDIMM pmem flag"));
+ return false;
+ }
}
return virDomainDeviceInfoCheckABIStability(&src->info, &dst->info);
@@ -26296,6 +26306,9 @@ virDomainMemorySourceDefFormat(virBufferPtr buf,
if (def->alignsize)
virBufferAsprintf(buf, "%llu \n",
def->alignsize);
+
+ if (def->nvdimmPmem)
+ virBufferAddLit(buf, " \n");
break;
case VIR_DOMAIN_MEMORY_MODEL_NONE:
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 848bd94e12..a63afdca12 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2148,6 +2148,7 @@ struct _virDomainMemoryDef {
unsigned long long pagesize; /* kibibytes */
char *nvdimmPath;
unsigned long long alignsize; /* kibibytes; valid only for NVDIMM */
+ bool nvdimmPmem; /* valid only for NVDIMM */
/* target */
int model; /* virDomainMemoryModel */
diff --git a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-pmem.xml b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-pmem.xml
new file mode 100644
index 0000000000..060d75c541
--- /dev/null
+++ b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-pmem.xml
@@ -0,0 +1,58 @@
+
+ QEMUGuest1
+ c7a5fdbd-edaf-9455-926a-d65c16db1809
+ 1099511627776
+ 1267710
+ 1267710
+ 2
+
+ hvm
+
+
+
+
+
+
+
+
+
+ |
+
+
+
+ destroy
+ restart
+ destroy
+
+ /usr/bin/qemu-system-i686
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ /tmp/nvdimm
+
+
+
+ 523264
+ 0
+
+
+
+
+
diff --git a/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-pmem.xml b/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-pmem.xml
new file mode 120000
index 0000000000..3e57c1ec97
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-pmem.xml
@@ -0,0 +1 @@
+../qemuxml2argvdata/memory-hotplug-nvdimm-pmem.xml
\ No newline at end of file
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 5161f4a5af..ef3ece8902 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -1117,6 +1117,7 @@ mymain(void)
DO_TEST("memory-hotplug-nvdimm-access", NONE);
DO_TEST("memory-hotplug-nvdimm-label", NONE);
DO_TEST("memory-hotplug-nvdimm-align", NONE);
+ DO_TEST("memory-hotplug-nvdimm-pmem", NONE);
DO_TEST("net-udp", NONE);
DO_TEST("video-virtio-gpu-device", NONE);