If hotplugging host device that needs to add iommufd object fails we need to remove the iommufd object as well. We also need to update the iommufdState otherwise hotplugging any host device with iommufd will fail for the same VM. Fixes: 5d16bef1a69500791be454239e3b9ac68ec53ace Signed-off-by: Pavel Hrdina <phrdina@redhat.com> --- src/qemu/qemu_hotplug.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index c86ebc59d0..9439948089 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -1679,8 +1679,10 @@ qemuDomainAttachHostPCIDevice(virQEMUDriver *driver, if (virHostdevIsPCIDeviceWithIOMMUFD(hostdev)) { qemuDomainObjEnterMonitor(vm); - if (removeiommufd) + if (removeiommufd) { + priv->iommufdState = false; ignore_value(qemuMonitorDelObject(priv->mon, "iommufd0", false)); + } qemuFDPassDirectTransferMonitorRollback(hostdevPriv->vfioDeviceFd, priv->mon); qemuFDPassDirectTransferMonitorRollback(priv->iommufd, priv->mon); -- 2.53.0