[libvirt PATCH] qemu_hotplug: Set correct iommufdState on error path

Pavel Hrdina via Devel posted 1 patch 1 day, 9 hours ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/25f57f6473a8038856545cdc939f9aa881a96ecd.1774956560.git.phrdina@redhat.com
src/qemu/qemu_hotplug.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
[libvirt PATCH] qemu_hotplug: Set correct iommufdState on error path
Posted by Pavel Hrdina via Devel 1 day, 9 hours ago
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
Re: [libvirt PATCH] qemu_hotplug: Set correct iommufdState on error path
Posted by Ján Tomko via Devel 1 day, 8 hours ago
On a Tuesday in 2026, Pavel Hrdina via Devel wrote:
>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(-)
>

Reviewed-by: Ján Tomko <jtomko@redhat.com>

Jano
Re: [libvirt PATCH] qemu_hotplug: Set correct iommufdState on error path
Posted by Peter Krempa via Devel 1 day, 8 hours ago
On Tue, Mar 31, 2026 at 13:32:04 +0200, Pavel Hrdina via Devel wrote:
> 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(-)

Reviewed-by: Peter Krempa <pkrempa@redhat.com>