qemu_hotplug: Remove iommufd object if no longer needed

When removing last host device using IOMMUFD remove the iommufd object
as well.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Pavel Hrdina committed 2026-02-16 15:50:39 +01:00
1 parent b21b6dcc72
commit 300ebf01b8
1 file changed
+8
+8
View File
@@ -4997,6 +4997,14 @@ qemuDomainRemoveHostDevice(virQEMUDriver *driver,
}
}
if (priv->iommufdState &&
!virDomainDefHasPCIHostdevWithIOMMUFD(vm->def)) {
qemuDomainObjEnterMonitor(vm);
ignore_value(qemuMonitorDelObject(priv->mon, "iommufd0", false));
qemuDomainObjExitMonitor(vm);
priv->iommufdState = false;
}
virDomainAuditHostdev(vm, hostdev, "detach", true);
if (!virHostdevIsPCIDevice(hostdev) &&