]> xenbits.xensource.com Git - libvirt.git/commit
qemu: assign VFIO devices to PCIe addresses when appropriate
authorLaine Stump <laine@laine.org>
Wed, 2 Nov 2016 00:40:27 +0000 (20:40 -0400)
committerLaine Stump <laine@laine.org>
Wed, 30 Nov 2016 20:41:57 +0000 (15:41 -0500)
commit70249927b7c2d40220a40c96571b26734666c253
tree72244a1c6719b4908f236ff5aac551f9e17b00dc
parent9b0848d52349a432244da49b64e99a211f85a26b
qemu: assign VFIO devices to PCIe addresses when appropriate

Although nearly all host devices that are assigned to guests using
VFIO ("<hostdev>" devices in libvirt) are physically PCI Express
devices, until now libvirt's PCI address assignment has always
assigned them addresses on legacy PCI controllers in the guest, even
if the guest's machinetype has a PCIe root bus (e.g. q35 and
aarch64/virt).

This patch tries to assign them to an address on a PCIe controller
instead, when appropriate. First we do some preliminary checks that
might allow setting the flags without doing any extra work, and if
those conditions aren't met (and if libvirt is running privileged so
that it has proper permissions), we perform the (relatively) time
consuming task of reading the device's PCI config to see if it is an
Express device. If this is successful, the connect flags are set based
on the result, but if we aren't able to read the PCI config (most
likely due to the device not being present on the system at the time
of the check) we assume it is (or will be) an Express device, since
that is almost always the case anyway.
src/qemu/qemu_domain_address.c