Re: [PATCHv4 5/6] conf: add caching_mode attribute to iommu device

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

 




On 05/03/2017 10:05 AM, Ján Tomko wrote:
> Add a new attribute to control the caching mode.
> 
> https://bugzilla.redhat.com/show_bug.cgi?id=1427005
> ---
>  docs/formatdomain.html.in                          |  9 ++++
>  docs/schemas/domaincommon.rng                      |  5 +++
>  src/conf/domain_conf.c                             | 24 +++++++++--
>  src/conf/domain_conf.h                             |  1 +
>  .../qemuxml2argv-intel-iommu-caching-mode.xml      | 50 ++++++++++++++++++++++
>  .../qemuxml2xmlout-intel-iommu-caching-mode.xml    |  1 +
>  tests/qemuxml2xmltest.c                            |  1 +
>  7 files changed, 88 insertions(+), 3 deletions(-)
>  create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-caching-mode.xml
>  create mode 120000 tests/qemuxml2xmloutdata/qemuxml2xmlout-intel-iommu-caching-mode.xml
> 
> diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
> index ca98f0e..4552037 100644
> --- a/docs/formatdomain.html.in
> +++ b/docs/formatdomain.html.in
> @@ -7426,6 +7426,15 @@ qemu-kvm -net nic,model=? /dev/null
>                <span class="since">Since 3.4.0</span> (QEMU/KVM only)
>              </p>
>            </dd>
> +          <dt><code>caching_mode</code></dt>
> +          <dd>
> +            <p>
> +              The <code>caching_mode</code> attribute with possible values
> +              <code>on</code> and <code>off</code> can be used to
> +              turn on the VT-d caching mode (useful for assigned devices)

s/)/).

<pesky period>

> +              <span class="since">Since 3.4.0</span> (QEMU/KVM only)
> +            </p>
> +          </dd>
>          </dl>
>        </dd>
>      </dl>

[...]

> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 4eefd92..ef31f4a 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -14176,6 +14176,15 @@ virDomainIOMMUDefParseXML(xmlNodePtr node,
>          iommu->intremap = val;
>      }
>  
> +    VIR_FREE(tmp);
> +    if ((tmp = virXPathString("string(./driver/@caching_mode)", ctxt))) {
> +        if ((val = virTristateSwitchTypeFromString(tmp)) < 0) {
> +            virReportError(VIR_ERR_XML_ERROR, _("unknown caching_mode value: %s"), tmp);
> +            goto cleanup;
> +        }
> +        iommu->caching_mode = val;
> +    }
> +
>      ret = iommu;
>      iommu = NULL;
>  
> @@ -24143,9 +24152,18 @@ virDomainIOMMUDefFormat(virBufferPtr buf,
>  
>      virBufferAdjustIndent(&childBuf, virBufferGetIndent(buf, false) + 2);
>  
> -    if (iommu->intremap != VIR_TRISTATE_SWITCH_ABSENT) {
> -        virBufferAsprintf(&childBuf, "<driver intremap='%s'/>\n",
> -                          virTristateSwitchTypeToString(iommu->intremap));
> +    if (iommu->intremap != VIR_TRISTATE_SWITCH_ABSENT ||
> +        iommu->caching_mode != VIR_TRISTATE_SWITCH_ABSENT) {
> +        virBufferAddLit(&childBuf, "<driver");
> +        if (iommu->intremap) {

Of course this only prints/works correctly because SWITCH_ABSENT = 0

Since you check below you should check here...


ACK w/ adjustments.

John

> +            virBufferAsprintf(&childBuf, " intremap='%s'",
> +                              virTristateSwitchTypeToString(iommu->intremap));
> +        }
> +        if (iommu->caching_mode != VIR_TRISTATE_SWITCH_ABSENT) {
> +            virBufferAsprintf(&childBuf, " caching_mode='%s'",
> +                              virTristateSwitchTypeToString(iommu->caching_mode));
> +        }
> +        virBufferAddLit(&childBuf, "/>\n");
>      }
>  
>      virBufferAsprintf(buf, "<iommu model='%s'",

[...]

--
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