[libvirt] [PATCH] qemu: Don't special case mdevs when assigning PCI addresses

Andrea Bolognani abologna at redhat.com
Fri Jun 2 06:20:12 UTC 2017


On Thu, 2017-06-01 at 21:24 -0400, Laine Stump wrote:
> > @@ -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).

Surely you meant to use '==' here?

> 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.

If that's the case, then there should be a comment explaining
why mdevs are treated this way. It's not at all obvious to a
reader who's not familiar with them :)

-- 
Andrea Bolognani / Red Hat / Virtualization




More information about the libvir-list mailing list