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>
Signed-off-by: Cole Robinson <crobinso(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 fcb7c59c00..ec650fbe17 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -7039,6 +7039,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 c48f8c4f56..bac566855d 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -3581,7 +3581,6 @@
<value>vmvga</value>
<value>xen</value>
<value>vbox</value>
- <value>virtio</value>
<value>gop</value>
<value>none</value>
<value>bochs</value>
@@ -3607,6 +3606,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 b7a342bb91..f51575d57d 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -15358,6 +15358,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;
@@ -15376,6 +15377,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");
@@ -15408,6 +15410,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",
@@ -26486,6 +26498,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 33cef5b75c..bc2450f25e 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1424,6 +1424,7 @@ struct _virDomainVideoDef {
virDomainVideoDriverDefPtr driver;
virDomainDeviceInfo info;
virDomainVirtioOptionsPtr virtio;
+ bool vhostuser;
};
/* graphics console modes */
--
2.21.0