[PATCH v2 04/21] qemu: address: Enable auto addressing multifunction cards

Daniel Henrique Barboza danielhb413 at gmail.com
Thu Jan 30 16:44:16 UTC 2020


From: Shivaprasad G Bhat <sbhat at linux.vnet.ibm.com>

For existing domains using the primary function alone of a multifunction
card, the card is still treated as a multifunction card. This is done
to prevent hotplug of other functions when the primary function is
already hotplugged.

If the secondary functions are part of the xml without the primary
function being part of the xml, this has never been supported. So,
Libvirt doesn't consider this either as a multifunction card.

Since we're now checking PCI headers via
virHostdevIsPCIMultifunctionDevice(), changes in virpcitestdata
files were required to allow the test suit to recognize the
0005:90:01.N test device as multifunction.

Signed-off-by: Shivaprasad G Bhat <sbhat at linux.vnet.ibm.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413 at gmail.com>
---
 src/qemu/qemu_domain.h                        |  11 ++
 src/qemu/qemu_domain_address.c                | 148 +++++++++++++++++-
 tests/qemuhotplugtest.c                       |   1 +
 .../hostdev-pci-address-unassigned.args       |   9 +-
 .../hostdev-pci-multifunction.args            |  18 ++-
 .../hostdev-pci-multifunction.xml             |   8 +-
 .../qemuxml2argvdata/pseries-hostdevs-1.args  |   5 +-
 .../qemuxml2argvdata/pseries-hostdevs-3.args  |   5 +-
 tests/qemuxml2argvtest.c                      |   6 +-
 .../hostdev-pci-address-unassigned.xml        |   8 +-
 .../hostdev-pci-multifunction.xml             |  24 +--
 .../qemuxml2xmloutdata/pseries-hostdevs-1.xml |   4 +-
 .../qemuxml2xmloutdata/pseries-hostdevs-3.xml |   4 +-
 tests/virpcitestdata/0005-90-01.1.config      | Bin 256 -> 256 bytes
 tests/virpcitestdata/0005-90-01.2.config      | Bin 256 -> 256 bytes
 tests/virpcitestdata/0005-90-01.3.config      | Bin 0 -> 256 bytes
 16 files changed, 204 insertions(+), 47 deletions(-)
 create mode 100644 tests/virpcitestdata/0005-90-01.3.config

diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index c581b3a162..c54af16fa5 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -612,6 +612,17 @@ struct _qemuDomainSaveCookie {
 
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(qemuDomainSaveCookie, virObjectUnref);
 
+typedef struct _qemuDomainPCIHostdevdata qemuDomainPCIHostdevdata;
+typedef qemuDomainPCIHostdevdata *qemuDomainPCIHostdevDataPtr;
+struct _qemuDomainPCIHostdevdata {
+    const virDomainDef *def;
+    virDomainPCIAddressSetPtr addrs;
+    virDomainHostdevDefPtr device;
+};
+
+typedef int (*virDomainPCIHostdevCallback)(qemuDomainPCIHostdevDataPtr data,
+                                           virDomainHostdevDefPtr hostdev);
+
 typedef struct _qemuDomainXmlNsDef qemuDomainXmlNsDef;
 typedef qemuDomainXmlNsDef *qemuDomainXmlNsDefPtr;
 struct _qemuDomainXmlNsDef {
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index bff81082ef..3fed22d720 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -1409,11 +1409,134 @@ qemuDomainSetupIsolationGroups(virDomainDefPtr def)
 }
 
 
+#define PCI_MAX_BRIDGE_NUMBER 0xff
+#define PCI_MAX_DEVICES 32
+
+
+/**
+ * qemuDomainPCIHostDevicesIter:
+ * @data - The data->device is the one which is called-back with for
+ *         each hostdev
+ * cb() - callback to be called for each hostdev
+ * Return :
+ * If the callback for any of the hostdev fails, the Iter returns
+ * with the return value for that callback.
+ * Zero on success.
+ */
+static
+int qemuDomainPCIHostDevicesIter(qemuDomainPCIHostdevDataPtr data,
+                                 virDomainPCIHostdevCallback cb)
+{
+    size_t i;
+    int ret = -1;
+
+    /* Iterate through the PCI Hostdevices, the Mdev source is of type
+     * UUID, so skip that. */
+    for (i = 0; i < data->def->nhostdevs; i++) {
+        virDomainHostdevSubsysPtr subsys = &data->def->hostdevs[i]->source.subsys;
+        virDomainHostdevDefPtr hostdev = data->def->hostdevs[i];
+        if (data->device == hostdev)
+            continue;
+        if (data->def->hostdevs[i]->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS)
+            continue;
+        if (subsys->type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI &&
+            subsys->type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST &&
+            (subsys->type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV &&
+             subsys->u.mdev.model == VIR_MDEV_MODEL_TYPE_VFIO_PCI)) {
+            continue;
+        }
+
+        if ((ret = cb(data, hostdev)) != 0)
+            return ret;
+    }
+
+    return 0;
+}
+
+
+
+static int
+qemuDomainFindNextAggregationSlotIdxIter(virDomainDefPtr def G_GNUC_UNUSED,
+                                         virDomainDeviceDefPtr dev G_GNUC_UNUSED,
+                                         virDomainDeviceInfoPtr info,
+                                         void *opaque)
+{
+    int *aggregationSlotIdx = opaque;
+
+    if (info && info->aggregateSlotIdx == *aggregationSlotIdx)
+        return -1;
+
+    return 0;
+}
+
+
+static unsigned int
+qemuDomainFindNextSlotAggregationIdx(virDomainDefPtr def)
+{
+    int aggregateSlotIdx = 2;
+
+    while (aggregateSlotIdx < PCI_MAX_BRIDGE_NUMBER * PCI_MAX_DEVICES	&&
+           virDomainDeviceInfoIterate(def,
+                                      qemuDomainFindNextAggregationSlotIdxIter,
+                                      &aggregateSlotIdx) < 0) {
+        aggregateSlotIdx++;
+    }
+
+    return aggregateSlotIdx;
+}
+
+
+static int
+qemuDomainDefHostdevGetSlotAggregateIdx(qemuDomainPCIHostdevDataPtr data,
+                                        virDomainHostdevDefPtr hostdev)
+{
+    if (data->device &&
+        virHostdevPCIDevicesBelongToSameSlot(data->device, hostdev)) {
+        if (hostdev->info->aggregateSlotIdx > 0)
+            return hostdev->info->aggregateSlotIdx;
+    }
+
+    return 0;
+}
+
+/**
+ * qemuDomainDefDeviceFindSlotAggregateIdx:
+ * @def : domain def
+ * @dev : Find the slot aggregate for the device if other
+ *        functions are already part of the def and have
+ *        a slot aggreate idx assigned.
+ * Return:
+ *      -1: if not assigned.
+ *       0: If the device is not a hostdev or not a
+ *          multifunction device.
+ *      >0: If assinged a value;
+ **/
+int
+qemuDomainDefDeviceFindSlotAggregateIdx(virDomainDefPtr def,
+                                        virDomainDeviceDefPtr dev)
+{
+    int aggregateSlotIdx = 0;
+    virDomainHostdevDefPtr hostdev = dev->data.hostdev;
+    qemuDomainPCIHostdevdata temp = {def, NULL, hostdev};
+
+    /* Only PCI host devices are subject to isolation */
+    if (!virHostdevIsPCIMultifunctionDevice(hostdev))
+        return 0;
+
+    aggregateSlotIdx = qemuDomainPCIHostDevicesIter(&temp, qemuDomainDefHostdevGetSlotAggregateIdx);
+    if (aggregateSlotIdx > 0)
+        return aggregateSlotIdx;
+
+    return -1;
+}
+
+
 void
-qemuDomainSetDeviceSlotAggregateIdx(virDomainDefPtr def G_GNUC_UNUSED,
+qemuDomainSetDeviceSlotAggregateIdx(virDomainDefPtr def,
                                     virDomainDeviceDefPtr dev)
 {
     virDomainDeviceInfoPtr info = virDomainDeviceGetInfo(dev);
+    int aggregateSlotIdx = 0;
 
     if (!info)
         return;
@@ -1426,6 +1549,12 @@ qemuDomainSetDeviceSlotAggregateIdx(virDomainDefPtr def G_GNUC_UNUSED,
             cont->model == VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT_PORT) {
             info->aggregateSlotIdx = 1;
         }
+    } else if (dev->type == VIR_DOMAIN_DEVICE_HOSTDEV) {
+        aggregateSlotIdx = qemuDomainDefDeviceFindSlotAggregateIdx(def, dev);
+        if (aggregateSlotIdx > 0)
+            info->aggregateSlotIdx = aggregateSlotIdx;
+        else if (aggregateSlotIdx < 0)
+            info->aggregateSlotIdx = qemuDomainFindNextSlotAggregationIdx(def);
     }
 
     return;
@@ -2364,10 +2493,12 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
 
     /* Host PCI devices */
     for (i = 0; i < def->nhostdevs; i++) {
-        virDomainHostdevSubsysPtr subsys = &def->hostdevs[i]->source.subsys;
-        if (!virDeviceInfoPCIAddressIsWanted(def->hostdevs[i]->info))
+        int function = 0;
+        virDomainHostdevDefPtr hostdev = def->hostdevs[i];
+        virDomainHostdevSubsysPtr subsys = &hostdev->source.subsys;
+        if (!virDeviceInfoPCIAddressIsWanted(hostdev->info))
             continue;
-        if (def->hostdevs[i]->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS)
+        if (hostdev->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS)
             continue;
         if (subsys->type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI &&
             subsys->type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST &&
@@ -2381,9 +2512,14 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
             VIR_DOMAIN_DEVICE_ADDRESS_TYPE_UNASSIGNED)
             continue;
 
-        if (qemuDomainPCIAddressReserveNextAddr(addrs,
-                                                def->hostdevs[i]->info) < 0)
+        if (hostdev->info->aggregateSlotIdx > 1)
+            function = hostdev->source.subsys.u.pci.addr.function;
+
+        if (virDomainPCIAddressReserveNextAddr(addrs, hostdev->info,
+                                               hostdev->info->pciConnectFlags,
+                                               function) < 0) {
             return -1;
+        }
     }
 
     /* memballoon. the qemu driver only accepts virtio memballoon devices */
diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c
index 6a3e61c54b..48284fdb3e 100644
--- a/tests/qemuhotplugtest.c
+++ b/tests/qemuhotplugtest.c
@@ -87,6 +87,7 @@ qemuHotplugCreateObjects(virDomainXMLOptionPtr xmlopt,
     virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_VNC);
     virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_SPICE);
     virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_SPICE_FILE_XFER_DISABLE);
