
On Fri, Apr 20, 2018 at 17:44:29 +0200, Andrea Bolognani wrote:
The attribute can be used to disable ROM loading completely for a device.
Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- docs/formatdomain.html.in | 3 +++ docs/schemas/domaincommon.rng | 5 +++++ src/conf/device_conf.h | 1 + src/conf/domain_conf.c | 26 +++++++++++++++++++++++++- 4 files changed, 34 insertions(+), 1 deletion(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index ada0df227f..0afc310e25 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -4476,6 +4476,9 @@ virtual function of an sr-iov capable ethernet device (which has no boot ROMs for the VFs). <span class="since">Since 0.9.10 (QEMU and KVM only)</span>. + The optional <code>enabled</code> attribute can be set to + <code>no</code> to disable PCI ROM loading completely for the device. + <span class="since">Since 4.3.0 (QEMU and KVM only)</span>.
Maybe you should mention that any other configration may not be supported in that case. [...]
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 35666c1347..3c152441df 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c
[...]
@@ -6798,6 +6813,14 @@ virDomainDeviceInfoParseXML(virDomainXMLOptionPtr xmlopt ATTRIBUTE_UNUSED, goto cleanup; } info->romfile = virXMLPropString(rom, "file"); + + if (info->romenabled == VIR_TRISTATE_BOOL_NO && + (info->rombar != VIR_TRISTATE_SWITCH_ABSENT || info->romfile)) {
I'd explicitly allow empty string in info->romfile, but that would mean that this needs to be moved to the qemu post-parse callback, since that is a qemu quirk. Justification is that, mgmt tools will be able to use enabled='no' together with the empty file string without having to do any probing whether that is a valid configuration.
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + "%s",
Above line can be merged into previous one.
+ _("ROM tuning is not supported when ROM is disabled")); + goto cleanup; + } }
if (address &&