]> git.ipfire.org Git - thirdparty/libvirt.git/commit
conf/qemu: change the way VIR_PCI_CONNECT_TYPE_* flags work
authorLaine Stump <laine@laine.org>
Tue, 15 Mar 2016 19:49:22 +0000 (15:49 -0400)
committerLaine Stump <laine@laine.org>
Thu, 14 Apr 2016 18:00:34 +0000 (14:00 -0400)
commitd1cc4605d72b1df7075e615760a41936d8c6fb96
tree4284965ebeaf3fa9fc6aa5d6b5b8bd38c05cc426
parent0d668434f46165c337a4f6bab6ffb398a0594eec
conf/qemu: change the way VIR_PCI_CONNECT_TYPE_* flags work

The flags used to determine which devices could be plugged into which
controllers were quite confusing, as they tried to create classes of
connections, then put particular devices into possibly multiple
classes, while sometimes setting multiple flags for the controllers
themselves. The attempt to have a single flag indicate, e.g. that a
root-port or a switch-downstream-port could connect was not only
confusing, it was leading to a situation where it would be impossible
to specify exactly the right combinations for a new controller.

The solution is for the VIR_PCI_CONNECT_TYPE_* flags to have a 1:1
correspondence with each type of PCI controller, plus a flag for a PCI
endpoint device and another for a PCIe endpoint device (the only
exception to this is that pci-bridge and pcie-expander-bus controllers
have their upstream connection classified as
VIR_PCI_CONNECT_TYPE_PCI_DEVICE since they can be plugged into
*exactly* the same ports as any endpoint device).  Each device then
has a single flag for connect type (plus the HOTPLUG flag if that
device can e hotplugged), and each controller sets the CONNECT bits
for all controllers that can be plugged into it, as well as for either
type of endpoint device that can be plugged in (and the HOTPLUG flag
if it can accept hotplugged devices).

With this change, it is *slightly* easier to understand the matching
of connections (as long as you remember that the flag for a
device/upstream-facing connection of a controller is the same as that
device's type, while the flags for a controller's downstream
connections is the OR of all device types that can be plugged into
that controller). More importantly, it will be possible to correctly
specify what can be plugged into a pcie-switch-expander-bus, when
support for it is added.
src/bhyve/bhyve_device.c
src/conf/domain_addr.c
src/conf/domain_addr.h
src/qemu/qemu_domain_address.c