[libvirt] [PATCH v4 08/14] qemu: Assign PCI addresses for mediated devices as well

Erik Skultety eskultet at redhat.com
Mon Mar 27 10:48:29 UTC 2017


On Sun, Mar 26, 2017 at 02:32:23PM -0400, Laine Stump wrote:
> On 03/22/2017 11:27 AM, Erik Skultety wrote:
> > So far, the official support is for x86_64 arch guests so unless a
> > different device API than vfio-pci is available let's only turn on
> > support for PCI address assignment. Once a different device API is
> > introduced, we can enable another address type easily.
> > 
> > Signed-off-by: Erik Skultety <eskultet at redhat.com>
> > ---
> >  src/qemu/qemu_domain.h         |  1 +
> >  src/qemu/qemu_domain_address.c | 14 +++++++++++---
> >  2 files changed, 12 insertions(+), 3 deletions(-)
> > 
> > diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
> > index 1f266bffb5..4377560261 100644
> > --- a/src/qemu/qemu_domain.h
> > +++ b/src/qemu/qemu_domain.h
> > @@ -34,6 +34,7 @@
> >  # include "qemu_agent.h"
> >  # include "qemu_conf.h"
> >  # include "qemu_capabilities.h"
> > +# include "virmdev.h"
> >  # include "virchrdev.h"
> >  # include "virobject.h"
> >  # include "logging/log_manager.h"
> > diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
> > index 6d3a627868..22d8bf67d9 100644
> > --- a/src/qemu/qemu_domain_address.c
> > +++ b/src/qemu/qemu_domain_address.c
> > @@ -619,7 +619,8 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev,
> >          virPCIDeviceAddressPtr hostAddr = &hostdev->source.subsys.u.pci.addr;
> >  
> >          if (hostdev->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS ||
> > -            hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI) {
> > +            (hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI &&
> > +             hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV)) {
> >              return 0;
> >          }
> >  
> > @@ -643,6 +644,9 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev,
> >              return pcieFlags;
> >          }
> >  
> > +        if (hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV)
> > +            return pcieFlags;
> > +
> 
> 
> I think we talked about this a long time ago, and agreed this was the
> correct thing to do, but I just want to make sure everyone
> sees/understands/agrees - the bit right above this comment assumes that
> all mediated devices are PCI Express devices and should be plugged into
> a PCIe port (which would include adding a pcie-root-port and plugging it
> into that rather than directly into pcie-root).
> 
> (Hopefully nobody will come up with a new mediated device that is
> legacy-pci only...)

Hopefully not, but then, we can always adjust the code, since this doesn't have
any implications on the XML.

Erik




More information about the libvir-list mailing list