libvirt/libvirt-qemu_hotplug-Remove-iommufd-object-if-no-longer-needed.patch
Jiri Denemark 420786d401 libvirt-11.10.0-10.el9
- qemu: Introduce QEMU_CAPS_OBJECT_IOMMUFD (RHEL-150353)
- qemu: Move IOMMUFD validation to qemu_validate (RHEL-150353)
- util: Move openning IOMMU device to viriommufd (RHEL-150353)
- qemu_process: Refactor qemuProcessOpenIommuFd (RHEL-150353)
- util: Move openning VFIO device to virpci (RHEL-150353)
- qemu_process: Refactor qemuProcessOpenVfioDeviceFd (RHEL-150353)
- util: Use virPCIDevice as argument in virPCIDeviceGetVfioPath (RHEL-150353)
- conf: Introduce virHostdevIsPCIDeviceWithIOMMUFD (RHEL-150353)
- conf: Introduce virDomainDefHasPCIHostdevWithIOMMUFD (RHEL-150353)
- qemu_domain: Add missing IOMMUFD cleanup (RHEL-150353)
- qemu_process: Fix FD leak with multiple host devices using IOMMUFD (RHEL-150353)
- qemu_process: Refactor qemuProcessOpenVfioFds (RHEL-150353)
- qemuxmlconftest: Refactor host device preparation (RHEL-150353)
- qemuxmlconftest: Rename and refactor testSetupHostdevPrivateData (RHEL-150353)
- qemuxmlconftest: Set fake FD for IOMMUFD (RHEL-150353)
- qemu: Convert IOMMUFD to qemuFDPassDirect (RHEL-150353)
- qemu: Convert vfioDeviceFd to qemuFDPassDirect (RHEL-150353)
- qemu_command: Don't use host property if IOMMUFD is used (RHEL-150353)
- qemu: Save IOMMUFD state into status XML (RHEL-150353)
- qemu_hotplug: Remove iommufd object if no longer needed (RHEL-150353)
- qemu_command: Extract building IOMMUFD props to function (RHEL-150353)
- qemu_hotplug: Add support to hotplug host device with IOMMUFD (RHEL-150353)
- conf: Introduce iommufd enum for domaincaps (RHEL-138544)
- qemu: Fill iommufd domain capability (RHEL-138544)
- tests: properly mock VFIO and IOMMU checks (RHEL-138544)
- iommufd: fix FD leak in case of error (RHEL-150353)

Resolves: RHEL-138544, RHEL-150353
2026-02-18 15:10:32 +01:00

41 lines
1.4 KiB
Diff

From 28d5107c5ce7488664cedd82565167e6df7b61de Mon Sep 17 00:00:00 2001
Message-ID: <28d5107c5ce7488664cedd82565167e6df7b61de.1771423832.git.jdenemar@redhat.com>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Sun, 15 Feb 2026 19:57:12 +0100
Subject: [PATCH] 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>
(cherry picked from commit 300ebf01b88d154312c1a5a684be2add95dd7f31)
Resolves: https://issues.redhat.com/browse/RHEL-150353
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
src/qemu/qemu_hotplug.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 9445599d2c..10ad13a416 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -4986,6 +4986,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) &&
--
2.53.0