]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
the key of hash table should include the function value
authorWen Congyang <wency@cn.fujitsu.com>
Mon, 23 May 2011 03:22:54 +0000 (11:22 +0800)
committerWen Congyang <wency@cn.fujitsu.com>
Mon, 13 Jun 2011 01:27:21 +0000 (09:27 +0800)
We save all used PCI address in the hash table. The key is generated by domain,
bus and slot now. We will support multi function PCI device, so the key should
be generated by domain, bus, slot and function.

src/qemu/qemu_command.c

index 4e6824125a173565b173c080b3d55a7fe16a3ea5..7c92ed6113b51d0146837953352335d7c0a92e62 100644 (file)
@@ -684,10 +684,11 @@ static char *qemuPCIAddressAsString(virDomainDeviceInfoPtr dev)
         return NULL;
     }
 
-    if (virAsprintf(&addr, "%d:%d:%d",
+    if (virAsprintf(&addr, "%d:%d:%d.%d",
                     dev->addr.pci.domain,
                     dev->addr.pci.bus,
-                    dev->addr.pci.slot) < 0) {
+                    dev->addr.pci.slot,
+                    dev->addr.pci.function) < 0) {
         virReportOOMError();
         return NULL;
     }
@@ -817,6 +818,7 @@ int qemuDomainPCIAddressReserveSlot(qemuDomainPCIAddressSetPtr addrs,
     dev.addr.pci.domain = 0;
     dev.addr.pci.bus = 0;
     dev.addr.pci.slot = slot;
+    dev.addr.pci.function = 0;
 
     return qemuDomainPCIAddressReserveAddr(addrs, &dev);
 }
@@ -879,6 +881,7 @@ int qemuDomainPCIAddressSetNextAddr(qemuDomainPCIAddressSetPtr addrs,
         maybe.addr.pci.domain = 0;
         maybe.addr.pci.bus = 0;
         maybe.addr.pci.slot = i;
+        maybe.addr.pci.function = 0;
 
         if (!(addr = qemuPCIAddressAsString(&maybe)))
             return -1;