On 2013年01月04日 10:28, li guang wrote:
在 2013-01-03四的 16:13 +0100,Ján Tomko写道:
> 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).
as far as I know, qemu can't use multi-pci-bus,
so only pci.0 accepted now.
At this point, I think it's better to ask the QEMU developers to
be involved in next series, to make sure things are right.
>
>> - 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.
chassis number is not so important,
here, I just set all bridges in same chassis.
>
>> +
>> + 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;
>> +
>> +}
>