mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
3ceb4c7df6
Since PCI bridges, PCIe bridges, PCIe switches, and PCIe root ports all share the same namespace, they are all defined as controllers of type='pci' in libvirt (but with a differing model attribute). Each of these controllers has a certain connection type upstream, allows certain connection types downstream, and each can either allow a single downstream connection at slot 0, or connections from slot 1 - 31. Right now, we only support the pci-root and pci-bridge devices, both of which only allow PCI devices to connect, and both which have usable slots 1 - 31. In preparation for adding other types of controllers that have different capabilities, this patch 1) adds info to the qemuDomainPCIAddressBus object to indicate the capabilities, 2) sets those capabilities appropriately for pci-root and pci-bridge devices, and 3) validates that the controller being connected to is the proper type when allocating slots or validating that a user-selected slot is appropriate for a device.. Having this infrastructure in place will make it much easier to add support for the other PCI controller types. While it would be possible to do all the necessary checking by just storing the controller model in the qemyuDomainPCIAddressBus, it greatly simplifies all the validation code to also keep a "flags", "minSlot" and "maxSlot" for each - that way we can just check those attributes rather than requiring a nearly identical switch statement everywhere we need to validate compatibility. You may notice many places where the flags are seemingly hard-coded to QEMU_PCI_CONNECT_HOTPLUGGABLE | QEMU_PCI_CONNECT_TYPE_PCI This is currently the correct value for all PCI devices, and in the future will be the default, with small bits of code added to change to the flags for the few devices which are the exceptions to this rule. Finally, there are a few places with "FIXME" comments. Note that these aren't indicating places that are broken according to the currently supported devices, they are places that will need fixing when support for new PCI controller models is added. To assure that there was no regression in the auto-allocation of PCI addresses or auto-creation of integrated pci-root, ide, and usb controllers, a new test case (pci-bridge-many-disks) has been added to both the qemuxml2argv and qemuxml2xml tests. This new test defines a domain with several dozen virtio disks but no pci-root or pci-bridges. The .args file of the new test case was created using libvirt sources from before this patch, and the test still passes after this patch has been applied. |
||
---|---|---|
.. | ||
qemuxml2xmlout-balloon-device-auto.xml | ||
qemuxml2xmlout-channel-virtio-auto.xml | ||
qemuxml2xmlout-console-compat-auto.xml | ||
qemuxml2xmlout-console-virtio.xml | ||
qemuxml2xmlout-disk-cdrom-empty.xml | ||
qemuxml2xmlout-disk-mirror.xml | ||
qemuxml2xmlout-disk-scsi-device-auto.xml | ||
qemuxml2xmlout-graphics-listen-network2.xml | ||
qemuxml2xmlout-graphics-spice-timeout.xml | ||
qemuxml2xmlout-hostdev-scsi-autogen-address.xml | ||
qemuxml2xmlout-memtune.xml | ||
qemuxml2xmlout-metadata.xml | ||
qemuxml2xmlout-numad-auto-memory-vcpu-cpuset.xml | ||
qemuxml2xmlout-numad-auto-memory-vcpu-no-cpuset-and-placement.xml | ||
qemuxml2xmlout-numad-auto-vcpu-no-numatune.xml | ||
qemuxml2xmlout-numad-static-vcpu-no-numatune.xml | ||
qemuxml2xmlout-pci-autoadd-addr.xml | ||
qemuxml2xmlout-pci-autoadd-idx.xml | ||
qemuxml2xmlout-pci-bridge-many-disks.xml | ||
qemuxml2xmlout-s390-defaultconsole.xml | ||
qemuxml2xmlout-serial-target-port-auto.xml | ||
qemuxml2xmlout-usb-ich9-ehci-addr.xml |