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.
---
docs/formatdomain.html.in | 31 +++++++++++++------
docs/schemas/domaincommon.rng | 1 +
src/conf/domain_addr.c | 6 ++++
src/conf/domain_conf.c | 3 +-
src/conf/domain_conf.h | 1 +
.../qemuxml2argv-pcie-switch-downstream-port.xml | 36 ++++++++++++++++++++++
tests/qemuxml2xmltest.c | 1 +
7 files changed, 68 insertions(+), 11 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pcie-switch-downstream-port.xml
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 646c9ee..7e16dc4 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -2998,11 +2998,12 @@
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>, or
<code>pcie-switch-upstream-port</code>.
+ <code>dmi-to-pci-bridge</code>,
<code>pcie-switch-upstream-port</code>, or
+ <code>pcie-switch-downstream-port</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 and
- pcie-switch-upstream-port <span class="since">since
1.2.17</span>)
+ 1.1.2</span>, pcie-root-port, pcie-switch-upstream-port, and
+ pcie-switch-downstream-port <span class="since">since
1.2.30</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
@@ -3058,14 +3059,24 @@
</p>
<p>
Domains with an implicit pcie-root can also add controllers
- with <code>model='pcie-root-port'</code>. This 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 (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
+ with <code>model='pcie-root-port'</code>,
+ <code>model='pcie-switch-upstream-port'</code>,
+ and <code>model='pcie-switch-downstream-port'</code>.
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 (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). (<span class="since">since 1.2.17</span>)
+ is started). pcie-switch-upstream-port is a more flexible (but
+ also more complex) device that can plug into any PCIe port on
+ the upstream side, and provides 31 ports on the downstream side
+ 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, and on its
+ downstream side provides a single hotpluggable pcie port that
+ can accept any standard pci or pcie device.
+ (<span class="since">since 1.2.30</span>)
</p>
<pre>
...
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 3f74cfc..490c0e7 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -1753,6 +1753,7 @@
<value>dmi-to-pci-bridge</value>
<value>pcie-root-port</value>
<value>pcie-switch-upstream-port</value>
+ <value>pcie-switch-downstream-port</value>
</choice>
</attribute>
</group>
diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c
index 59da745..b97a62c 100644
--- a/src/conf/domain_addr.c
+++ b/src/conf/domain_addr.c
@@ -211,6 +211,12 @@ virDomainPCIAddressBusSetModel(virDomainPCIAddressBusPtr bus,
bus->minSlot = 1;
bus->maxSlot = 31;
break;
+ case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_DOWNSTREAM_PORT:
+ /* provides one slot which is pcie and hotpluggable */
+ bus->flags = VIR_PCI_CONNECT_TYPE_PCIE | VIR_PCI_CONNECT_HOTPLUGGABLE;
+ bus->minSlot = 0;
+ bus->maxSlot = 0;
+ break;
default:
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Invalid PCI controller model %d"), model);
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index c0b8c92..8987e81 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -325,7 +325,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(virDomainControllerModelSCSI, VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LAST,
"auto",
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index b7ce0ce..1351eef 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;
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 0000000..7d30bd1
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pcie-switch-downstream-port.xml
@@ -0,0 +1,36 @@
+<domain type='qemu'>
+ <name>q35-test</name>
+ <uuid>11dbdcdd-4c3b-482b-8903-9bdb8c0a2774</uuid>
+ <memory unit='KiB'>2097152</memory>
+ <currentMemory unit='KiB'>2097152</currentMemory>
+ <vcpu placement='static' cpuset='0-1'>2</vcpu>
+ <os>
+ <type arch='x86_64' machine='q35'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/libexec/qemu-kvm</emulator>
+ <disk type='block' device='disk'>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='sda' bus='sata'/>
+ <address type='drive' controller='0' bus='0'
target='0' unit='0'/>
+ </disk>
+ <controller type='pci' index='0' model='pcie-root'/>
+ <controller type='pci' index='1'
model='dmi-to-pci-bridge'/>
+ <controller type='pci' index='2' model='pci-bridge'/>
+ <controller type='pci' index='3'
model='pcie-switch-upstream-port'/>
+ <controller type='pci' index='4'
model='pcie-switch-downstream-port'/>
+ <controller type='pci' index='5'
model='pcie-switch-downstream-port'/>
+ <controller type='pci' index='6'
model='pcie-switch-downstream-port'/>
+ <controller type='pci' index='7'
model='pcie-switch-downstream-port'/>
+ <controller type='sata' index='0'/>
+ <video>
+ <model type='qxl' ram='65536' vram='32768'
vgamem='8192' heads='1'/>
+ </video>
+ <memballoon model='none'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index e5fcc5d..d121fa0 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -568,6 +568,7 @@ mymain(void)
DO_TEST_DIFFERENT("q35");
DO_TEST("pcie-root-port");
DO_TEST("pcie-switch-upstream-port");
+ DO_TEST("pcie-switch-downstream-port");
DO_TEST("hostdev-scsi-lsi");
DO_TEST("hostdev-scsi-virtio-scsi");
--
2.1.0