diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c
index 58ff6fdaa9..c533edb4ff 100644
--- a/src/conf/domain_addr.c
+++ b/src/conf/domain_addr.c
@@ -51,20 +51,17 @@ virDomainPCIControllerModelToConnectType(virDomainControllerModelPCI model)
return 0;
case VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE:
- 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.
+ /* pci-bridge is treated like a standard
+ * PCI endpoint device, because it can plug into any
+ * standard PCI slot (it just can't be hotplugged).
*/
return VIR_PCI_CONNECT_TYPE_PCI_DEVICE;
+ case VIR_DOMAIN_CONTROLLER_MODEL_PCI_EXPANDER_BUS:
+ return VIR_PCI_CONNECT_TYPE_PCI_EXPANDER_BUS;
+
case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_EXPANDER_BUS:
- /* pcie-expander-bus is treated like a standard PCIe endpoint
- * device (the part of pcie-expander-bus that is plugged in
- * isn't the expander bus itself, but a companion device used
- * for setting it up).
- */
- return VIR_PCI_CONNECT_TYPE_PCIE_DEVICE;
+ return VIR_PCI_CONNECT_TYPE_PCIE_EXPANDER_BUS;
case VIR_DOMAIN_CONTROLLER_MODEL_DMI_TO_PCI_BRIDGE:
return VIR_PCI_CONNECT_TYPE_DMI_TO_PCI_BRIDGE;
@@ -137,6 +134,10 @@ virDomainPCIAddressFlagsCompatible(virPCIDeviceAddressPtr addr,
connectStr = "pci-switch-downstream-port";
} else if (devFlags & VIR_PCI_CONNECT_TYPE_DMI_TO_PCI_BRIDGE) {
connectStr = "dmi-to-pci-bridge";
+ } else if (devFlags & VIR_PCI_CONNECT_TYPE_PCI_EXPANDER_BUS) {
+ connectStr = "pci-expander-bus";
+ } else if (devFlags & VIR_PCI_CONNECT_TYPE_PCIE_EXPANDER_BUS) {
+ connectStr = "pcie-expander-bus";
} else {
/* this should never happen. If it does, there is a
* bug in the code that sets the flag bits for devices.
@@ -243,8 +244,14 @@ virDomainPCIAddressBusSetModel(virDomainPCIAddressBusPtr bus,
* bus.
*/
switch (model) {
- case VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE:
case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT:
+ bus->flags = (VIR_PCI_CONNECT_HOTPLUGGABLE |
+ VIR_PCI_CONNECT_TYPE_PCI_DEVICE |
+ VIR_PCI_CONNECT_TYPE_PCI_EXPANDER_BUS);
+ bus->minSlot = 1;
+ bus->maxSlot = VIR_PCI_ADDRESS_SLOT_LAST;
+ break;
+ case VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE:
bus->flags = (VIR_PCI_CONNECT_HOTPLUGGABLE |
VIR_PCI_CONNECT_TYPE_PCI_DEVICE);
bus->minSlot = 1;
@@ -265,7 +272,8 @@ virDomainPCIAddressBusSetModel(virDomainPCIAddressBusPtr bus,
*/
bus->flags = (VIR_PCI_CONNECT_TYPE_PCIE_DEVICE |
VIR_PCI_CONNECT_TYPE_PCIE_ROOT_PORT |
- VIR_PCI_CONNECT_TYPE_DMI_TO_PCI_BRIDGE);
+ VIR_PCI_CONNECT_TYPE_DMI_TO_PCI_BRIDGE |
+ VIR_PCI_CONNECT_TYPE_PCIE_EXPANDER_BUS);
bus->minSlot = 1;
bus->maxSlot = VIR_PCI_ADDRESS_SLOT_LAST;
break;
diff --git a/src/conf/domain_addr.h b/src/conf/domain_addr.h
index 4ce4139573..596cd4cc3d 100644
--- a/src/conf/domain_addr.h
+++ b/src/conf/domain_addr.h
@@ -41,6 +41,8 @@ typedef enum {
VIR_PCI_CONNECT_TYPE_PCIE_SWITCH_UPSTREAM_PORT = 1 << 4,
VIR_PCI_CONNECT_TYPE_PCIE_SWITCH_DOWNSTREAM_PORT = 1 << 5,
VIR_PCI_CONNECT_TYPE_DMI_TO_PCI_BRIDGE = 1 << 6,
+ VIR_PCI_CONNECT_TYPE_PCI_EXPANDER_BUS = 1 << 7,
+ VIR_PCI_CONNECT_TYPE_PCIE_EXPANDER_BUS = 1 << 8,
} virDomainPCIConnectFlags;
/* a combination of all bits that describe the type of connections
@@ -51,7 +53,9 @@ typedef enum {
VIR_PCI_CONNECT_TYPE_PCIE_SWITCH_UPSTREAM_PORT | \
VIR_PCI_CONNECT_TYPE_PCIE_SWITCH_DOWNSTREAM_PORT | \
VIR_PCI_CONNECT_TYPE_PCIE_ROOT_PORT | \
- VIR_PCI_CONNECT_TYPE_DMI_TO_PCI_BRIDGE)
+ VIR_PCI_CONNECT_TYPE_DMI_TO_PCI_BRIDGE | \
+ VIR_PCI_CONNECT_TYPE_PCI_EXPANDER_BUS | \
+ VIR_PCI_CONNECT_TYPE_PCIE_EXPANDER_BUS)
/* combination of all bits that could be used to connect a normal
* endpoint device (i.e. excluding the connection possible between an
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pci-expander-bus-bad-bus.xml b/tests/qemuxml2argvdata/qemuxml2argv-pci-expander-bus-bad-bus.xml
new file mode 100644
index 0000000000..85c1115da4
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pci-expander-bus-bad-bus.xml
@@ -0,0 +1,26 @@
+
+ expander-test
+ 3ec6cbe1-b5a2-4515-b800-31a61855df41
+ 219100
+ 219100
+ 16
+
+ hvm
+
+
+ /usr/bin/qemu-system-x86_64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pcie-expander-bus-bad-bus.xml b/tests/qemuxml2argvdata/qemuxml2argv-pcie-expander-bus-bad-bus.xml
new file mode 100644
index 0000000000..0305f356a8
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pcie-expander-bus-bad-bus.xml
@@ -0,0 +1,48 @@
+
+ pcie-expander-bus-test
+ 11dbdcdd-4c3b-482b-8903-9bdb8c0a2774
+ 2097152
+ 2097152
+ 16
+
+ hvm
+
+
+
+
+
+ |
+ |
+
+
+
+ destroy
+ restart
+ destroy
+
+ /usr/libexec/qemu-kvm
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1
+
+
+
+
+
+
+
+
+
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index c531ab9684..ad0693f406 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1731,6 +1731,9 @@ mymain(void)
DO_TEST_PARSE_ERROR("pci-expander-bus-bad-machine",
QEMU_CAPS_DEVICE_PCI_BRIDGE,
QEMU_CAPS_DEVICE_PXB);
+ DO_TEST_PARSE_ERROR("pci-expander-bus-bad-bus",
+ QEMU_CAPS_DEVICE_PCI_BRIDGE,
+ QEMU_CAPS_DEVICE_PXB);
DO_TEST("pcie-expander-bus",
QEMU_CAPS_DEVICE_PCI_BRIDGE,
@@ -1746,6 +1749,11 @@ mymain(void)
QEMU_CAPS_DEVICE_X3130_UPSTREAM,
QEMU_CAPS_DEVICE_XIO3130_DOWNSTREAM,
QEMU_CAPS_DEVICE_PXB_PCIE);
+ DO_TEST_PARSE_ERROR("pcie-expander-bus-bad-bus",
+ QEMU_CAPS_DEVICE_PCI_BRIDGE,
+ QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
+ QEMU_CAPS_DEVICE_IOH3420,
+ QEMU_CAPS_DEVICE_PXB_PCIE);
DO_TEST("hostdev-scsi-lsi",
QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI,