From: Marc-André Lureau <marcandre.lureau(a)redhat.com>
Accept a new attribute to specify usage of helper process, ex:
<video>
<model type='virtio' vhostuser='yes'/>
</video>
Signed-off-by: Marc-André Lureau <marcandre.lureau(a)redhat.com>
---
docs/formatdomain.html.in | 6 ++++++
docs/schemas/domaincommon.rng | 11 ++++++++++-
src/conf/domain_conf.c | 14 ++++++++++++++
src/conf/domain_conf.h | 1 +
4 files changed, 31 insertions(+), 1 deletion(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 22ddcb71d3..d2cc8c00b5 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -7018,6 +7018,12 @@ qemu-kvm -net nic,model=? /dev/null
Attribute <code>vram64</code> (<span
class="since">since 1.3.3</span>)
extends secondary bar and makes it addressable as 64bit memory.
</p>
+ <p>
+ For guest type "kvm" and model type "virtio" there are
+ optional attributes. Attribute <code>vhost-user</code>
+ (<span class="since">since 5.5.0</span>) specify that a
+ vhost-user helper process should be associated with the GPU.
+ </p>
</dd>
<dt><code>acceleration</code></dt>
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 4bd75e3055..e249d5f8f0 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -3573,7 +3573,6 @@
<value>vmvga</value>
<value>xen</value>
<value>vbox</value>
- <value>virtio</value>
<value>gop</value>
<value>none</value>
</choice>
@@ -3598,6 +3597,16 @@
</attribute>
</optional>
</group>
+ <group>
+ <attribute name="type">
+ <value>virtio</value>
+ </attribute>
+ <optional>
+ <attribute name="vhostuser">
+ <ref name="virYesNo"/>
+ </attribute>
+ </optional>
+ </group>
</choice>
<optional>
<attribute name="vram">
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 97ba8bd53a..916440256a 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -15311,6 +15311,7 @@ virDomainVideoDefParseXML(virDomainXMLOptionPtr xmlopt,
xmlNodePtr cur;
VIR_XPATH_NODE_AUTORESTORE(ctxt);
VIR_AUTOFREE(char *) type = NULL;
+ VIR_AUTOFREE(char *) vhostuser = NULL;
VIR_AUTOFREE(char *) heads = NULL;
VIR_AUTOFREE(char *) vram = NULL;
VIR_AUTOFREE(char *) vram64 = NULL;
@@ -15329,6 +15330,7 @@ virDomainVideoDefParseXML(virDomainXMLOptionPtr xmlopt,
if (!type && !vram && !ram && !heads &&
virXMLNodeNameEqual(cur, "model")) {
type = virXMLPropString(cur, "type");
+ vhostuser = virXMLPropString(cur, "vhostuser");
ram = virXMLPropString(cur, "ram");
vram = virXMLPropString(cur, "vram");
vram64 = virXMLPropString(cur, "vram64");
@@ -15361,6 +15363,16 @@ virDomainVideoDefParseXML(virDomainXMLOptionPtr xmlopt,
def->type = virDomainVideoDefaultType(dom);
}
+ if (vhostuser != NULL) {
+ if (virStringParseYesNo(vhostuser, &def->vhostuser) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unknown vhostuser value '%s'"),
vhostuser);
+ goto cleanup;
+ }
+ } else {
+ def->vhostuser = false;
+ }
+
if (ram) {
if (def->type != VIR_DOMAIN_VIDEO_TYPE_QXL) {
virReportError(VIR_ERR_XML_ERROR, "%s",
@@ -26364,6 +26376,8 @@ virDomainVideoDefFormat(virBufferPtr buf,
virBufferAsprintf(buf, " heads='%u'", def->heads);
if (def->primary)
virBufferAddLit(buf, " primary='yes'");
+ if (def->vhostuser)
+ virBufferAddLit(buf, " vhostuser='yes'");
if (def->accel) {
virBufferAddLit(buf, ">\n");
virBufferAdjustIndent(buf, 2);
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 4c3ab07062..a62b35b092 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1419,6 +1419,7 @@ struct _virDomainVideoDef {
virDomainVideoDriverDefPtr driver;
virDomainDeviceInfo info;
virDomainVirtioOptionsPtr virtio;
+ bool vhostuser;
};
/* graphics console modes */
--
2.22.0.rc2.384.g1a9a72ea1d