+    virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY);
 
     if (qemuTestCapsCacheInsert(driver.qemuCapsCache, priv->qemuCaps) < 0)
         return -1;
diff --git a/tests/qemuxml2argvdata/hostdev-pci-address-unassigned.args b/tests/qemuxml2argvdata/hostdev-pci-address-unassigned.args
index 42fae17444..8e031c0f1f 100644
--- a/tests/qemuxml2argvdata/hostdev-pci-address-unassigned.args
+++ b/tests/qemuxml2argvdata/hostdev-pci-address-unassigned.args
@@ -25,7 +25,8 @@ server,nowait \
 -no-shutdown \
 -no-acpi \
 -usb \
--device vfio-pci,host=0005:90:01.0,id=hostdev0,bus=pci.0,addr=0x3 \
--device vfio-pci,host=0005:90:01.2,id=hostdev2,bus=pci.0,addr=0x4 \
--device vfio-pci,host=0005:90:01.3,id=hostdev3,bus=pci.0,addr=0x5 \
--device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x6
+-device vfio-pci,host=0005:90:01.0,id=hostdev0,bus=pci.0,multifunction=on,\
+addr=0x3 \
+-device vfio-pci,host=0005:90:01.2,id=hostdev2,bus=pci.0,addr=0x3.0x2 \
+-device vfio-pci,host=0005:90:01.3,id=hostdev3,bus=pci.0,addr=0x3.0x3 \
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4
diff --git a/tests/qemuxml2argvdata/hostdev-pci-multifunction.args b/tests/qemuxml2argvdata/hostdev-pci-multifunction.args
index d8690c010b..3bf3629d48 100644
--- a/tests/qemuxml2argvdata/hostdev-pci-multifunction.args
+++ b/tests/qemuxml2argvdata/hostdev-pci-multifunction.args
@@ -25,11 +25,13 @@ server,nowait \
 -no-shutdown \
 -no-acpi \
 -usb \
