[libvirt] [PATCH 11/15] conf: new pci controller model pci-expander-bus

Laine Stump laine at laine.org
Thu Mar 24 19:25:46 UTC 2016


This is a standard PCI root bus (not a bridge) that can be added to a
440fx-based domain. Although it uses a PCI slot, this is *not* how it
is connected into the PCI bus hierarchy, but is only used for
control. Each pci-expander-bus provides 32 slots (0-31) that can
accept hotplug of standard PCI devices.

The usefulness of pci-expander-bus relative to a pci-bridge is that
the NUMA node of the bus can be specified with the <node> subelement
of <target>. This gives guest-side visibility to the NUMA node of
attached devices (presuming that management apps only assign a device
to a bus that has a NUMA node number matching the node number of the
device on the host).

Each pci-expander-bus also has a "busNr" attribute. The expander-bus
itself will take the busNr specified, and all buses that are connected
to this bus (including the pci-bridge that is automatically added to
any expander bus of model "pxb" (see the next commit)) will use
busNr+1, busNr+2, etc, and the pci-root (or the expander-bus with next
lower busNr) will use bus numbers lower than busNr.
---
 docs/formatdomain.html.in                          |  44 ++++-
 docs/schemas/domaincommon.rng                      |  14 +-
 src/conf/domain_addr.c                             |  13 +-
 src/conf/domain_conf.c                             |  59 +++++-
 src/conf/domain_conf.h                             |   9 +-
 src/qemu/qemu_domain_address.c                     |   2 +
 .../qemuxml2argv-pci-expander-bus.xml              | 167 +++++++++++++++++
 .../qemuxml2xmlout-pci-expander-bus.xml            | 206 +++++++++++++++++++++
 tests/qemuxml2xmltest.c                            |   3 +
 9 files changed, 503 insertions(+), 14 deletions(-)
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pci-expander-bus.xml
 create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-expander-bus.xml

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 71ffe75..5552b90 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -3043,12 +3043,13 @@
       PCI controllers have an optional <code>model</code> attribute with
       possible values <code>pci-root</code>, <code>pcie-root</code>,
       <code>pcie-root-port</code>, <code>pci-bridge</code>,
-      <code>dmi-to-pci-bridge</code>, <code>pcie-switch-upstream-port</code>, or
-      <code>pcie-switch-downstream-port</code>.
+      <code>dmi-to-pci-bridge</code>, <code>pcie-switch-upstream-port</code>,
+      <code>pcie-switch-downstream-port</code>, or <code>pci-expander-bus</code>.
       (pci-root and pci-bridge <span class="since">since 1.0.5</span>,
       pcie-root and dmi-to-pci-bridge <span class="since">since
-      1.1.2</span>, pcie-root-port, pcie-switch-upstream-port, and
-      pcie-switch-downstream-port <span class="since">since 1.2.19</span>)
+      1.1.2</span>, pcie-root-port, pcie-switch-upstream-port,
+      pcie-switch-downstream-port <span class="since">since 1.2.19</span>,
+      and pci-expander-bus <span class="since">since 1.3.3</span>)
       The root controllers (<code>pci-root</code> and <code>pcie-root</code>)
       have an optional <code>pcihole64</code> element specifying how big
       (in kilobytes, or in the unit specified by <code>pcihole64</code>'s
@@ -3072,9 +3073,9 @@
     </p>
     <p>
       PCI controllers also have an optional
-      subelement <code><target></code> with the attributes
-      listed below. These are configurable items that 1) are visible
-      to the guest OS so must be preserved for guest ABI
+      subelement <code><target></code> with the attributes and
+      subelements listed below. These are configurable items that 1)
+      are visible to the guest OS so must be preserved for guest ABI
       compatibility, and 2) are usually left to default values or
       derived automatically by libvirt. In almost all cases, you
       should not manually add a <code><target></code> subelement
@@ -3111,6 +3112,35 @@
         which is visible to the virtual machine. If set, port must be
         between 0 and 255.
       </dd>
