diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 0189920a84..a8a4191081 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -1417,7 +1417,7 @@
Since 1.2.9 the optional attribute
memAccess
can control whether the memory is to be
mapped as "shared" or "private". This is valid only for
- hugepages-backed memory.
+ hugepages-backed memory and nvdimm modules.
@@ -7100,7 +7100,7 @@ qemu-kvm -net nic,model=? /dev/null
...
<devices>
- <memory model='dimm'>
+ <memory model='dimm' access='private'>
<target>
<size unit='KiB'>524287</size>
<node>0</node>
@@ -7139,6 +7139,18 @@ qemu-kvm -net nic,model=? /dev/null
+ access
+
+
+ An optional attribute access
+ (since 3.2.0 ) that provides
+ capability to fine tune mapping of the memory on per
+ module basis. Values are the same as
+ Memory Backing :
+ shared
and private
.
+
+
+
source
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 2f6a6db8e8..1b7b3c7938 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -4750,6 +4750,14 @@
nvdimm
+
+
+
+ shared
+ private
+
+
+
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 9713bfc402..7f6eeafbe6 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -13821,6 +13821,15 @@ virDomainMemoryDefParseXML(xmlNodePtr memdevNode,
}
VIR_FREE(tmp);
+ tmp = virXMLPropString(memdevNode, "access");
+ if (tmp &&
+ (def->access = virDomainMemoryAccessTypeFromString(tmp)) <= 0) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("invalid access mode '%s'"), tmp);
+ goto error;
+ }
+ VIR_FREE(tmp);
+
/* source */
if ((node = virXPathNode("./source", ctxt)) &&
virDomainMemorySourceDefParseXML(node, ctxt, def) < 0)
@@ -22627,7 +22636,11 @@ virDomainMemoryDefFormat(virBufferPtr buf,
{
const char *model = virDomainMemoryModelTypeToString(def->model);
- virBufferAsprintf(buf, "\n", model);
+ virBufferAsprintf(buf, "access)
+ virBufferAsprintf(buf, " access='%s'",
+ virDomainMemoryAccessTypeToString(def->access));
+ virBufferAddLit(buf, ">\n");
virBufferAdjustIndent(buf, 2);
if (virDomainMemorySourceDefFormat(buf, def) < 0)
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 2eff9f74a4..16e1432198 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2003,6 +2003,8 @@ typedef enum {
} virDomainMemoryModel;
struct _virDomainMemoryDef {
+ virDomainMemoryAccess access;
+
/* source */
virBitmapPtr sourceNodes;
unsigned long long pagesize; /* kibibytes */
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-memory-hotplug-nvdimm-access.xml b/tests/qemuxml2argvdata/qemuxml2argv-memory-hotplug-nvdimm-access.xml
new file mode 100644
index 0000000000..700e961a6e
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-memory-hotplug-nvdimm-access.xml
@@ -0,0 +1,56 @@
+
+ QEMUGuest1
+ c7a5fdbd-edaf-9455-926a-d65c16db1809
+ 1099511627776
+ 1267710
+ 1267710
+ 2
+
+ hvm
+
+
+
+
+
+
+
+
+
+ |
+
+
+
+ destroy
+ restart
+ destroy
+
+ /usr/bin/qemu
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ /tmp/nvdimm
+
+
+ 523264
+ 0
+
+
+
+
+
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-memory-hotplug-nvdimm-access.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-memory-hotplug-nvdimm-access.xml
new file mode 120000
index 0000000000..898283aaee
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-memory-hotplug-nvdimm-access.xml
@@ -0,0 +1 @@
+../qemuxml2argvdata/qemuxml2argv-memory-hotplug-nvdimm-access.xml
\ No newline at end of file
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index e1c341dd5c..ef49a79ca5 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -1079,6 +1079,7 @@ mymain(void)
DO_TEST("memory-hotplug-nonuma", NONE);
DO_TEST("memory-hotplug-dimm", NONE);
DO_TEST("memory-hotplug-nvdimm", NONE);
+ DO_TEST("memory-hotplug-nvdimm-access", NONE);
DO_TEST("net-udp", NONE);
DO_TEST("video-virtio-gpu-device", NONE);