--device vfio-pci,host=0005:90:01.0,id=hostdev0,bus=pci.0,addr=0x3 \
--device vfio-pci,host=0001:01:00.1,id=hostdev1,bus=pci.0,addr=0x4 \
--device vfio-pci,host=0001:01:00.0,id=hostdev2,bus=pci.0,addr=0x5 \
--device vfio-pci,host=0005:90:01.2,id=hostdev3,bus=pci.0,addr=0x6 \
--device vfio-pci,host=0005:90:01.3,id=hostdev4,bus=pci.0,addr=0x7 \
--device vfio-pci,host=0000:06:12.1,id=hostdev5,bus=pci.0,addr=0x8 \
--device vfio-pci,host=0000:06:12.2,id=hostdev6,bus=pci.0,addr=0x9 \
--device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0xa
+-device vfio-pci,host=0005:90:01.0,id=hostdev0,bus=pci.0,multifunction=on,\
+addr=0x3 \
+-device vfio-pci,host=0005:90:01.2,id=hostdev1,bus=pci.0,addr=0x3.0x2 \
+-device vfio-pci,host=0005:90:01.3,id=hostdev2,bus=pci.0,addr=0x3.0x3 \
+-device vfio-pci,host=0001:01:00.1,id=hostdev3,bus=pci.0,addr=0x4.0x1 \
+-device vfio-pci,host=0001:01:00.0,id=hostdev4,bus=pci.0,multifunction=on,\
+addr=0x4 \
+-device vfio-pci,host=0000:06:12.1,id=hostdev5,bus=pci.0,addr=0x5 \
+-device vfio-pci,host=0000:06:12.2,id=hostdev6,bus=pci.0,addr=0x6 \
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x7
diff --git a/tests/qemuxml2argvdata/hostdev-pci-multifunction.xml b/tests/qemuxml2argvdata/hostdev-pci-multifunction.xml
index 06c889c64d..a0af6c5a90 100644
--- a/tests/qemuxml2argvdata/hostdev-pci-multifunction.xml
+++ b/tests/qemuxml2argvdata/hostdev-pci-multifunction.xml
@@ -22,25 +22,25 @@
     <hostdev mode='subsystem' type='pci' managed='yes'>
       <driver name='vfio'/>
       <source>
-        <address domain='0x0001' bus='0x01' slot='0x00' function='0x1'/>
+        <address domain='0x0005' bus='0x90' slot='0x01' function='0x2'/>
       </source>
     </hostdev>
     <hostdev mode='subsystem' type='pci' managed='yes'>
       <driver name='vfio'/>
       <source>
-        <address domain='0x0001' bus='0x01' slot='0x00' function='0x0'/>
+        <address domain='0x0005' bus='0x90' slot='0x01' function='0x3'/>
       </source>
     </hostdev>
     <hostdev mode='subsystem' type='pci' managed='yes'>
       <driver name='vfio'/>
       <source>
-        <address domain='0x0005' bus='0x90' slot='0x01' function='0x2'/>
+        <address domain='0x0001' bus='0x01' slot='0x00' function='0x1'/>
       </source>
     </hostdev>
     <hostdev mode='subsystem' type='pci' managed='yes'>
       <driver name='vfio'/>
       <source>
-        <address domain='0x0005' bus='0x90' slot='0x01' function='0x3'/>
+        <address domain='0x0001' bus='0x01' slot='0x00' function='0x0'/>
       </source>
     </hostdev>
     <hostdev mode='subsystem' type='pci' managed='yes'>
diff --git a/tests/qemuxml2argvdata/pseries-hostdevs-1.args b/tests/qemuxml2argvdata/pseries-hostdevs-1.args
index 51ec025dce..d745f5bae6 100644
--- a/tests/qemuxml2argvdata/pseries-hostdevs-1.args
+++ b/tests/qemuxml2argvdata/pseries-hostdevs-1.args
@@ -26,5 +26,6 @@ server,nowait \
 -device spapr-pci-host-bridge,index=1,id=pci.1 \
 -device spapr-pci-host-bridge,index=2,id=pci.2 \
 -device vfio-pci,host=0005:90:01.0,id=hostdev0,bus=pci.1.0,addr=0x1 \
--device vfio-pci,host=0001:01:00.0,id=hostdev1,bus=pci.2.0,addr=0x1 \
--device vfio-pci,host=0001:01:00.1,id=hostdev2,bus=pci.2.0,addr=0x2
+-device vfio-pci,host=0001:01:00.0,id=hostdev1,bus=pci.2.0,multifunction=on,\
+addr=0x1 \
+-device vfio-pci,host=0001:01:00.1,id=hostdev2,bus=pci.2.0,addr=0x1.0x1
diff --git a/tests/qemuxml2argvdata/pseries-hostdevs-3.args b/tests/qemuxml2argvdata/pseries-hostdevs-3.args
index 5820140065..d29b01f4d8 100644
--- a/tests/qemuxml2argvdata/pseries-hostdevs-3.args
+++ b/tests/qemuxml2argvdata/pseries-hostdevs-3.args
@@ -25,5 +25,6 @@ server,nowait \
 -no-shutdown \
 -device spapr-pci-host-bridge,index=1,id=pci.1 \
 -device spapr-pci-host-bridge,index=2,id=pci.2 \
--device vfio-pci,host=0001:01:00.0,id=hostdev0,bus=pci.2.0,addr=0x1 \
--device vfio-pci,host=0001:01:00.1,id=hostdev1,bus=pci.2.0,addr=0x2
+-device vfio-pci,host=0001:01:00.0,id=hostdev0,bus=pci.2.0,multifunction=on,\
+addr=0x1 \
+-device vfio-pci,host=0001:01:00.1,id=hostdev1,bus=pci.2.0,addr=0x1.0x1
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index a36183bf34..dad03f1dec 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1334,7 +1334,8 @@ mymain(void)
 
     DO_TEST("hostdev-pci-multifunction",
             QEMU_CAPS_KVM,
-            QEMU_CAPS_DEVICE_VFIO_PCI);
+            QEMU_CAPS_DEVICE_VFIO_PCI,
+            QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY);
 
     DO_TEST("hostdev-pci-address-unassigned",
             QEMU_CAPS_KVM,
@@ -1927,14 +1928,17 @@ mymain(void)
             QEMU_CAPS_VIRTIO_SCSI);
     DO_TEST("pseries-hostdevs-1",
             QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
+            X_QEMU_CAPS_PCI_MULTIFUNCTION,
             QEMU_CAPS_VIRTIO_SCSI,
             QEMU_CAPS_DEVICE_VFIO_PCI);
     DO_TEST("pseries-hostdevs-2",
             QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
+            X_QEMU_CAPS_PCI_MULTIFUNCTION,
             QEMU_CAPS_VIRTIO_SCSI,
             QEMU_CAPS_DEVICE_VFIO_PCI);
     DO_TEST("pseries-hostdevs-3",
             QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
+            X_QEMU_CAPS_PCI_MULTIFUNCTION,
             QEMU_CAPS_VIRTIO_SCSI,
             QEMU_CAPS_DEVICE_VFIO_PCI);
 
diff --git a/tests/qemuxml2xmloutdata/hostdev-pci-address-unassigned.xml b/tests/qemuxml2xmloutdata/hostdev-pci-address-unassigned.xml
index 2341e8432b..d6c26c3252 100644
--- a/tests/qemuxml2xmloutdata/hostdev-pci-address-unassigned.xml
+++ b/tests/qemuxml2xmloutdata/hostdev-pci-address-unassigned.xml
@@ -28,7 +28,7 @@
       <source>
         <address domain='0x0005' bus='0x90' slot='0x01' function='0x0'/>
       </source>
-      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0' multifunction='on'/>
     </hostdev>
     <hostdev mode='subsystem' type='pci' managed='yes'>
       <driver name='vfio'/>
@@ -42,17 +42,17 @@
       <source>
         <address domain='0x0005' bus='0x90' slot='0x01' function='0x2'/>
       </source>
-      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x2'/>
     </hostdev>
     <hostdev mode='subsystem' type='pci' managed='yes'>
       <driver name='vfio'/>
       <source>
         <address domain='0x0005' bus='0x90' slot='0x01' function='0x3'/>
       </source>
-      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x3'/>
     </hostdev>
     <memballoon model='virtio'>
-      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
     </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/hostdev-pci-multifunction.xml b/tests/qemuxml2xmloutdata/hostdev-pci-multifunction.xml
index 52ed86e305..c40b2130df 100644
--- a/tests/qemuxml2xmloutdata/hostdev-pci-multifunction.xml
+++ b/tests/qemuxml2xmloutdata/hostdev-pci-multifunction.xml
@@ -28,52 +28,52 @@
       <source>
         <address domain='0x0005' bus='0x90' slot='0x01' function='0x0'/>
       </source>
-      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0' multifunction='on'/>
     </hostdev>
     <hostdev mode='subsystem' type='pci' managed='yes'>
       <driver name='vfio'/>
       <source>
-        <address domain='0x0001' bus='0x01' slot='0x00' function='0x1'/>
+        <address domain='0x0005' bus='0x90' slot='0x01' function='0x2'/>
       </source>
-      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x2'/>
     </hostdev>
     <hostdev mode='subsystem' type='pci' managed='yes'>
       <driver name='vfio'/>
       <source>
-        <address domain='0x0001' bus='0x01' slot='0x00' function='0x0'/>
+        <address domain='0x0005' bus='0x90' slot='0x01' function='0x3'/>
       </source>
-      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x3'/>
     </hostdev>
     <hostdev mode='subsystem' type='pci' managed='yes'>
       <driver name='vfio'/>
       <source>
-        <address domain='0x0005' bus='0x90' slot='0x01' function='0x2'/>
+        <address domain='0x0001' bus='0x01' slot='0x00' function='0x1'/>
       </source>
-      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x1'/>
     </hostdev>
     <hostdev mode='subsystem' type='pci' managed='yes'>
       <driver name='vfio'/>
       <source>
-        <address domain='0x0005' bus='0x90' slot='0x01' function='0x3'/>
+        <address domain='0x0001' bus='0x01' slot='0x00' function='0x0'/>
       </source>
-      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0' multifunction='on'/>
     </hostdev>
     <hostdev mode='subsystem' type='pci' managed='yes'>
       <driver name='vfio'/>
       <source>
         <address domain='0x0000' bus='0x06' slot='0x12' function='0x1'/>
       </source>
-      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
     </hostdev>
     <hostdev mode='subsystem' type='pci' managed='yes'>
       <driver name='vfio'/>
       <source>
         <address domain='0x0000' bus='0x06' slot='0x12' function='0x2'/>
       </source>
-      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
     </hostdev>
     <memballoon model='virtio'>
-      <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
     </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/pseries-hostdevs-1.xml b/tests/qemuxml2xmloutdata/pseries-hostdevs-1.xml
index e77a060a38..c09588de9d 100644
--- a/tests/qemuxml2xmloutdata/pseries-hostdevs-1.xml
+++ b/tests/qemuxml2xmloutdata/pseries-hostdevs-1.xml
@@ -40,14 +40,14 @@
       <source>
         <address domain='0x0001' bus='0x01' slot='0x00' function='0x0'/>
       </source>
-      <address type='pci' domain='0x0000' bus='0x02' slot='0x01' function='0x0'/>
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x01' function='0x0' multifunction='on'/>
     </hostdev>
     <hostdev mode='subsystem' type='pci' managed='yes'>
       <driver name='vfio'/>
       <source>
         <address domain='0x0001' bus='0x01' slot='0x00' function='0x1'/>
       </source>
-      <address type='pci' domain='0x0000' bus='0x02' slot='0x02' function='0x0'/>
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x01' function='0x1'/>
     </hostdev>
     <memballoon model='none'/>
     <panic model='pseries'/>
diff --git a/tests/qemuxml2xmloutdata/pseries-hostdevs-3.xml b/tests/qemuxml2xmloutdata/pseries-hostdevs-3.xml
index f91959b805..f01adf6d25 100644
--- a/tests/qemuxml2xmloutdata/pseries-hostdevs-3.xml
+++ b/tests/qemuxml2xmloutdata/pseries-hostdevs-3.xml
@@ -32,14 +32,14 @@
       <source>
         <address domain='0x0001' bus='0x01' slot='0x00' function='0x0'/>
       </source>
-      <address type='pci' domain='0x0000' bus='0x02' slot='0x01' function='0x0'/>
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x01' function='0x0' multifunction='on'/>
     </hostdev>
     <hostdev mode='subsystem' type='pci' managed='yes'>
       <driver name='vfio'/>
       <source>
         <address domain='0x0001' bus='0x01' slot='0x00' function='0x1'/>
       </source>
-      <address type='pci' domain='0x0000' bus='0x02' slot='0x02' function='0x0'/>
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x01' function='0x1'/>
     </hostdev>
     <memballoon model='none'/>
     <panic model='pseries'/>
diff --git a/tests/virpcitestdata/0005-90-01.1.config b/tests/virpcitestdata/0005-90-01.1.config
index beee76534041a7020c08ae9ac03d9a349c6ea12e..a60599bd342d3ebcdc7b8367ca36ad337f602fde 100644
GIT binary patch
delta 44
ycmZo*YG4vE7BFRCV-R3+7GUOK;Amg~f~JXq5)*X<85t+qEn;Cc-jFjfPzC^<7YL>R

delta 39
ucmZo*YG4vE7BFRCV-R3+7GUOK;9y{25MXGU7$`AON05<eqTQm22?_viD+cla

diff --git a/tests/virpcitestdata/0005-90-01.2.config b/tests/virpcitestdata/0005-90-01.2.config
index cfd72e4d7165bff2751ecbdc570ce7f1e0646226..a60599bd342d3ebcdc7b8367ca36ad337f602fde 100644
GIT binary patch
literal 256
zcmXpOFlAt45MXi^VCG at qXkY+>CJ=!Q7z5RUfCHEW5{!&mj0{Y5Fz#TaS&cX3;ByxM
DCDjDB

literal 256
zcmXpOc)-BMAi%_;z|6zo!oa|wz|aIFu>xbDS`csmlR$!5K#7rosSd`)Mk^@TV-u#E
T7_0Gy9FS#<5E~CbC<F-rZiWW}

diff --git a/tests/virpcitestdata/0005-90-01.3.config b/tests/virpcitestdata/0005-90-01.3.config
new file mode 100644
index 0000000000000000000000000000000000000000..a60599bd342d3ebcdc7b8367ca36ad337f602fde
GIT binary patch
literal 256
zcmXpOFlAt45MXi^VCG at qXkY+>CJ=!Q7z5RUfCHEW5{!&mj0{Y5Fz#TaS&cX3;ByxM
DCDjDB

literal 0
HcmV?d00001

-- 
2.24.1





More information about the libvir-list mailing list