提交 35eecdde 编写于 作者: M Martin Kletzander

conf: Add ioeventfd option for controllers

This will be used with a virtio-scsi controller later on.
Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
上级 2a5d3f22
...@@ -3000,6 +3000,14 @@ ...@@ -3000,6 +3000,14 @@
a sector is 512 bytes. a sector is 512 bytes.
<span class="since">Since 1.2.7 (QEMU and KVM only)</span> <span class="since">Since 1.2.7 (QEMU and KVM only)</span>
</dd> </dd>
<dt><code>ioeventfd</code></dt>
<dd>
The optional <code>ioeventfd</code> attribute specifies
whether the controller should use
<a href='https://patchwork.kernel.org/patch/43390/'>
I/O asynchronous handling</a> or not. Accepted values are
"on" and "off". <span class="since">Since 1.2.18</span>
</dd>
</dl> </dl>
<p> <p>
USB companion controllers have an optional USB companion controllers have an optional
......
...@@ -1832,6 +1832,9 @@ ...@@ -1832,6 +1832,9 @@
<ref name="unsignedInt"/> <ref name="unsignedInt"/>
</attribute> </attribute>
</optional> </optional>
<optional>
<ref name="ioeventfd"/>
</optional>
</element> </element>
</optional> </optional>
</interleave> </interleave>
......
...@@ -7824,6 +7824,7 @@ virDomainControllerDefParseXML(xmlNodePtr node, ...@@ -7824,6 +7824,7 @@ virDomainControllerDefParseXML(xmlNodePtr node,
char *chassisNr = NULL; char *chassisNr = NULL;
char *chassis = NULL; char *chassis = NULL;
char *port = NULL; char *port = NULL;
char *ioeventfd = NULL;
xmlNodePtr saved = ctxt->node; xmlNodePtr saved = ctxt->node;
int rc; int rc;
...@@ -7867,6 +7868,7 @@ virDomainControllerDefParseXML(xmlNodePtr node, ...@@ -7867,6 +7868,7 @@ virDomainControllerDefParseXML(xmlNodePtr node,
queues = virXMLPropString(cur, "queues"); queues = virXMLPropString(cur, "queues");
cmd_per_lun = virXMLPropString(cur, "cmd_per_lun"); cmd_per_lun = virXMLPropString(cur, "cmd_per_lun");
max_sectors = virXMLPropString(cur, "max_sectors"); max_sectors = virXMLPropString(cur, "max_sectors");
ioeventfd = virXMLPropString(cur, "ioeventfd");
} else if (xmlStrEqual(cur->name, BAD_CAST "model")) { } else if (xmlStrEqual(cur->name, BAD_CAST "model")) {
if (processedModel) { if (processedModel) {
virReportError(VIR_ERR_XML_ERROR, "%s", virReportError(VIR_ERR_XML_ERROR, "%s",
...@@ -7910,6 +7912,13 @@ virDomainControllerDefParseXML(xmlNodePtr node, ...@@ -7910,6 +7912,13 @@ virDomainControllerDefParseXML(xmlNodePtr node,
goto error; goto error;
} }
if (ioeventfd &&
(def->ioeventfd = virTristateSwitchTypeFromString(ioeventfd)) < 0) {
virReportError(VIR_ERR_XML_ERROR,
_("Malformed 'ioeventfd' value %s'"), max_sectors);
goto error;
}
if (def->type == VIR_DOMAIN_CONTROLLER_TYPE_USB && if (def->type == VIR_DOMAIN_CONTROLLER_TYPE_USB &&
def->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_NONE) { def->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_NONE) {
VIR_DEBUG("Ignoring device address for none model usb controller"); VIR_DEBUG("Ignoring device address for none model usb controller");
...@@ -8083,6 +8092,7 @@ virDomainControllerDefParseXML(xmlNodePtr node, ...@@ -8083,6 +8092,7 @@ virDomainControllerDefParseXML(xmlNodePtr node,
VIR_FREE(chassisNr); VIR_FREE(chassisNr);
VIR_FREE(chassis); VIR_FREE(chassis);
VIR_FREE(port); VIR_FREE(port);
VIR_FREE(ioeventfd);
return def; return def;
...@@ -19148,7 +19158,7 @@ virDomainControllerDefFormat(virBufferPtr buf, ...@@ -19148,7 +19158,7 @@ virDomainControllerDefFormat(virBufferPtr buf,
} }
if (pciModel || pciTarget || if (pciModel || pciTarget ||
def->queues || def->cmd_per_lun || def->max_sectors || def->queues || def->cmd_per_lun || def->max_sectors || def->ioeventfd ||
virDomainDeviceInfoNeedsFormat(&def->info, flags) || pcihole64) { virDomainDeviceInfoNeedsFormat(&def->info, flags) || pcihole64) {
virBufferAddLit(buf, ">\n"); virBufferAddLit(buf, ">\n");
virBufferAdjustIndent(buf, 2); virBufferAdjustIndent(buf, 2);
...@@ -19178,7 +19188,8 @@ virDomainControllerDefFormat(virBufferPtr buf, ...@@ -19178,7 +19188,8 @@ virDomainControllerDefFormat(virBufferPtr buf,
virBufferAddLit(buf, "/>\n"); virBufferAddLit(buf, "/>\n");
} }
if (def->queues || def->cmd_per_lun || def->max_sectors) { if (def->queues || def->cmd_per_lun ||
def->max_sectors || def->ioeventfd) {
virBufferAddLit(buf, "<driver"); virBufferAddLit(buf, "<driver");
if (def->queues) if (def->queues)
virBufferAsprintf(buf, " queues='%u'", def->queues); virBufferAsprintf(buf, " queues='%u'", def->queues);
...@@ -19188,6 +19199,11 @@ virDomainControllerDefFormat(virBufferPtr buf, ...@@ -19188,6 +19199,11 @@ virDomainControllerDefFormat(virBufferPtr buf,
if (def->max_sectors) if (def->max_sectors)
virBufferAsprintf(buf, " max_sectors='%u'", def->max_sectors); virBufferAsprintf(buf, " max_sectors='%u'", def->max_sectors);
if (def->ioeventfd) {
virBufferAsprintf(buf, " ioeventfd='%s'",
virTristateSwitchTypeToString(def->ioeventfd));
}
virBufferAddLit(buf, "/>\n"); virBufferAddLit(buf, "/>\n");
} }
......
...@@ -840,6 +840,7 @@ struct _virDomainControllerDef { ...@@ -840,6 +840,7 @@ struct _virDomainControllerDef {
unsigned int queues; unsigned int queues;
unsigned int cmd_per_lun; unsigned int cmd_per_lun;
unsigned int max_sectors; unsigned int max_sectors;
int ioeventfd; /* enum virTristateSwitch */
union { union {
virDomainVirtioSerialOpts vioserial; virDomainVirtioSerialOpts vioserial;
virDomainPCIControllerOpts pciopts; virDomainPCIControllerOpts pciopts;
......
<domain type='qemu'>
<name>QEMUGuest1</name>
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
<memory unit='KiB'>219136</memory>
<currentMemory unit='KiB'>219136</currentMemory>
<vcpu placement='static'>8</vcpu>
<os>
<type arch='i686' machine='pc'>hvm</type>
<boot dev='hd'/>
</os>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/qemu</emulator>
<disk type='block' device='disk'>
<source dev='/dev/HostVG/QEMUGuest1'/>
<target dev='sdb' bus='scsi'/>
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
</disk>
<controller type='usb' index='0'/>
<controller type='scsi' index='0' model='virtio-scsi'>
<driver ioeventfd='on'/>
</controller>
<controller type='pci' index='0' model='pci-root'/>
<memballoon model='virtio'/>
</devices>
</domain>
...@@ -420,6 +420,7 @@ mymain(void) ...@@ -420,6 +420,7 @@ mymain(void)
DO_TEST("disk-virtio-scsi-num_queues"); DO_TEST("disk-virtio-scsi-num_queues");
DO_TEST("disk-virtio-scsi-cmd_per_lun"); DO_TEST("disk-virtio-scsi-cmd_per_lun");
DO_TEST("disk-virtio-scsi-max_sectors"); DO_TEST("disk-virtio-scsi-max_sectors");
DO_TEST("disk-virtio-scsi-ioeventfd");
DO_TEST("disk-scsi-megasas"); DO_TEST("disk-scsi-megasas");
DO_TEST_DIFFERENT("disk-mirror-old"); DO_TEST_DIFFERENT("disk-mirror-old");
DO_TEST_FULL("disk-mirror", false, WHEN_ACTIVE); DO_TEST_FULL("disk-mirror", false, WHEN_ACTIVE);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册