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(a)redhat.com>
Reviewed-by: Boris Fiuczynski <fiuczy(a)linux.ibm.com>
Signed-off-by: Bjoern Walk <bwalk(a)linux.ibm.com>
---
docs/schemas/domaincommon.rng | 5 +++++
src/conf/domain_conf.c | 28 ++++++++++++++++++++++++++++
src/conf/domain_conf.h | 1 +
3 files changed, 34 insertions(+)
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index dcf2e09d..12e842ce 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -5961,6 +5961,11 @@
<ref name="virOnOff"/>
</attribute>
</optional>
+ <optional>
+ <attribute name="packed">
+ <ref name="virOnOff"/>
+ </attribute>
+ </optional>
</define>
<define name="usbmaster">
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 460f8064..51fd5f15 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -1513,6 +1513,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;
}
@@ -5092,6 +5102,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;
}
@@ -7378,6 +7394,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));
+ }
}
@@ -22416,6 +22436,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;
}
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 2038b54c..22f6990e 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2417,6 +2417,7 @@ struct _virDomainVsockDef {
struct _virDomainVirtioOptions {
virTristateSwitch iommu;
virTristateSwitch ats;
+ virTristateSwitch packed;
};
/*
--
2.24.1