Re: [PATCH v2 02/16] domain: add "vhostuser" attribute to virtio video model

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 8/23/19 12:21 PM, Cole Robinson wrote:
> From: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>
> 
> Accept a new attribute to specify usage of helper process, ex:
> 
>   <video>
>     <model type='virtio' vhostuser='yes'/>
>   </video>
> 

For other devices, we have

<interface type='vhostuser'>
<interface><driver name='vhost'/>
<hostdev type='scsi_host'><source protocol='vhost'>

Which is an attempt to make this more generic. IMO using vhostuser='yes'
and is the simplest match to qemu terminology but maybe other people
have stronger opinions.

> Signed-off-by: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>
> Signed-off-by: Cole Robinson <crobinso@xxxxxxxxxx>
> ---
>  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;

I assume you followed the example of 'primary', but this should be a
virTristateBool. Follow 'accel3d' parsing/formatting as an example

Thanks,
Cole

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux