[libvirt] [PATCH] qemu_command.c: allow hostdev to be attached to PCIe bus

Steven Walter stevenrwalter at gmail.com
Thu Mar 19 17:42:52 UTC 2015


Presently attaching a host device to the pcie-root controller fails, even if
the host device is actually a PCIe device.  With this change, the attachment
succeeds, QEMU is happy, and the guest correctly sees the host device as a
child of the PCIe root.
---
 src/qemu/qemu_command.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 4d1590c..1de89e3 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -1377,6 +1377,13 @@ qemuCollectPCIAddress(virDomainDefPtr def ATTRIBUTE_UNUSED,
          */
         flags = VIR_PCI_CONNECT_TYPE_PCI | VIR_PCI_CONNECT_TYPE_PCIE;
         break;
+
+    case VIR_DOMAIN_DEVICE_HOSTDEV:
+        /* hostdev aren't hot-plugged, and can be put in either a
+         * PCI or PCIe slot
+         */
+        flags = VIR_PCI_CONNECT_TYPE_PCI | VIR_PCI_CONNECT_TYPE_PCIE;
+        break;
     }
 
     /* Ignore implicit controllers on slot 0:0:1.0:
-- 
2.1.0




More information about the libvir-list mailing list