+      <dt><code>busNr</code></dt>
+      <dd>
+        pci-expander-bus controllers can have an
+        optional <code>busNr</code> attribute (1-254). This will be
+        the bus number of the new bus; All bus numbers between that
+        specified and 255 will be available only for assignment to
+        PCI/PCIe controllers plugged into the hierarchy starting with
+        this expander bus, and bus numbers less than the specified
+        value will be available to the next lower expander-bus (or the
+        root-bus if there are no lower expander buses). If you do not
+        specify a busNumber, libvirt will find the lowest existing
+        busNumber in all other expander buses (or use 256 if there are
+        no others) and auto-assign the busNr of that found bus - 2,
+        which provides one bus number for the pci-expander-bus and one
+        for the pci-bridge that is automatically attached to it (if
+        you plan on adding more pci-bridges to the hierarchy of the
+        bus, you should manually set busNr to a lower value).
+      </dd>
+      <dt><code><node></code></dt>
+      <dd>
+        pci-expander-bus controllers can have an
+        optional <code><node></code> subelement within
+        the <code><target></code> subelement, which is used to
+        set the NUMA node reported to the guest OS for that bus - the
+        guest OS will then know that all devices on that bus are a
+        part of the specified NUMA node (it is up to the user of the
+        libvirt API to attach host devices to the correct
+        pci-expander-bus when assigning them to the domain).
+      </dd>
     </dl>
     <p>
       For machine types which provide an implicit PCI bus, the pci-root
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 236a2ba..8827807 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -1759,6 +1759,8 @@
                     <value>x3130-upstream</value>
                     <!-- implementations of 'pcie-switch-downstream-port' -->
                     <value>xio3130-downstream</value>
+                    <!-- implementations of 'pci-expander-bus' -->
+                    <value>pxb</value>
                   </choice>
                 </attribute>
                 <empty/>
@@ -1781,7 +1783,16 @@
                     <ref name='uint8'/>
                   </attribute>
                 </optional>
-                <empty/>
+                <optional>
+                  <attribute name='busNr'>
+                    <ref name='uint8'/>
+                  </attribute>
+                </optional>
+                <optional>
+                  <element name='node'>
+                    <ref name='unsignedInt'/>
+                  </element>
+                </optional>
               </element>
             </optional>
             <!-- *-root controllers have an optional element "pcihole64"-->
@@ -1807,6 +1818,7 @@
                     <value>pcie-root-port</value>
                     <value>pcie-switch-upstream-port</value>
                     <value>pcie-switch-downstream-port</value>
+                    <value>pci-expander-bus</value>
                   </choice>
                 </attribute>
               </group>
diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c
index 1bf2c9a..5293dc9 100644
--- a/src/conf/domain_addr.c
+++ b/src/conf/domain_addr.c
@@ -49,7 +49,11 @@ virDomainPCIControllerModelToConnectType(virDomainControllerModelPCI model,
         *connectType = 0;
         break;
     case VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE:
-        /* pci-bridge is treated like a standard PCI endpoint device, */
+    case VIR_DOMAIN_CONTROLLER_MODEL_PCI_EXPANDER_BUS:
+        /* pci-bridge and pci-expander-bus are treated like a standard
+         * PCI endpoint device, because they can plug into any
+         * standard PCI slot.
+         */
         *connectType = VIR_PCI_CONNECT_TYPE_PCI_DEVICE;
         break;
     case VIR_DOMAIN_CONTROLLER_MODEL_DMI_TO_PCI_BRIDGE:
@@ -230,6 +234,13 @@ virDomainPCIAddressBusSetModel(virDomainPCIAddressBusPtr bus,
         bus->minSlot = 1;
         bus->maxSlot = VIR_PCI_ADDRESS_SLOT_LAST;
         break;
+    case VIR_DOMAIN_CONTROLLER_MODEL_PCI_EXPANDER_BUS:
+        bus->flags = (VIR_PCI_CONNECT_HOTPLUGGABLE |
+                      VIR_PCI_CONNECT_TYPE_PCI_DEVICE);
+        bus->minSlot = 0;
+        bus->maxSlot = VIR_PCI_ADDRESS_SLOT_LAST;
+        break;
+
     case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT:
         /* slots 1 - 31, no hotplug, PCIe endpoint device or
          * pcie-root-port only, unless the address was specified in
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index d5d9ff7..1619517 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -314,7 +314,8 @@ VIR_ENUM_IMPL(virDomainControllerModelPCI, VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST,
               "dmi-to-pci-bridge",
               "pcie-root-port",
               "pcie-switch-upstream-port",
-              "pcie-switch-downstream-port")
+              "pcie-switch-downstream-port",
+              "pci-expander-bus")
 
 VIR_ENUM_IMPL(virDomainControllerPCIModelName,
               VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_LAST,
@@ -323,7 +324,8 @@ VIR_ENUM_IMPL(virDomainControllerPCIModelName,
               "i82801b11-bridge",
               "ioh3420",
               "x3130-upstream",
-              "xio3130-downstream")
+              "xio3130-downstream",
+              "pxb")
 
 VIR_ENUM_IMPL(virDomainControllerModelSCSI, VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LAST,
               "auto",
@@ -1648,6 +1650,8 @@ virDomainControllerDefNew(virDomainControllerType type)
         def->opts.pciopts.chassisNr = -1;
         def->opts.pciopts.chassis = -1;
         def->opts.pciopts.port = -1;
+        def->opts.pciopts.busNr = -1;
+        def->opts.pciopts.numaNode = -1;
         break;
     case VIR_DOMAIN_CONTROLLER_TYPE_IDE:
     case VIR_DOMAIN_CONTROLLER_TYPE_FDC:
@@ -7870,6 +7874,8 @@ virDomainControllerDefParseXML(xmlNodePtr node,
     char *chassisNr = NULL;
     char *chassis = NULL;
     char *port = NULL;
+    char *busNr = NULL;
+    int numaNode = -1;
     char *ioeventfd = NULL;
     xmlNodePtr saved = ctxt->node;
     int rc;
@@ -7934,12 +7940,23 @@ virDomainControllerDefParseXML(xmlNodePtr node,
                 chassisNr = virXMLPropString(cur, "chassisNr");
                 chassis = virXMLPropString(cur, "chassis");
                 port = virXMLPropString(cur, "port");
+                busNr = virXMLPropString(cur, "busNr");
                 processedTarget = true;
             }
         }
         cur = cur->next;
     }
 
+    /* node is parsed differently from target attributes because
+     * someone thought it should be a subelement instead...
+     */
+    rc = virXPathInt("string(./target/node)", ctxt, &numaNode);
+    if (rc == -2 || (rc == 0 && numaNode < 0)) {
+        virReportError(VIR_ERR_XML_ERROR, "%s",
+                       _("invalid NUMA node in target"));
+        goto error;
+    }
+
     if (queues && virStrToLong_ui(queues, NULL, 10, &def->queues) < 0) {
         virReportError(VIR_ERR_XML_ERROR,
                        _("Malformed 'queues' value '%s'"), queues);
@@ -8109,6 +8126,25 @@ virDomainControllerDefParseXML(xmlNodePtr node,
                 goto error;
             }
         }
+        if (busNr) {
+            if (virStrToLong_i(busNr, NULL, 0,
+                               &def->opts.pciopts.busNr) < 0) {
+                virReportError(VIR_ERR_XML_ERROR,
+                               _("Invalid busNr '%s' in PCI controller"),
+                               busNr);
+                goto error;
+            }
+            if (def->opts.pciopts.busNr < 0 ||
+                def->opts.pciopts.busNr > 254) {
+                virReportError(VIR_ERR_XML_ERROR,
+                               _("PCI controller busNr '%s' out of range "
+                                 "- must be 0-254"),
+                               busNr);
+                goto error;
+            }
+        }
+        if (numaNode >= 0)
+            def->opts.pciopts.numaNode = numaNode;
         break;
 
     default:
@@ -8127,6 +8163,7 @@ virDomainControllerDefParseXML(xmlNodePtr node,
     VIR_FREE(chassisNr);
     VIR_FREE(chassis);
     VIR_FREE(port);
+    VIR_FREE(busNr);
     VIR_FREE(ioeventfd);
 
     return def;
@@ -19299,7 +19336,9 @@ virDomainControllerDefFormat(virBufferPtr buf,
             pciModel = true;
         if (def->opts.pciopts.chassisNr != -1 ||
             def->opts.pciopts.chassis != -1 ||
-            def->opts.pciopts.port != -1)
+            def->opts.pciopts.port != -1 ||
+            def->opts.pciopts.busNr != -1 ||
+            def->opts.pciopts.numaNode != -1)
             pciTarget = true;
         break;
 
@@ -19335,7 +19374,19 @@ virDomainControllerDefFormat(virBufferPtr buf,
             if (def->opts.pciopts.port != -1)
                 virBufferAsprintf(buf, " port='0x%x'",
                                   def->opts.pciopts.port);
-            virBufferAddLit(buf, "/>\n");
+            if (def->opts.pciopts.busNr != -1)
+                virBufferAsprintf(buf, " busNr='%d'",
+                                  def->opts.pciopts.busNr);
+            if (def->opts.pciopts.numaNode == -1) {
+                virBufferAddLit(buf, "/>\n");
+            } else {
+                virBufferAddLit(buf, ">\n");
+                virBufferAdjustIndent(buf, 2);
+                virBufferAsprintf(buf, "<node>%d</node>\n",
+                                  def->opts.pciopts.numaNode);
+                virBufferAdjustIndent(buf, -2);
+                virBufferAddLit(buf, "</target>\n");
+            }
         }
 
         if (def->queues || def->cmd_per_lun ||
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 83bdd67..4757065 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1,7 +1,7 @@
 /*
  * domain_conf.h: domain XML processing
  *
- * Copyright (C) 2006-2015 Red Hat, Inc.
+ * Copyright (C) 2006-2016 Red Hat, Inc.
  * Copyright (C) 2006-2008 Daniel P. Berrange
  * Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
  *
@@ -757,6 +757,7 @@ typedef enum {
     VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT_PORT,
     VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_UPSTREAM_PORT,
     VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_DOWNSTREAM_PORT,
+    VIR_DOMAIN_CONTROLLER_MODEL_PCI_EXPANDER_BUS,
 
     VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST
 } virDomainControllerModelPCI;
@@ -768,6 +769,7 @@ typedef enum {
     VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_IOH3420,
     VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_X3130_UPSTREAM,
     VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_XIO3130_DOWNSTREAM,
+    VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PXB,
 
     VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_LAST
 } virDomainControllerPCIModelName;
@@ -832,6 +834,11 @@ struct _virDomainPCIControllerOpts {
      * pcie-root-port/pcie-switch-downstream-port, -1 = unspecified */
     int chassis;
     int port;
+    int busNr; /* used by pci-expander-bus, -1 == unspecified */
+    /* numaNode is a *subelement* of target (to match existing
+     * item in memory target config) -1 == unspecified
+     */
+    int numaNode;
 };
 
 /* Stores the virtual disk controller configuration */
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index e120ab4..0aca829 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -1375,6 +1375,7 @@ qemuDomainPCIControllerSetDefaultModelName(virDomainControllerDefPtr cont)
     case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_DOWNSTREAM_PORT:
         *modelName = VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_XIO3130_DOWNSTREAM;
         break;
+    case VIR_DOMAIN_CONTROLLER_MODEL_PCI_EXPANDER_BUS:
     case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT:
     case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT:
     case VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST:
@@ -1510,6 +1511,7 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def,
                     if (options->port == -1)
                        options->port = addr->slot;
                     break;
+                case VIR_DOMAIN_CONTROLLER_MODEL_PCI_EXPANDER_BUS:
                 case VIR_DOMAIN_CONTROLLER_MODEL_DMI_TO_PCI_BRIDGE:
                 case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_UPSTREAM_PORT:
                 case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT:
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pci-expander-bus.xml b/tests/qemuxml2argvdata/qemuxml2argv-pci-expander-bus.xml
new file mode 100644
index 0000000..79c9593
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pci-expander-bus.xml
@@ -0,0 +1,167 @@
+<domain type='qemu'>
+  <name>expander-test</name>
+  <uuid>3ec6cbe1-b5a2-4515-b800-31a61855df41</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>16</vcpu>
+  <os>
+    <type arch='x86_64' machine='pc-i440fx-2.5'>hvm</type>
+  </os>
+  <cpu>
+    <topology sockets='2' cores='4' threads='2'/>
+    <numa>
+      <cell cpus='0-7' memory='109550' unit='KiB'/>
+      <cell cpus='8-15' memory='109550' unit='KiB'/>
+    </numa>
+  </cpu>
+  <devices>
+    <emulator>/usr/bin/qemu-system-x86_64</emulator>
+    <controller type='usb' index='0' model='none'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
+    <controller type='pci' index='0' model='pci-root'/>
+    <controller type='pci' index='1' model='pci-expander-bus'>
+      <model name='pxb'/>
+      <target busNr='254'>
+        <node>1</node>
+      </target>
+    </controller>
+    <controller type='pci' index='2' model='pci-expander-bus'>
+      <model name='pxb'/>
+    </controller>
+    <interface type='user'>
+      <mac address='52:54:00:f1:95:51'/>
+      <model type='rtl8139'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:00:5c:c6:1a'/>
+      <model type='e1000'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:00:39:97:ac'/>
+      <model type='e1000'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:00:45:28:cb'/>
+      <model type='e1000'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:00:ee:b9:a8'/>
+      <model type='e1000'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:00:a9:f7:17'/>
+      <model type='e1000'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:00:df:2b:f3'/>
+      <model type='e1000'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:00:78:94:b4'/>
+      <model type='e1000'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:00:6b:9b:06'/>
+      <model type='e1000'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:00:17:df:bc'/>
+      <model type='e1000'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:00:3b:d0:51'/>
+      <model type='e1000'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:00:8d:2d:17'/>
+      <model type='e1000'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:00:a7:66:af'/>
+      <model type='e1000'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:00:54:ab:d7'/>
+      <model type='e1000'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:00:1f:99:90'/>
+      <model type='e1000'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:00:c8:43:87'/>
+      <model type='e1000'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:00:df:22:b2'/>
+      <model type='e1000'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:00:d2:9a:47'/>
+      <model type='e1000'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:00:86:05:e2'/>
+      <model type='e1000'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:00:8c:1c:c2'/>
+      <model type='e1000'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:00:48:58:92'/>
+      <model type='e1000'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:00:99:e5:bf'/>
+      <model type='e1000'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:00:b1:8c:25'/>
+      <model type='e1000'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:00:60:e0:d0'/>
+      <model type='e1000'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:00:37:00:6a'/>
+      <model type='e1000'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:00:c7:c8:ad'/>
+      <model type='e1000'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:00:4e:a7:cf'/>
+      <model type='e1000'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:00:00:79:69'/>
+      <model type='e1000'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:00:47:00:6f'/>
+      <model type='e1000'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:00:2a:8c:8b'/>
+      <model type='e1000'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:00:ec:d5:e3'/>
+      <model type='e1000'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:00:7e:6e:c8'/>
+      <model type='e1000'/>
+    </interface>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
+    </memballoon>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-expander-bus.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-expander-bus.xml
new file mode 100644
index 0000000..946e94f
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-expander-bus.xml
@@ -0,0 +1,206 @@
+<domain type='qemu'>
+  <name>expander-test</name>
+  <uuid>3ec6cbe1-b5a2-4515-b800-31a61855df41</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>16</vcpu>
+  <os>
+    <type arch='x86_64' machine='pc-i440fx-2.5'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <cpu>
+    <topology sockets='2' cores='4' threads='2'/>
+    <numa>
+      <cell id='0' cpus='0-7' memory='109550' unit='KiB'/>
+      <cell id='1' cpus='8-15' memory='109550' unit='KiB'/>
+    </numa>
+  </cpu>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu-system-x86_64</emulator>
+    <controller type='usb' index='0' model='none'/>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
+    <controller type='pci' index='0' model='pci-root'/>
+    <controller type='pci' index='1' model='pci-expander-bus'>
+      <model name='pxb'/>
+      <target busNr='254'>
+        <node>1</node>
+      </target>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </controller>
+    <controller type='pci' index='2' model='pci-expander-bus'>
+      <model name='pxb'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </controller>
+    <interface type='user'>
+      <mac address='52:54:00:f1:95:51'/>
+      <model type='rtl8139'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:00:5c:c6:1a'/>
+      <model type='e1000'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:00:39:97:ac'/>
+      <model type='e1000'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:00:45:28:cb'/>
+      <model type='e1000'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:00:ee:b9:a8'/>
+      <model type='e1000'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:00:a9:f7:17'/>
+      <model type='e1000'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x0b' function='0x0'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:00:df:2b:f3'/>
+      <model type='e1000'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x0c' function='0x0'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:00:78:94:b4'/>
+      <model type='e1000'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x0d' function='0x0'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:00:6b:9b:06'/>
+      <model type='e1000'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x0e' function='0x0'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:00:17:df:bc'/>
+      <model type='e1000'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x0f' function='0x0'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:00:3b:d0:51'/>
+      <model type='e1000'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x10' function='0x0'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:00:8d:2d:17'/>
+      <model type='e1000'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x11' function='0x0'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:00:a7:66:af'/>
+      <model type='e1000'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x12' function='0x0'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:00:54:ab:d7'/>
+      <model type='e1000'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x13' function='0x0'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:00:1f:99:90'/>
+      <model type='e1000'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x14' function='0x0'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:00:c8:43:87'/>
+      <model type='e1000'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x15' function='0x0'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:00:df:22:b2'/>
+      <model type='e1000'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x16' function='0x0'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:00:d2:9a:47'/>
+      <model type='e1000'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x17' function='0x0'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:00:86:05:e2'/>
+      <model type='e1000'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x18' function='0x0'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:00:8c:1c:c2'/>
+      <model type='e1000'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x19' function='0x0'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:00:48:58:92'/>
+      <model type='e1000'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1a' function='0x0'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:00:99:e5:bf'/>
+      <model type='e1000'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1b' function='0x0'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:00:b1:8c:25'/>
+      <model type='e1000'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1c' function='0x0'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:00:60:e0:d0'/>
+      <model type='e1000'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1d' function='0x0'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:00:37:00:6a'/>
+      <model type='e1000'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1e' function='0x0'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:00:c7:c8:ad'/>
+      <model type='e1000'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x0'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:00:4e:a7:cf'/>
+      <model type='e1000'/>
+      <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:00:00:79:69'/>
+      <model type='e1000'/>
+      <address type='pci' domain='0x0000' bus='0x01' slot='0x01' function='0x0'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:00:47:00:6f'/>
+      <model type='e1000'/>
+      <address type='pci' domain='0x0000' bus='0x01' slot='0x02' function='0x0'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:00:2a:8c:8b'/>
+      <model type='e1000'/>
+      <address type='pci' domain='0x0000' bus='0x01' slot='0x03' function='0x0'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:00:ec:d5:e3'/>
+      <model type='e1000'/>
+      <address type='pci' domain='0x0000' bus='0x01' slot='0x04' function='0x0'/>
+    </interface>
+    <interface type='user'>
+      <mac address='52:54:00:7e:6e:c8'/>
+      <model type='e1000'/>
+      <address type='pci' domain='0x0000' bus='0x01' slot='0x05' function='0x0'/>
+    </interface>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
+    </memballoon>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 0735677..016340b 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -641,6 +641,9 @@ mymain(void)
                  QEMU_CAPS_ICH9_AHCI,
                  QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
                  QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL);
+    DO_TEST_FULL("pci-expander-bus", WHEN_ACTIVE,
+                 QEMU_CAPS_DEVICE_PCI_BRIDGE,
+                 QEMU_CAPS_DEVICE_PXB);
 
 
     DO_TEST_FULL("hostdev-scsi-lsi", WHEN_ACTIVE,
-- 
2.5.5




More information about the libvir-list mailing list