[libvirt] [PATCH 2/6] qemu: allow some PCI devices to be attached to PCIe slots

Ján Tomko jtomko at redhat.com
Wed Sep 25 14:07:31 UTC 2013


On 09/25/2013 02:30 PM, Laine Stump wrote:
> Part of the resolution to:
> 
>    https://bugzilla.redhat.com/show_bug.cgi?id=1003983
> 
> Although most devices available in qemu area defined as PCI devices,
> and strictly speaking should only be attached via a PCI slot, in
> practice qemu allows them to be attached to a PCIe slot and sometimes
> this makes sense.
> 
> For example, The UHCI and EHCI USB controllers are usually attached
> directly to the PCIe "root complex" (i.e. PCIe slots) on real
> hardware, so that should be possible for a Q35-based qemu virtual
> machine as well.
> 
> We still want to prefer a standard PCi slot when auto-assigning

*PCI

> addresses, though, and in general to disallow attaching PCI devices
> via PCIe slots.
> 
> This patch makes that possible by adding a new
> QEMU_PCI_CONNECT_TYPE_EITHER_IF_CONFIG flag. Three things are done
> with this flag:
> 
> 1) It is set for the "pcie-root" controller
> 
> 2) qemuCollectPCIAddress() now has a set of nested switches that set
> this "EITHER" flag for devices that we want to allow connecting to
> pcie-root when specifically requested in the config.
> 
> 3) qemuDomainPCIAddressFlagsCompatible() adds this new flag to the
> "flagsMatchMask" if the address being checked came from config rather
> than being newly auto-allocated by libvirt (this knowledge is
> conveniently already available in the "fromConfig" arg).
> 
> Now any device having the EITHER flag set can be connected to
> pcie-root if explicitly requested, but auto-allocated addresses for
> those devices will still be standard PCI slots instead.
> 
> This patch only loosens the restrictions on devices that have been
> specifically requested, but the setup is such that it should be fairly
> easy to add new devices.
> ---
>  src/qemu/qemu_command.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++---
>  src/qemu/qemu_command.h |  4 ++++
>  2 files changed, 51 insertions(+), 3 deletions(-)
> 

The code looks OK, and it seems to work with my limited testing.

ACK, but I don't know the answer to that USB_NEC_XHCI question.

Jan




More information about the libvir-list mailing list