[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH] qemu: hotplug: fix mdev attach for vfio-ccw



Mediated devices of model 'vfio-ccw' are using CCW addresses, so make
sure to call the correct address preparation code for the model.

Reviewed-by: Shalini Chellathurai Saroja <shalini linux ibm com>
Reviewed-by: Boris Fiuczynski <fiuczy linux ibm com>
Signed-off-by: Bjoern Walk <bwalk linux ibm com>
---
 src/qemu/qemu_hotplug.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 7a1bbc7c..46d30ddd 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -2446,8 +2446,15 @@ qemuDomainAttachMediatedDevice(virQEMUDriverPtr driver,
     virDomainDeviceDef dev = { VIR_DOMAIN_DEVICE_HOSTDEV,
                                 { .hostdev = hostdev } };
 
-    if (qemuDomainEnsurePCIAddress(vm, &dev, driver) < 0)
-        return -1;
+    switch (hostdev->source.subsys.u.mdev.model) {
+    case VIR_MDEV_MODEL_TYPE_VFIO_PCI:
+        if (qemuDomainEnsurePCIAddress(vm, &dev, driver) < 0)
+            return -1;
+        break;
+    case VIR_MDEV_MODEL_TYPE_VFIO_CCW:
+    case VIR_MDEV_MODEL_TYPE_LAST:
+        break;
+    }
 
     if (qemuHostdevPrepareMediatedDevices(driver,
                                           vm->def->name,
-- 
2.17.0


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]