On 12/26/12 02:00, liguang wrote:
@@ -1801,10 +1803,13 @@ qemuBuildDeviceAddressStr(virBufferPtr buf,
* When QEMU grows support for > 1 PCI domain, then pci.0 change
* to pciNN.0 where NN is the domain number
*/
- if (qemuCapsGet(caps, QEMU_CAPS_PCI_MULTIBUS))
+ if (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCIBRIDGE) {
+ virBufferAsprintf(buf, ",bus=pci-bridge%d",
info->addr.pci.bus);
+ } else if (qemuCapsGet(caps, QEMU_CAPS_PCI_MULTIBUS)) {
virBufferAsprintf(buf, ",bus=pci.0");
Is there any way (or plan) to use more pci buses with QEMU other than
with the pci bridges? If not, we could just name the bridges pci.%d. (If
we index the bridges from 1).
- else
+ } else {
virBufferAsprintf(buf, ",bus=pci");
+ }
if (info->addr.pci.multi == VIR_DEVICE_ADDRESS_PCI_MULTI_ON)
virBufferAddLit(buf, ",multifunction=on");
else if (info->addr.pci.multi == VIR_DEVICE_ADDRESS_PCI_MULTI_OFF)
@@ -3455,6 +3460,32 @@ error:
return NULL;
}
+char *
+qemuBuildPCIbridgeDevStr(virDomainPCIbridgeDefPtr dev,
+ qemuCapsPtr caps, int idx)
+{
+ virBuffer buf = VIR_BUFFER_INITIALIZER;
+
+ virBufferAsprintf(&buf, "pci-bridge,chassis_nr=1");
The chassis number has to be unique for each bridge.
+
+ if ((dev->type != VIR_DOMAIN_PCIBRIDGE_TYPE_ROOT) &&
+ (qemuBuildDeviceAddressStr(&buf, &dev->info, caps) < 0))
+ goto error;
+ else
+ virBufferAsprintf(&buf, ",id=pci-bridge%d" , idx);
+
+ if (virBufferError(&buf)) {
+ virReportOOMError();
+ goto error;
+ }
+
+ return virBufferContentAndReset(&buf);
+
+error:
+ virBufferFreeAndReset(&buf);
+ return NULL;
+
+}