Re: [libvirt] [PATCH 2/3] add pci-brige device command line for qemu

2013-01-07 Thread Ján Tomko
On 01/04/13 03: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.
 

 -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.



 Each bridge must have a unique chassis #.
 You *must* set it to a value  0.
 I don't check that it is unique, just that it is 0.
 If you make it non unique, guest will be confused.

http://lists.gnu.org/archive/html/qemu-devel/2012-02/msg02765.html

Jan

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH 2/3] add pci-brige device command line for qemu

2013-01-07 Thread Daniel P. Berrange
On Thu, Jan 03, 2013 at 04:13:52PM +0100, Ján Tomko wrote:
 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).

That depends on the machine type you are using. The PC machine type only
has a single PCI bridge. IIRC, the q35 machine type has multiple bridges.

Either way I don't think this is a problem for libvirt. When we add PCI
bridge devices we should just use the same 'pci.%d' as Jan suggests.
If the machine type in question has 2 bridges by default, this simply
means the user adding bridges must start from bus=2.

Regards,
Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH 2/3] add pci-brige device command line for qemu

2013-01-07 Thread li guang
在 2013-01-07一的 17:57 +0100,Ján Tomko写道:
 On 01/04/13 03: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.
  
 
  -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.
 
 
 
  Each bridge must have a unique chassis #.
  You *must* set it to a value  0.
  I don't check that it is unique, just that it is 0.
  If you make it non unique, guest will be confused.
 
 http://lists.gnu.org/archive/html/qemu-devel/2012-02/msg02765.html

Oh, to be a little pedantic, please refer to PCI-TO-PCI BRIDGE
ARCHITECTURE SPECIFICATION, REV 1.2, page 146, as I said before,
'I just set all bridges in same chassis', that means, 1 main chassis(#0)
,1 expansion chassis(#1), maybe it seems strange, but It's not illegal.

of course, I will consider your advice to make it unique.

Thanks!

 
 Jan

-- 
regards!
li guang


--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH 2/3] add pci-brige device command line for qemu

2013-01-04 Thread Dave Allan
On Fri, Jan 04, 2013 at 11:38:42AM +0800, Osier Yang wrote:
 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.

Regardless of what qemu does today, I don't think it's a good idea to
hardcode this to 0 since it's not clear what will happen in the
future.  Somebody more familiar with the specifics correct me if I'm
off base there.

Dave

 
 -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;
 +
 +}
 
 
 
 --
 libvir-list mailing list
 libvir-list@redhat.com
 https://www.redhat.com/mailman/listinfo/libvir-list

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH 2/3] add pci-brige device command line for qemu

2013-01-04 Thread Osier Yang

On 2013年01月04日 23:21, Dave Allan wrote:

On Fri, Jan 04, 2013 at 11:38:42AM +0800, Osier Yang wrote:

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.


Regardless of what qemu does today, I don't think it's a good idea to
hardcode this to 0 since it's not clear what will happen in the
future.  Somebody more familiar with the specifics correct me if I'm
off base there.


Right, again, the rule is we have to consider as much as possible to
make sure the things are capable with future. Either the XMLs or the
codes.



Dave




-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;
+
+}






--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH 2/3] add pci-brige device command line for qemu

2013-01-03 Thread 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).

 -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;
 +
 +}

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH 2/3] add pci-brige device command line for qemu

2013-01-03 Thread li guang
在 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.

 
  -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;
  +
  +}
 

-- 
regards!
li guang


--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH 2/3] add pci-brige device command line for qemu

2013-01-03 Thread Osier Yang

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;
+
+}






--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH 2/3] add pci-brige device command line for qemu

2012-12-25 Thread liguang
generally, root pci-bridge refers to bus 0, 'id=pci-bridge0',
then the following devices sitting on this bus will
set 'bus=pci-bridge0', subordinate bus has 'id=pci-birdge1',
and devices sitting on it will set 'bus=pci-bridge1',
and so forth.

Signed-off-by: liguang lig.f...@cn.fujitsu.com
---
 src/qemu/qemu_command.c |   52 +++---
 1 files changed, 48 insertions(+), 4 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 04a9512..e98b6c9 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -1762,13 +1762,15 @@ qemuBuildDeviceAddressStr(virBufferPtr buf,
   virDomainDeviceInfoPtr info,
   qemuCapsPtr caps)
 {
-if (info-type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) {
+if (info-type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI ||
+info-type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCIBRIDGE) {
 if (info-addr.pci.domain != 0) {
 virReportError(VIR_ERR_INTERNAL_ERROR, %s,
_(Only PCI device addresses with domain=0 are 
supported));
 return -1;
 }
-if (info-addr.pci.bus != 0) {
+if (info-addr.pci.bus != 0 
+info-type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCIBRIDGE) {
 virReportError(VIR_ERR_INTERNAL_ERROR, %s,
_(Only PCI device addresses with bus=0 are 
supported));
 return -1;
@@ -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);
-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);
+
+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;
+
+}
 
 char *
 qemuBuildSoundDevStr(virDomainSoundDefPtr sound,
@@ -5604,6 +5635,19 @@ qemuBuildCommandLine(virConnectPtr conn,
 virCommandAddArgList(cmd, -bootloader, def-os.bootloader, NULL);
 }
 
+for (i = 0; i  def-npcibridges; i++) {
+virDomainPCIbridgeDefPtr pbdg = def-pcibridges[i];
+
+if (qemuCapsGet(caps, QEMU_CAPS_DEVICE)) {
+char *optstr;
+virCommandAddArg(cmd, -device);
+if (!(optstr = qemuBuildPCIbridgeDevStr(pbdg, caps, i)))
+goto error;
+virCommandAddArg(cmd, optstr);
+VIR_FREE(optstr);
+}
+}
+
 for (i = 0 ; i  def-ndisks ; i++) {
 virDomainDiskDefPtr disk = def-disks[i];
 
-- 
1.7.2.5

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list