From: Laine Stump Date: Wed, 17 Jun 2015 19:27:40 +0000 (-0400) Subject: conf: new pcie-controller model "pcie-switch-downstream-port" X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=76379a6ec15c2ffc1fa819766a9c1dcad57953f7;p=libvirt.git conf: new pcie-controller model "pcie-switch-downstream-port" This controller can be connected only to a port on a pcie-switch-upstream-port. It provides a single hotpluggable port that will accept any PCI or PCIe device, as well as any device requiring a pcie-*-port (the only current example of such a device is the pcie-switch-upstream-port). --- diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 0cdc7f0cdf..7eb21a8897 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -3032,11 +3032,12 @@ PCI controllers have an optional model attribute with possible values pci-root, pcie-root, pcie-root-port, pci-bridge, - dmi-to-pci-bridge, or pcie-switch-upstream-port. + dmi-to-pci-bridge, pcie-switch-upstream-port, or + pcie-switch-downstream-port. (pci-root and pci-bridge since 1.0.5, pcie-root and dmi-to-pci-bridge since - 1.1.2, pcie-root-port and - pcie-switch-upstream-port since 1.2.19) + 1.1.2, pcie-root-port, pcie-switch-upstream-port, and + pcie-switch-downstream-port since 1.2.19) The root controllers (pci-root and pcie-root) have an optional pcihole64 element specifying how big (in kilobytes, or in the unit specified by pcihole64's @@ -3083,8 +3084,8 @@
chassis
- pcie-root-port controllers can also have - a chassis attribute in + pcie-root-port and pcie-switch-downstream-port controllers can + also have a chassis attribute in the <target> subelement, which is used to set the controller's "chassis" configuration value, which is visible to the virtual machine. If set, chassis must be @@ -3092,8 +3093,9 @@
port
- pcie-root-port controllers can also have a port - attribute in the <target> subelement, which + pcie-root-port and pcie-switch-downstream-port controllers can + also have a port attribute in + the <target> subelement, which is used to set the controller's "port" configuration value, which is visible to the virtual machine. If set, port must be between 0 and 255. @@ -3146,14 +3148,32 @@

Domains with an implicit pcie-root can also add controllers - with model='pcie-root-port'. This is a simple type of - bridge device that can connect only to one of the 31 slots on - the pcie-root bus on the upstream side, and makes a single - (PCIe, hotpluggable) port (at slot='0') available on the - downstream side. This controller can be used to provide a single - slot to later hotplug a PCIe device (but is not itself - hotpluggable - it must be in the configuration when the domain - is started). (since 1.2.19) + with model='pcie-root-port', + model='pcie-switch-upstream-port', + and model='pcie-switch-downstream-port'. pcie-root-port + is a simple type of bridge device that can connect only to one + of the 31 slots on the pcie-root bus on its upstream side, and + makes a single (PCIe, hotpluggable) port available on the + downstream side (at slot='0'). pcie-root-port can be used to + provide a single slot to later hotplug a PCIe device (but is not + itself hotpluggable - it must be in the configuration when the + domain is started). + (since 1.2.19) +

+

+ pcie-switch-upstream-port is a more flexible (but also more + complex) device that can only plug into a pcie-root-port or + pcie-switch-downstream-port on the upstream side (and only + before the domain is started - it is not hot-pluggable), and + provides 32 ports on the downstream side (slot='0' - slot='31') + that accept only pcie-switch-downstream-port devices; each + pcie-switch-downstream-port device can only plug into a + pcie-switch-upstream-port on its upstream side (again, not + hot-pluggable), and on its downstream side provides a single + hotpluggable pcie port that can accept any standard pci or pcie + device (or another pcie-switch-upstream-port), i.e. identical in + function to a pcie-root-port. (since + 1.2.19)

   ...
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index ce012307f3..ab02d14f8e 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -1743,6 +1743,8 @@
                     ioh3420
                     
                     x3130-upstream
+                    
+                    xio3130-downstream
                   
                 
                 
@@ -1790,6 +1792,7 @@
                     dmi-to-pci-bridge
                     pcie-root-port
                     pcie-switch-upstream-port
+                    pcie-switch-downstream-port
                   
                 
               
diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c
index 8bd4ac35d1..ca5803ee57 100644
--- a/src/conf/domain_addr.c
+++ b/src/conf/domain_addr.c
@@ -197,6 +197,7 @@ virDomainPCIAddressBusSetModel(virDomainPCIAddressBusPtr bus,
         bus->maxSlot = VIR_PCI_ADDRESS_SLOT_LAST;
         break;
     case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT_PORT:
+    case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_DOWNSTREAM_PORT:
         /* provides one slot which is pcie, can be used by devices
          * that must connect to some type of "pcie-*-port", and
          * is hotpluggable
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index a554c7f959..8790aabe05 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -326,7 +326,8 @@ VIR_ENUM_IMPL(virDomainControllerModelPCI, VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST,
               "pci-bridge",
               "dmi-to-pci-bridge",
               "pcie-root-port",
-              "pcie-switch-upstream-port")
+              "pcie-switch-upstream-port",
+              "pcie-switch-downstream-port")
 
 VIR_ENUM_IMPL(virDomainControllerPCIModelName,
               VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_LAST,
@@ -334,7 +335,8 @@ VIR_ENUM_IMPL(virDomainControllerPCIModelName,
               "pci-bridge",
               "i82801b11-bridge",
               "ioh3420",
-              "x3130-upstream")
+              "x3130-upstream",
+              "xio3130-downstream")
 
 VIR_ENUM_IMPL(virDomainControllerModelSCSI, VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LAST,
               "auto",
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 475cba1d93..86430efb1c 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -754,6 +754,7 @@ typedef enum {
     VIR_DOMAIN_CONTROLLER_MODEL_DMI_TO_PCI_BRIDGE,
     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_LAST
 } virDomainControllerModelPCI;
@@ -764,6 +765,7 @@ typedef enum {
     VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_I82801B11_BRIDGE,
     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_LAST
 } virDomainControllerPCIModelName;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 746d6cdb63..efe01adccf 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -2307,6 +2307,7 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def,
                     if (options->modelName == VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_NONE)
                         options->modelName = VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_X3130_UPSTREAM;
                     break;
+                case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_DOWNSTREAM_PORT:
                 case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT:
                 case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT:
                 case VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST:
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pcie-switch-downstream-port.xml b/tests/qemuxml2argvdata/qemuxml2argv-pcie-switch-downstream-port.xml
new file mode 100644
index 0000000000..fca3149097
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pcie-switch-downstream-port.xml
@@ -0,0 +1,44 @@
+
+  q35-test
+  11dbdcdd-4c3b-482b-8903-9bdb8c0a2774
+  2097152
+  2097152
+  2
+  
+    hvm
+    
+  
+  
+  destroy
+  restart
+  destroy
+  
+    /usr/libexec/qemu-kvm
+    
+      
+      
+      
+ + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 9a6fb16794..b261db2bcf 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -570,6 +570,7 @@ mymain(void) DO_TEST("pcie-root-port"); DO_TEST("pcie-root-port-too-many"); DO_TEST("pcie-switch-upstream-port"); + DO_TEST("pcie-switch-downstream-port"); DO_TEST("hostdev-scsi-lsi"); DO_TEST("hostdev-scsi-virtio-scsi");