conf: Add page_per_vq for driver element

Signed-off-by: Han Han <hhan@redhat.com>
Signed-off-by: Gavi Teitz <gavi@nvidia.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Han Han 2021-10-15 14:09:29 +08:00 committed by Michal Privoznik
parent 61cb54e3cb
commit 388cdd11f3
5 changed files with 37 additions and 0 deletions

View File

@ -3577,6 +3577,15 @@ virtqueues are actually used depends on the feature negotiation between QEMU,
vhost backends and guest drivers. Possible values are ``on`` or ``off``.
:since:`Since 6.3.0 (QEMU and KVM only)`
This optional attribute ``page_per_vq`` controls the layout of the notification
capabilities exposed to the guest. When enabled, each virtio queue will have a
dedicated page on the device BAR exposed to the guest. It is recommended to be
used when vDPA is enabled on the hypervisor, as it enables mapping the
notification area to the physical device, which is only supported in page
granularity. The default is determined by QEMU. :since:`Since 7.8.0 (QEMU 2.8)`
Note: In general you should leave this option alone, unless you are very certain
you know what you are doing.
:anchor:`<a id="elementsVirtioTransitional"/>`
Virtio transitional devices

View File

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

View File

@ -1636,6 +1636,10 @@ virDomainVirtioOptionsParseXML(xmlNodePtr driver,
&(*virtio)->packed) < 0)
return -1;
if (virXMLPropTristateSwitch(driver, "page_per_vq", VIR_XML_PROP_NONE,
&(*virtio)->page_per_vq) < 0)
return -1;
return 0;
}
@ -6321,6 +6325,10 @@ virDomainVirtioOptionsFormat(virBuffer *buf,
virBufferAsprintf(buf, " packed='%s'",
virTristateSwitchTypeToString(virtio->packed));
}
if (virtio->page_per_vq != VIR_TRISTATE_SWITCH_ABSENT) {
virBufferAsprintf(buf, " page_per_vq='%s'",
virTristateSwitchTypeToString(virtio->page_per_vq));
}
}
@ -20816,6 +20824,14 @@ virDomainVirtioOptionsCheckABIStability(virDomainVirtioOptions *src,
virTristateSwitchTypeToString(src->packed));
return false;
}
if (src->page_per_vq != dst->page_per_vq) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Target device page_per_vq option '%s' does not "
"match source '%s'"),
virTristateSwitchTypeToString(dst->page_per_vq),
virTristateSwitchTypeToString(src->page_per_vq));
return false;
}
return true;
}

View File

@ -2740,6 +2740,7 @@ struct _virDomainVirtioOptions {
virTristateSwitch iommu;
virTristateSwitch ats;
virTristateSwitch packed;
virTristateSwitch page_per_vq;
};

View File

@ -135,6 +135,12 @@ virDomainCheckVirtioOptionsAreAbsent(virDomainVirtioOptions *virtio)
"for virtio devices"));
return -1;
}
if (virtio->page_per_vq != VIR_TRISTATE_SWITCH_ABSENT) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("page_per_vq option is only supported for virtio devices"));
return -1;
}
return 0;
}