From 8a1acc7ebc61fe38447b7c1844014a7e5c659e30 Mon Sep 17 00:00:00 2001 From: Bjoern Walk Date: Tue, 26 Jun 2018 13:47:39 +0200 Subject: [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 Reviewed-by: Boris Fiuczynski Signed-off-by: Bjoern Walk Reviewed-by: John Ferlan --- 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 58cb0539e1..965b051fd7 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,