conf: domain: support for virtio packed option

Expose the virtio parameter for packed virtqueues as an optional libvirt
XML attribute to virtio-backed devices, e.g.:

    <interface type='user'>
      <mac address='00:11:22:33:44:55'/>
      <model type='virtio'/>
      <driver packed='on'/>
    </interface>

If the attribute is omitted, the default value for this attribute is 'off' and
regular split virtqueues are used.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Signed-off-by: Bjoern Walk <bwalk@linux.ibm.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Bjoern Walk 2020-04-06 15:13:25 +02:00 committed by Ján Tomko
parent 979500e1c1
commit 0e3b30944d
3 changed files with 34 additions and 0 deletions

View File

@ -5961,6 +5961,11 @@
<ref name="virOnOff"/>
</attribute>
</optional>
<optional>
<attribute name="packed">
<ref name="virOnOff"/>
</attribute>
</optional>
</define>
<define name="usbmaster">

View File

@ -1512,6 +1512,16 @@ virDomainVirtioOptionsParseXML(xmlNodePtr driver,
}
res->ats = val;
}
VIR_FREE(str);
if ((str = virXMLPropString(driver, "packed"))) {
if ((val = virTristateSwitchTypeFromString(str)) <= 0) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("invalid packed value"));
return -1;
}
res->packed = val;
}
return 0;
}
@ -5091,6 +5101,12 @@ virDomainCheckVirtioOptions(virDomainVirtioOptionsPtr virtio)
"for virtio devices"));
return -1;
}
if (virtio->packed != VIR_TRISTATE_SWITCH_ABSENT) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("packed driver option is only supported "
"for virtio devices"));
return -1;
}
return 0;
}
@ -7377,6 +7393,10 @@ virDomainVirtioOptionsFormat(virBufferPtr buf,
virBufferAsprintf(buf, " ats='%s'",
virTristateSwitchTypeToString(virtio->ats));
}
if (virtio->packed != VIR_TRISTATE_SWITCH_ABSENT) {
virBufferAsprintf(buf, " packed='%s'",
virTristateSwitchTypeToString(virtio->packed));
}
}
@ -22415,6 +22435,14 @@ virDomainVirtioOptionsCheckABIStability(virDomainVirtioOptionsPtr src,
virTristateSwitchTypeToString(src->ats));
return false;
}
if (src->packed != dst->packed) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Target device packed option '%s' does not "
"match source '%s'"),
virTristateSwitchTypeToString(dst->packed),
virTristateSwitchTypeToString(src->packed));
return false;
}
return true;
}

View File

@ -2417,6 +2417,7 @@ struct _virDomainVsockDef {
struct _virDomainVirtioOptions {
virTristateSwitch iommu;
virTristateSwitch ats;
virTristateSwitch packed;
};
/*