These patches implement a reccomendation from Gerd Hoffman during discussion of Marcel Apfelbaum's proposed "PCIe devices placement guidelines" document on qemu-devel: https://lists.gnu.org/archive/html/qemu-devel/2016-09/msg01381.html The basic idea is to put up to 8 pcie-root-ports on each slot of pcie-root, rather than libvirt's historical practice of assigning only a single device to each slot. This is done by defining a new pciConnectFlag - VIR_PCI_CONNECT_AGGREGATE_SLOT - which is set for any device that can be automatically placed together with other similarly flagged devices on multiple functions of the same slot. In this way we can auto-address up to 224 hotpluggable PCIe devices without needing to figure out how to automatically add upstream/downstream ports. Other types of devices could be given the same treatment, although it would make no sense for anything that you wanted to be hotplugable. In order for this all to work nicely and make sense, the PCI address reservation code has eliminated the "reserveEntireSlot" concept - if the first device assigned to a particular slot doesn't have the AGGREGATE_SLOT flag set, then it will be the only device allowed on that slot even though the address set only shows function 0 as being in use. After all of this change, using the term "Slot" in so many function names no longer makes sense; there is another patchset that I will post shortly that gets rid of all that "old inaccurate" naming. I made it separate because it isn't strictly necessary for the AGGREGATE_SLOT functionality. This series needs to be applied on top of my earlier series that adds support for plugging virtio devices into PCIe slots. Laine Stump (8): conf: use struct instead of int for each slot in virDomainPCIAddressBus conf: eliminate concept of "reserveEntireSlot" conf: eliminate repetitive code in virDomainPCIAddressGetNextSlot() conf: start search for next unused PCI address at same slot as previous find conf: new function virDomainPCIAddressIsMulti() qemu: use virDomainPCIAddressIsMulti() to determine multifunction setting conf: aggregate multiple devices on a slot when assigning PCI addresses conf: aggregate multiple pcie-root-ports onto a single slot src/conf/domain_addr.c | 290 ++++++++++++++------- src/conf/domain_addr.h | 48 +++- src/libvirt_private.syms | 1 + src/qemu/qemu_command.c | 16 +- src/qemu/qemu_domain_address.c | 35 ++- .../qemuxml2argv-pcie-root-port.args | 5 +- .../qemuxml2argv-pcie-switch-upstream-port.args | 5 +- .../qemuxml2argv-q35-default-devices-only.args | 7 +- .../qemuxml2argv-q35-multifunction.args | 43 +++ .../qemuxml2argv-q35-multifunction.xml | 51 ++++ .../qemuxml2argv-q35-pcie-autoadd.args | 30 ++- tests/qemuxml2argvdata/qemuxml2argv-q35-pcie.args | 28 +- .../qemuxml2argv-q35-virt-manager-basic.args | 13 +- .../qemuxml2argv-q35-virtio-pci.args | 28 +- tests/qemuxml2argvtest.c | 25 ++ .../qemuxml2xmlout-pcie-root-port.xml | 2 +- .../qemuxml2xmlout-pcie-switch-upstream-port.xml | 4 +- .../qemuxml2xmlout-q35-default-devices-only.xml | 8 +- .../qemuxml2xmlout-q35-multifunction.xml | 120 +++++++++ .../qemuxml2xmlout-q35-pcie-autoadd.xml | 52 ++-- .../qemuxml2xmloutdata/qemuxml2xmlout-q35-pcie.xml | 48 ++-- .../qemuxml2xmlout-q35-virt-manager-basic.xml | 20 +- .../qemuxml2xmlout-q35-virtio-pci.xml | 48 ++-- tests/qemuxml2xmltest.c | 25 ++ 24 files changed, 676 insertions(+), 276 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-q35-multifunction.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-q35-multifunction.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-multifunction.xml -- 2.7.4 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list