diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 0189920a84e7fa6e12a599c41431a9535a2cc922..a8a4191081da305c899a65c96a3b8466b5d87c40 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 2f6a6db8e89eca50f7be4fe6f0c9a5a8d4be61b8..1b7b3c79386d234ddc38ac923521de7eec9d955a 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 9713bfc40239234109dd4e4b8e6c7f958b62dad3..7f6eeafbe637010892e3ff59b9633cab56d49689 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 2eff9f74a4f1bc265ae5d91469a8f61753dc7497..16e14321985090d82f77c494274df2f97ab84002 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 0000000000000000000000000000000000000000..700e961a6e9ef0eea956be314f71af46907946bb --- /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 0000000000000000000000000000000000000000..898283aaeeb12139023d069aad4592fd8c1dc1be --- /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 e1c341dd5c918a6acc110fef9a046ab41609ec75..ef49a79ca5b371422923f9b764ca51f501390da9 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);