
On 05/26/2017 06:51 AM, Andrea Bolognani wrote:
We can treat mdevs the same as all other PCI hostdevs and figure out whether they are PCI Express or legacy PCI by checking the size of their config space.
Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- src/qemu/qemu_domain_address.c | 3 --- 1 file changed, 3 deletions(-)
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index 2106b34..3277d18 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -645,9 +645,6 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev, return pcieFlags; }
- if (hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV) - return pcieFlags; - if (!(pciDev = virPCIDeviceNew(hostAddr->domain, hostAddr->bus, hostAddr->slot,
This can't work. From the host's point of view, there is no PCI device whose config space can be read, and from the code's point of view, hostAddr->domain|bus|slot are invalid (they are in hostdev->source.subsys.u.pci.addr, which is only valid when (hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI). Is there maybe something standard in the mdev's sysfs entry that could be used to determine PCI vs PCIe? I think back when we were discussing the implementation of this, Alex had said there wasn't.