conf: new pci controller model "pcie-switch-upstream-port"

This controller can be connected only to a pcie-root-port or a
pcie-switch-downstream-port (which will be added in a later patch),
which is the reason for the new connect type
VIR_PCI_CONNECT_TYPE_PCIE_PORT. A pcie-switch-upstream-port provides
32 ports (slot=0 to slot=31) on the downstream side, which can only
have pci controllers of model "pcie-switch-downstream-port" plugged
into them, which is the reason for the other new connect type
VIR_PCI_CONNECT_TYPE_PCIE_SWITCH.
This commit is contained in:
Laine Stump 2015-06-16 15:00:44 -04:00
parent 4cde758808
commit 38ea9515af
9 changed files with 72 additions and 7 deletions

View File

@ -3032,10 +3032,11 @@
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>,
or <code>dmi-to-pci-bridge</code>.
<code>dmi-to-pci-bridge</code>, or <code>pcie-switch-upstream-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 <span class="since">since 1.2.19</span>)
1.1.2</span>, pcie-root-port and
pcie-switch-upstream-port <span class="since">since 1.2.19</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

View File

@ -1741,6 +1741,8 @@
<value>i82801b11-bridge</value>
<!-- implementations of 'pcie-root-port' -->
<value>ioh3420</value>
<!-- implementations of 'pcie-switch-upstream-port' -->
<value>x3130-upstream</value>
</choice>
</attribute>
<empty/>
@ -1787,6 +1789,7 @@
<value>pci-bridge</value>
<value>dmi-to-pci-bridge</value>
<value>pcie-root-port</value>
<value>pcie-switch-upstream-port</value>
</choice>
</attribute>
</group>

View File

@ -197,11 +197,22 @@ virDomainPCIAddressBusSetModel(virDomainPCIAddressBusPtr bus,
bus->maxSlot = VIR_PCI_ADDRESS_SLOT_LAST;
break;
case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT_PORT:
/* provides one slot which is pcie and hotpluggable */
bus->flags = VIR_PCI_CONNECT_TYPE_PCIE | VIR_PCI_CONNECT_HOTPLUGGABLE;
/* provides one slot which is pcie, can be used by devices
* that must connect to some type of "pcie-*-port", and
* is hotpluggable
*/
bus->flags = VIR_PCI_CONNECT_TYPE_PCIE
| VIR_PCI_CONNECT_TYPE_PCIE_PORT
| VIR_PCI_CONNECT_HOTPLUGGABLE;
bus->minSlot = 0;
bus->maxSlot = 0;
break;
case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_UPSTREAM_PORT:
/* 31 slots, can only accept pcie-switch-port, no hotplug */
bus->flags = VIR_PCI_CONNECT_TYPE_PCIE_SWITCH;
bus->minSlot = 0;
bus->maxSlot = 31;
break;
default:
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Invalid PCI controller model %d"), model);

View File

@ -41,6 +41,12 @@ typedef enum {
/* PCI Express devices can connect to this bus */
VIR_PCI_CONNECT_TYPE_PCIE_ROOT = 1 << 4,
/* for devices that can only connect to pcie-root (i.e. root-port) */
VIR_PCI_CONNECT_TYPE_PCIE_PORT = 1 << 5,
/* devices that can only connect to a pcie-root-port
* or pcie-downstream-switch-port
*/
VIR_PCI_CONNECT_TYPE_PCIE_SWITCH = 1 << 6,
/* devices that can only connect to a pcie-switch */
} virDomainPCIConnectFlags;
typedef struct {
@ -73,7 +79,8 @@ typedef virDomainPCIAddressSet *virDomainPCIAddressSetPtr;
*/
# define VIR_PCI_CONNECT_TYPES_MASK \
(VIR_PCI_CONNECT_TYPE_PCI | VIR_PCI_CONNECT_TYPE_PCIE | \
VIR_PCI_CONNECT_TYPE_PCIE_ROOT)
VIR_PCI_CONNECT_TYPE_PCIE_ROOT | VIR_PCI_CONNECT_TYPE_PCIE_PORT | \
VIR_PCI_CONNECT_TYPE_PCIE_SWITCH)
/* combination of all bits that could be used to connect a normal
* endpoint device (i.e. excluding the connection possible between an

View File

@ -325,14 +325,16 @@ VIR_ENUM_IMPL(virDomainControllerModelPCI, VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST,
"pcie-root",
"pci-bridge",
"dmi-to-pci-bridge",
"pcie-root-port")
"pcie-root-port",
"pcie-switch-upstream-port")
VIR_ENUM_IMPL(virDomainControllerPCIModelName,
VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_LAST,
"none",
"pci-bridge",
"i82801b11-bridge",
"ioh3420")
"ioh3420",
"x3130-upstream")
VIR_ENUM_IMPL(virDomainControllerModelSCSI, VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LAST,
"auto",

View File

@ -753,6 +753,7 @@ typedef enum {
VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE,
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_PCI_LAST
} virDomainControllerModelPCI;
@ -762,6 +763,7 @@ typedef enum {
VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PCI_BRIDGE,
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_LAST
} virDomainControllerPCIModelName;

View File

@ -2297,6 +2297,7 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def,
if (options->port == -1)
options->port = (addr->slot << 3) + addr->function;
break;
case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_UPSTREAM_PORT:
case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT:
case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT:
case VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST:

View File

@ -0,0 +1,37 @@
<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-root-port'/>
<controller type='pci' index='4' model='pcie-root-port'/>
<controller type='pci' index='5' model='pcie-switch-upstream-port'/>
<controller type='pci' index='6' model='pcie-switch-upstream-port'>
<model name='x3130-upstream'/>
</controller>
<controller type='sata' index='0'/>
<video>
<model type='qxl' ram='65536' vram='32768' vgamem='8192' heads='1'/>
</video>
<memballoon model='none'/>
</devices>
</domain>

View File

@ -569,6 +569,7 @@ mymain(void)
DO_TEST_DIFFERENT("q35");
DO_TEST("pcie-root-port");
DO_TEST("pcie-root-port-too-many");
DO_TEST("pcie-switch-upstream-port");
DO_TEST("hostdev-scsi-lsi");
DO_TEST("hostdev-scsi-virtio-scsi");