<mac address='00:16:3e:5d:c7:9e'/>
<script path='vif-bridge'/>
<boot order='1'/>
+ <rom bar='off'/>
</interface>
</devices>
...</pre>
<span class="since">Since 0.8.8</span>
</p>
+ <h5><a name="elementsNICSROM">Interface ROM BIOS configuration</a></h5>
+
+<pre>
+ ...
+ <devices>
+ <interface type='network'>
+ <source network='default'/>
+ <target dev='vnet1'/>
+ <b><rom bar='off'/></b>
+ </interface>
+ </devices>
+ ...</pre>
+
+ <p>
+ For hypervisors which support this, you can change how a PCI Network
+ device's ROM is presented to the guest. The <code>bar</code>
+ attribute can be set to "on" or "off", and determines whether
+ or not the device's ROM will be visible in the guest's memory
+ map. (In PCI documentation, the "rombar" setting controls the
+ presence of the Base Address Register for the ROM). If no rom
+ bar is specified, the qemu default will be used (older
+ versions of qemu used a default of "off", while newer qemus
+ have a default of "on"). <span class="since">Since
+ 0.9.10 (QEMU and KVM only)</span>
+ </p>
+
<h5><a name="elementQoS">Quality of service</a></h5>
<pre>
<optional>
<ref name="deviceBoot"/>
</optional>
+ <optional>
+ <ref name="rom"/>
+ </optional>
<optional>
<ref name="bandwidth"/>
</optional>
<ref name="address"/>
</optional>
<optional>
- <element name="rom">
- <attribute name="bar">
- <choice>
- <value>on</value>
- <value>off</value>
- </choice>
- </attribute>
- <empty/>
- </element>
+ <ref name="rom"/>
</optional>
</element>
</define>
</element>
</define>
+ <define name="rom">
+ <element name="rom">
+ <attribute name="bar">
+ <choice>
+ <value>on</value>
+ <value>off</value>
+ </choice>
+ </attribute>
+ <empty/>
+ </element>
+ </define>
+
<define name="usbmaster">
<element name="master">
<attribute name="startport">
def->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI;
} else {
if (virDomainDeviceInfoParseXML(node, bootMap, &def->info,
- flags | VIR_DOMAIN_XML_INTERNAL_ALLOW_BOOT) < 0)
+ flags | VIR_DOMAIN_XML_INTERNAL_ALLOW_BOOT
+ | VIR_DOMAIN_XML_INTERNAL_ALLOW_ROM) < 0)
goto error;
}
virBufferAdjustIndent(buf, -6);
if (virDomainDeviceInfoFormat(buf, &def->info,
- flags | VIR_DOMAIN_XML_INTERNAL_ALLOW_BOOT) < 0)
+ flags | VIR_DOMAIN_XML_INTERNAL_ALLOW_BOOT
+ | VIR_DOMAIN_XML_INTERNAL_ALLOW_ROM) < 0)
return -1;
virBufferAddLit(buf, " </interface>\n");
return 0;
}
+static int
+qemuBuildRomStr(virBufferPtr buf,
+ virDomainDeviceInfoPtr info,
+ virBitmapPtr qemuCaps)
+{
+ if (info->rombar) {
+ if (info->type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) {
+ qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ "%s", _("rombar is supported only for PCI devices"));
+ return -1;
+ }
+ if (!qemuCapsGet(qemuCaps, QEMU_CAPS_PCI_ROMBAR)) {
+ qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ "%s", _("rombar not supported in this QEMU binary"));
+ return -1;
+ }
+
+ switch (info->rombar) {
+ case VIR_DOMAIN_PCI_ROMBAR_OFF:
+ virBufferAddLit(buf, ",rombar=0");
+ break;
+ case VIR_DOMAIN_PCI_ROMBAR_ON:
+ virBufferAddLit(buf, ",rombar=1");
+ break;
+ default:
+ break;
+ }
+ }
+ return 0;
+}
+
static int
qemuBuildIoEventFdStr(virBufferPtr buf,
enum virDomainIoEventFd use,
net->mac[4], net->mac[5]);
if (qemuBuildDeviceAddressStr(&buf, &net->info, qemuCaps) < 0)
goto error;
+ if (qemuBuildRomStr(&buf, &net->info, qemuCaps) < 0)
+ goto error;
if (bootindex && qemuCapsGet(qemuCaps, QEMU_CAPS_BOOTINDEX))
virBufferAsprintf(&buf, ",bootindex=%d", bootindex);
virBufferAsprintf(&buf, ",bootindex=%d", dev->info.bootIndex);
if (qemuBuildDeviceAddressStr(&buf, &dev->info, qemuCaps) < 0)
goto error;
-
- if (dev->info.rombar) {
- if (!qemuCapsGet(qemuCaps, QEMU_CAPS_PCI_ROMBAR)) {
- qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- "%s", _("rombar not supported in this QEMU binary"));
- goto error;
- }
-
- switch (dev->info.rombar) {
- case VIR_DOMAIN_PCI_ROMBAR_OFF:
- virBufferAddLit(&buf, ",rombar=0");
- break;
- case VIR_DOMAIN_PCI_ROMBAR_ON:
- virBufferAddLit(&buf, ",rombar=1");
- break;
- default:
- break;
- }
- }
+ if (qemuBuildRomStr(&buf, &dev->info, qemuCaps) < 0)
+ goto error;
if (virBufferError(&buf)) {
virReportOOMError();
+++ /dev/null
-LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M \
-pc -m 214 -smp 1 -nographic -nodefconfig -nodefaults -monitor \
-unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -hda \
-/dev/HostVG/QEMUGuest2 -usb -device pci-assign,host=06:12.5,id=hostdev0,\
-bus=pci.0,addr=0x3,rombar=0 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4
--- /dev/null
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M \
+pc -m 214 -smp 1 -nographic -nodefconfig -nodefaults -monitor \
+unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -hda \
+/dev/HostVG/QEMUGuest2 \
+-device virtio-net-pci,vlan=0,id=net0,mac=52:54:00:24:a5:9f,bus=pci.0,addr=0x3,rombar=1 \
+-net user,vlan=0,name=hostnet0 \
+-device virtio-net-pci,vlan=1,id=net1,mac=52:54:00:24:a5:9e,bus=pci.0,addr=0x4 \
+-net user,vlan=1,name=hostnet1 \
+-usb -device pci-assign,host=06:12.5,id=hostdev0,bus=pci.0,addr=0x5,rombar=0 \
+-device pci-assign,host=06:12.6,id=hostdev1,bus=pci.0,addr=0x6,rombar=1 \
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x7
<disk type='block' device='disk'>
<source dev='/dev/HostVG/QEMUGuest2'/>
<target dev='hda' bus='ide'/>
+ <address type='drive' controller='0' bus='0' unit='0'/>
</disk>
+ <controller type='ide' index='0'/>
+ <interface type='user'>
+ <mac address='52:54:00:24:a5:9f'/>
+ <model type='virtio'/>
+ <rom bar='on'/>
+ </interface>
+ <interface type='user'>
+ <mac address='52:54:00:24:a5:9e'/>
+ <model type='virtio'/>
+ </interface>
<hostdev mode='subsystem' type='pci' managed='yes'>
<source>
<address domain='0x0000' bus='0x06' slot='0x12' function='0x5'/>
</source>
<rom bar='off'/>
</hostdev>
+ <hostdev mode='subsystem' type='pci' managed='yes'>
+ <source>
+ <address domain='0x0000' bus='0x06' slot='0x12' function='0x6'/>
+ </source>
+ <rom bar='on'/>
+ </hostdev>
<memballoon model='virtio'/>
</devices>
</domain>
DO_TEST("hostdev-pci-address", false, QEMU_CAPS_PCIDEVICE);
DO_TEST("hostdev-pci-address-device", false,
QEMU_CAPS_PCIDEVICE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
+ DO_TEST("pci-rom", false,
+ QEMU_CAPS_PCIDEVICE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
+ QEMU_CAPS_PCI_ROMBAR);
DO_TEST_FULL("restore-v1", "stdio", 7, false, false,
QEMU_CAPS_MIGRATE_KVM_STDIO);
DO_TEST("hostdev-usb-address");
DO_TEST("hostdev-pci-address");
+ DO_TEST("pci-rom");
DO_TEST("encrypted-disk");
DO_TEST("memtune");