]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
reserve slot 1 on pci bus0
authorWen Congyang <wency@cn.fujitsu.com>
Wed, 24 Aug 2011 02:47:39 +0000 (10:47 +0800)
committerWen Congyang <wency@cn.fujitsu.com>
Fri, 2 Sep 2011 03:33:04 +0000 (11:33 +0800)
After supporting multi function pci device, we only reserve function 1 on slot 1.
The user can use the other function on slot 1 in the xml config file. We should
detect this wrong usage.

src/qemu/qemu_command.c

index e541e08fc8433da5d976367e2d965f12e5e9d1b2..44a553bc635625b09d8f04b1184d2018c790cabf 100644 (file)
@@ -1072,6 +1072,7 @@ qemuAssignDevicePCISlots(virDomainDefPtr def, qemuDomainPCIAddressSetPtr addrs)
     int i;
     bool reservedIDE = false;
     bool reservedVGA = false;
+    int function;
 
     /* Host bridge */
     if (qemuDomainPCIAddressReserveSlot(addrs, 0) < 0)
@@ -1107,9 +1108,14 @@ qemuAssignDevicePCISlots(virDomainDefPtr def, qemuDomainPCIAddressSetPtr addrs)
     /* PIIX3 (ISA bridge, IDE controller, something else unknown, USB controller)
      * hardcoded slot=1, multifunction device
      */
-    if (!reservedIDE &&
-        qemuDomainPCIAddressReserveSlot(addrs, 1) < 0)
-        goto error;
+    for (function = 0; function < QEMU_PCI_ADDRESS_LAST_FUNCTION; function++) {
+        if (function == 1 && reservedIDE)
+            /* we have reserved this pci address */
+            continue;
+
+        if (qemuDomainPCIAddressReserveFunction(addrs, 1, function) < 0)
+            goto error;
+    }
 
     /* First VGA is hardcoded slot=2 */
     if (def->nvideos > 0) {