On Mon, 2016-08-15 at 01:50 -0400, Laine Stump wrote:
The nec-usb-xhci device (which is a USB3 controller) has always
presented itself as a PCI device when plugged into a legacy PCI slot,
and a PCIe device when plugged into a PCIe slot, but libvirt has
always auto-assigned it to a PCI slot.
This patch changes that behavior to auto-assign to a PCIe slot on
systems that have pcie-root (e.g. Q35 and aarch64/virt).
Since we don't yet auto-create pcie-*-port controllers on demand, this
means a config with an nec-xhci USB controller that has no PCI address
assigned will also need to have an otherwise-unused pcie-*-port
controller specified:
<controller type='pci' model='pcie-root-port'/>
<controller type='usb' model='nec-xhci'/>
(this assumes there is an otherwise-unused slot on pcie-root to accept
the pcie-root-port)
---
src/qemu/qemu_domain_address.c | 7 +++++
tests/qemuxml2argvdata/qemuxml2argv-autoindex.args | 10 +++----
tests/qemuxml2argvdata/qemuxml2argv-q35-pcie.args | 21 ++++++-------
tests/qemuxml2argvdata/qemuxml2argv-q35-pcie.xml | 2 ++
.../qemuxml2argv-q35-virtio-pci.args | 7 ++---
.../qemuxml2argv-q35-virtio-pci.xml | 2 ++
tests/qemuxml2argvtest.c | 2 ++
.../qemuxml2xmlout-autoindex.xml | 10 +++----
.../qemuxml2xmloutdata/qemuxml2xmlout-q35-pcie.xml | 35 +++++++++-------------
.../qemuxml2xmlout-q35-virtio-pci.xml | 21 +++++--------
10 files changed, 55 insertions(+), 62 deletions(-)
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index 9898eef..2c1341e 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -1178,6 +1178,13 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
(def->controllers[i]->type ==
VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL))
flags = virtioFlags;
+ else if (havePCIeRoot &&
+ def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_USB
&&
This goes over 80 columns, so it will have to be split. Which
of course makes the whole thing nearly unreadable :(
+ def->controllers[i]->model ==
+ VIR_DOMAIN_CONTROLLER_MODEL_USB_NEC_XHCI)
+ flags = pcieFlags;
+ else
+ flags = pciFlags;
if (virDomainPCIAddressReserveNextSlot(addrs,
&def->controllers[i]->info,
flags) < 0)
ACK
--
Andrea Bolognani / Red Hat / Virtualization